zproxy/proxy/type.go

28 lines
512 B
Go
Raw Permalink Normal View History

2024-02-15 23:48:07 +08:00
package proxy
import "encoding/binary"
var (
Level = 1
packetEndian = binary.LittleEndian
RemoteID uint32 = 1
sid = RemoteID
maxSid uint32 = 1024 * 1024
MTU = 65495 //1024 * 64
HeaderSize = 16
Magic = "anki"
InitBuf = func() []byte {
buf := make([]byte, HeaderSize)
copy(buf[:len(Magic)], Magic)
return buf
}()
)
func IncID() uint32 {
if sid > maxSid {
sid = RemoteID
}
sid++
return sid
}