re Update bind.go

pull/4926/head
xqzr 2025-07-23 20:06:40 +08:00 committed by GitHub
parent 21548af62f
commit defe743b23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -230,9 +230,11 @@ func (e netEndpoint) SrcIP() netip.Addr {
} }
func (e netEndpoint) DstToBytes() []byte { func (e netEndpoint) DstToBytes() []byte {
var dat []byte = e.dst.Address.IP().To16()[:] var dat []byte
if e.dst.Address.Family().IsIPv4() { if e.dst.Address.Family().IsIPv4() {
dat = e.dst.Address.IP().To4()[:] dat = e.dst.Address.IP().To4()[:]
} else {
dat = e.dst.Address.IP().To16()[:]
} }
dat = append(dat, byte(e.dst.Port), byte(e.dst.Port>>8)) dat = append(dat, byte(e.dst.Port), byte(e.dst.Port>>8))
return dat return dat