Adjust logging

This commit is contained in:
Josh Deprez 2024-04-15 09:26:23 +10:00
parent 5e48bdf880
commit 465fbcd627
Signed by: josh
SSH key fingerprint: SHA256:zZji7w1Ilh2RuUpbQcqkLPrqmRwpiCSycbF2EfKm6Kw

View file

@ -312,7 +312,7 @@ func main() {
continue continue
} }
log.Printf("AURP: Received packet of length %d from %v", pktlen, raddr) // log.Printf("AURP: Received packet of length %d from %v", pktlen, raddr)
dh, pkt, parseErr := aurp.ParsePacket(pktbuf[:pktlen]) dh, pkt, parseErr := aurp.ParsePacket(pktbuf[:pktlen])
if parseErr != nil { if parseErr != nil {
@ -324,15 +324,13 @@ func main() {
return return
} }
log.Printf("AURP: The packet parsed succesfully as a %T", pkt)
if apkt, ok := pkt.(*aurp.AppleTalkPacket); ok { if apkt, ok := pkt.(*aurp.AppleTalkPacket); ok {
ddpkt := new(ddp.ExtPacket) ddpkt := new(ddp.ExtPacket)
if err := ddp.ExtUnmarshal(apkt.Data, ddpkt); err != nil { if err := ddp.ExtUnmarshal(apkt.Data, ddpkt); err != nil {
log.Printf("AURP: Couldn't unmarshal encapsulated DDP packet: %v", err) log.Printf("AURP: Couldn't unmarshal encapsulated DDP packet: %v", err)
continue continue
} }
log.Printf("DDP/AURP: Got src (%d.%d s %d) dst (%d.%d s %d) proto %d data len %d", log.Printf("DDP/AURP: Got %d.%d.%d -> %d.%d.%d proto %d data len %d",
ddpkt.SrcNet, ddpkt.SrcNode, ddpkt.SrcSocket, ddpkt.SrcNet, ddpkt.SrcNode, ddpkt.SrcSocket,
ddpkt.DstNet, ddpkt.DstNode, ddpkt.DstSocket, ddpkt.DstNet, ddpkt.DstNode, ddpkt.DstSocket,
ddpkt.Proto, len(ddpkt.Data)) ddpkt.Proto, len(ddpkt.Data))
@ -396,6 +394,8 @@ func main() {
continue continue
} }
log.Printf("AURP: Got %T", pkt)
// Existing peer? // Existing peer?
ra := udpAddrFromNet(raddr) ra := udpAddrFromNet(raddr)
pr := peers[ra] pr := peers[ra]