First completly working solution

This commit is contained in:
Zam
2023-11-09 10:59:55 +01:00
parent edd4a9a760
commit 3f975ab85f
9 changed files with 947 additions and 283 deletions

View File

@@ -1,34 +0,0 @@
package packets
type Packet struct {
header Header
data Data
}
type Header struct {
headerLength uint32
flag HeaderFlag
sync uint32
dataLength uint32
}
type Data interface {
ToBytes() []byte
}
type StringData string
func (s StringData) ToBytes() []byte {
return []byte(s)
}
type HeaderFlag uint32
const (
Request HeaderFlag = iota
PTE HeaderFlag = iota
Ack HeaderFlag = iota
File HeaderFlag = iota
End HeaderFlag = iota
Resend HeaderFlag = iota
)