1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-21 19:13:20 +08:00
This commit is contained in:
fumiama
2021-10-24 00:52:13 +08:00
parent e015094337
commit 151da51230
12 changed files with 210 additions and 0 deletions

27
gold/head/packet.go Normal file
View File

@@ -0,0 +1,27 @@
package head
type Packet struct {
Proto uint8
SrcPort uint16
DstPort uint16
TTL uint8
Data []byte
}
func NewPacket(proto uint8, srcPort uint16, dstPort uint16, data []byte) *Packet {
return &Packet{
Proto: proto,
SrcPort: srcPort,
DstPort: dstPort,
TTL: 255,
Data: data,
}
}
func (p *Packet) UnMashal(data []byte) {
}
func (p *Packet) Mashal() []byte {
return nil
}

7
gold/head/protos.go Normal file
View File

@@ -0,0 +1,7 @@
package head
const (
ProtoHello uint8 = iota
ProtoHelloAck
ProtoData
)