diff --git a/tap.go b/tap.go index 6be7897..895b911 100644 --- a/tap.go +++ b/tap.go @@ -7,6 +7,7 @@ import ( "flag" "fmt" "log" + "net" "os/exec" gen "slimming/proto/gen" "strings" @@ -159,11 +160,17 @@ func (nc *NetCard) runRead() { log.Fatal(err) } + if rframe.Ethertype() != ethernet.IPv4 { + continue + } + + log.Println(net.IP(rframe.Destination()).String()) + var buffer *[][]byte - if buffer, ok = bytesMap[rframe.Destination().String()]; !ok { + if buffer, ok = bytesMap[net.IP(rframe.Destination()).String()]; !ok { mbuffer := make([][]byte, 100) buffer = &mbuffer - bytesMap[rframe.Destination().String()] = buffer + bytesMap[net.IP(rframe.Destination()).String()] = buffer } rframe = rframe[:n]