新TAP测试(TODO 解析arp)
This commit is contained in:
parent
95d26c2b3e
commit
11c0b2ab17
|
@ -111,7 +111,8 @@ func NewNetTunnel() *NetTunnel {
|
||||||
case ethernet.IPv4:
|
case ethernet.IPv4:
|
||||||
payload := frame.Payload()
|
payload := frame.Payload()
|
||||||
log.Printf("bytes len: %d type(ipv4): % x", len(rbuf), frame.Ethertype())
|
log.Printf("bytes len: %d type(ipv4): % x", len(rbuf), frame.Ethertype())
|
||||||
log.Println(frame.Source(), net.IPv4(payload[12], payload[13], payload[14], payload[15]), frame.Destination())
|
|
||||||
|
log.Println(frame.Source(), net.IP(payload[12:16]).To4(), binary.BigEndian.Uint16(frame[20:22]), frame.Destination(), net.IP(payload[16:20]).To4(), binary.BigEndian.Uint16(frame[22:24]))
|
||||||
|
|
||||||
log.Printf("src: %s(%d) dst: %s(%d)", waterutil.IPv4Source(frame), waterutil.IPv4SourcePort(frame), waterutil.IPv4Destination(frame), waterutil.IPv4DestinationPort(frame))
|
log.Printf("src: %s(%d) dst: %s(%d)", waterutil.IPv4Source(frame), waterutil.IPv4SourcePort(frame), waterutil.IPv4Destination(frame), waterutil.IPv4DestinationPort(frame))
|
||||||
log.Println(len(frame))
|
log.Println(len(frame))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user