magic
This commit is contained in:
21
client/golang/structs/file_transfer.go
Normal file
21
client/golang/structs/file_transfer.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package structs
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
type SaprusFileTransfer struct {
|
||||
Flag [1]byte
|
||||
Sequence [2]byte
|
||||
Checksum [2]byte
|
||||
Payload []byte
|
||||
}
|
||||
|
||||
func (c SaprusFileTransfer) Bytes() []byte {
|
||||
data := []byte{}
|
||||
data = append(data, c.Flag[0])
|
||||
data = append(data, c.Sequence[0], c.Sequence[1])
|
||||
data = append(data, c.Checksum[0], c.Checksum[1])
|
||||
data = append(data, c.Payload...)
|
||||
return data
|
||||
}
|
||||
|
||||
21
client/golang/structs/message.go
Normal file
21
client/golang/structs/message.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package structs
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
type SaprusClientMessage struct {
|
||||
Flag [1]byte
|
||||
Sequence [2]byte
|
||||
Checksum [2]byte
|
||||
Payload []byte
|
||||
}
|
||||
|
||||
func (c SaprusClientMessage) Bytes() []byte {
|
||||
data := []byte{}
|
||||
data = append(data, c.Flag[0])
|
||||
data = append(data, c.Sequence[0], c.Sequence[1])
|
||||
data = append(data, c.Checksum[0], c.Checksum[1])
|
||||
data = append(data, c.Payload...)
|
||||
return data
|
||||
}
|
||||
|
||||
18
client/golang/structs/saprus.go
Normal file
18
client/golang/structs/saprus.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package structs
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
type SaprusHeaderFrame struct {
|
||||
PacketType [2]byte
|
||||
Length [2]byte
|
||||
Payload []byte
|
||||
}
|
||||
|
||||
func (c SaprusHeaderFrame) Bytes() []byte {
|
||||
data := []byte{}
|
||||
data = append(data, c.PacketType[0], c.PacketType[1])
|
||||
data = append(data, c.Length[0], c.Length[1])
|
||||
data = append(data, c.Payload...)
|
||||
return data
|
||||
}
|
||||
Reference in New Issue
Block a user