1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-07 08:50:25 +08:00
Files
WireGold/gold/head/raw.go
2025-03-13 01:52:35 +09:00

21 lines
283 B
Go

package head
import (
"unsafe"
)
const (
ttloffset = unsafe.Offsetof(Packet{}.TTL)
)
// ClearTTL for hash use
func ClearTTL(data []byte) {
data[ttloffset] = 0
}
// DecTTL on transferring
func DecTTL(data []byte) (drop bool) {
data[ttloffset]--
return data[ttloffset] == 0
}