mirror of
https://github.com/twisterarmy/dnsseeder.git
synced 2025-09-06 03:02:09 +00:00
Fix bug with encoding nonstd ip addresses and add debug output
This commit is contained in:
parent
a599da1d6a
commit
a2ef24a926
11
dnsseeder.go
11
dnsseeder.go
@ -221,6 +221,9 @@ func (s *Seeder) addNa(nNa *wire.NetAddress) bool {
|
||||
if nNa.Port != TWSTDPORT {
|
||||
nt.dnsType = DNSV4NON
|
||||
|
||||
// force ipv4 address into a 4 byte buffer
|
||||
nt.na.IP = nt.na.IP.To4()
|
||||
|
||||
// produce the nonstdIP
|
||||
nt.nonstdIP = getNonStdIP(nt.na.IP, nt.na.Port)
|
||||
}
|
||||
@ -247,8 +250,12 @@ func getNonStdIP(rip net.IP, port uint16) net.IP {
|
||||
b[2] = byte(port >> 8)
|
||||
b[3] = byte(port & 0xff)
|
||||
|
||||
//nip := net.IPv4(b[0], b[1], b[2], b[3])
|
||||
return net.IPv4(b[0], b[1], b[2], b[3])
|
||||
encip := net.IPv4(b[0], b[1], b[2], b[3])
|
||||
if config.debug {
|
||||
log.Printf("debug encode nonstd - realip: %s port: %v encip: %s crc: %x\n", rip.String(), port, encip.String(), crcAddr)
|
||||
}
|
||||
|
||||
return encip
|
||||
}
|
||||
|
||||
// crc16 produces a crc16 from a byte slice
|
||||
|
Loading…
x
Reference in New Issue
Block a user