1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-04 23:40:26 +08:00

feat(p2p): change magic of tcp

This commit is contained in:
源文雨
2024-08-03 14:55:23 +08:00
parent ecff222074
commit 08688b584b

View File

@@ -23,13 +23,10 @@ const (
packetTypeTop
)
const magic = 0x12d3fde9
var magicbuf [4]byte
func init() {
binary.LittleEndian.PutUint32(magicbuf[:], magic)
}
var (
magicbuf = []byte("GET ")
magic = binary.LittleEndian.Uint32(magicbuf)
)
type packet struct {
typ packetType
@@ -44,7 +41,7 @@ func (p *packet) pack() (net.Buffers, func()) {
w.WriteByte(byte(p.typ))
w.WriteUInt16(p.len)
})
return net.Buffers{magicbuf[:], d, p.dat}, cl
return net.Buffers{magicbuf, d, p.dat}, cl
}
func (p *packet) Read(_ []byte) (int, error) {