Documentation ¶
Index ¶
- Constants
- func PutPacket(p *Packet)
- type Notify
- type Packet
- func (p *Packet) AdditionalData() uint16
- func (p *Packet) FillHash()
- func (p *Packet) IsVaildHash() bool
- func (p *Packet) Marshal(src net.IP, teatype uint8, additional uint16, datasz uint32, offset uint16, ...) ([]byte, func())
- func (p *Packet) Put()
- func (p *Packet) Unmarshal(data []byte) (complete bool, err error)
- type Query
Constants ¶
View Source
const ( ProtoHello uint8 = iota ProtoNotify ProtoQuery ProtoData )
Proto 类型定义
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Packet ¶
type Packet struct { // TeaTypeDataSZ len(Data) // 高 4 位指定加密所用 tea key // 高 4-16 位是递增值, 用于预共享密钥验证 additionalData // 不得超过 65507-head 字节 TeaTypeDataSZ uint32 // Proto 详见 head Proto uint8 // TTL is time to live TTL uint8 // SrcPort 源端口 SrcPort uint16 // DstPort 目的端口 DstPort uint16 // Flags 高3位为标志(xDM),低13位为分片偏移 Flags uint16 // Src 源 ip (ipv4) Src net.IP // Dst 目的 ip (ipv4) Dst net.IP // Hash 使用 BLAKE2 生成加密前 Packet 的摘要 // 生成时 Hash 全 0 // https://github.com/fumiama/blake2b-simd Hash [32]byte // CRC64 包头字段的 checksum 值,可以认为在一定时间内唯一 CRC64 uint64 // Data 承载的数据 Data []byte // contains filtered or unexported fields }
Packet 是发送和接收的最小单位
func (*Packet) AdditionalData ¶ added in v0.9.4
AdditionalData 获得 packet 的 additionalData
Click to show internal directories.
Click to hide internal directories.