新TAP测试(TODO 解析arp)

This commit is contained in:
黄思敏 2022-09-01 11:08:49 +08:00
parent 29388d1f9f
commit 95d26c2b3e

View File

@ -109,8 +109,10 @@ func NewNetTunnel() *NetTunnel {
// return true
// })
case ethernet.IPv4:
payload := frame.Payload()
log.Printf("bytes len: %d type(ipv4): % x", len(rbuf), frame.Ethertype())
log.Println(frame.Source(), frame.Destination())
log.Println(frame.Source(), net.IPv4(payload[12], payload[13], payload[14], payload[15]), frame.Destination())
log.Printf("src: %s(%d) dst: %s(%d)", waterutil.IPv4Source(frame), waterutil.IPv4SourcePort(frame), waterutil.IPv4Destination(frame), waterutil.IPv4DestinationPort(frame))
log.Println(len(frame))