refactor package naming
This commit is contained in:
parent
7f5337ac04
commit
5342cfec63
5 changed files with 15 additions and 9 deletions
|
|
@ -2,18 +2,18 @@ package crypto
|
|||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"lux/types"
|
||||
"lux/proto"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type LuxKey struct {
|
||||
Type types.LuxType
|
||||
Type proto.LuxType
|
||||
Id uuid.UUID
|
||||
Key []byte
|
||||
}
|
||||
|
||||
func (key *LuxKey) NewLuxKey(keyType types.LuxType) error {
|
||||
func (key *LuxKey) NewLuxKey(keyType proto.LuxType) error {
|
||||
key.Type = keyType
|
||||
key.Id = uuid.New()
|
||||
key.Key = make([]byte, 32)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package types
|
||||
package proto
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
6
proto/lux_data.go
Normal file
6
proto/lux_data.go
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
package proto
|
||||
|
||||
type LuxData interface {
|
||||
Read(rd *LuxBuffer) error
|
||||
Write(wd *LuxBuffer) error
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package types
|
||||
package proto
|
||||
|
||||
type LuxType uint
|
||||
|
||||
|
|
@ -2,7 +2,7 @@ package tests
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"lux/types"
|
||||
"lux/proto"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ func TestWriteGrow(t *testing.T) {
|
|||
first, second := []byte{1, 2, 3, 4}, []byte{5, 6, 7, 8}
|
||||
must := []byte{1, 2, 3, 4, 5, 6, 7, 8}
|
||||
|
||||
buf := types.AllocLuxBuffer(4)
|
||||
buf := proto.AllocLuxBuffer(4)
|
||||
buf.WriteBytes(first)
|
||||
t.Log(buf.AllBytes())
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ func TestWriteGrow(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestInts(t *testing.T) {
|
||||
wd := types.AllocLuxBuffer(1)
|
||||
wd := proto.AllocLuxBuffer(1)
|
||||
wd.WriteUint16(1234)
|
||||
wd.WriteUint16(4321)
|
||||
wd.WriteUint64(69)
|
||||
|
|
@ -44,7 +44,7 @@ func TestInts(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestStrings(t *testing.T) {
|
||||
wd := types.AllocLuxBuffer(1)
|
||||
wd := proto.AllocLuxBuffer(1)
|
||||
wd.WriteString("a") // 4
|
||||
wd.WriteString("hello") // 8
|
||||
|
||||
Loading…
Add table
Reference in a new issue