From 95d26c2b3ef6077794b9b7743bd225471ccd4f8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=80=9D=E6=95=8F?= Date: Thu, 1 Sep 2022 11:08:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0TAP=E6=B5=8B=E8=AF=95(TODO=20=E8=A7=A3?= =?UTF-8?q?=E6=9E=90arp)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- netcard.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/netcard.go b/netcard.go index 3a9d3c5..82a8b18 100644 --- a/netcard.go +++ b/netcard.go @@ -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))