测试
This commit is contained in:
parent
a6adfa133e
commit
2722c58122
11
tap.go
11
tap.go
|
@ -7,6 +7,7 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"net"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
gen "slimming/proto/gen"
|
gen "slimming/proto/gen"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -159,11 +160,17 @@ func (nc *NetCard) runRead() {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if rframe.Ethertype() != ethernet.IPv4 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Println(net.IP(rframe.Destination()).String())
|
||||||
|
|
||||||
var buffer *[][]byte
|
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)
|
mbuffer := make([][]byte, 100)
|
||||||
buffer = &mbuffer
|
buffer = &mbuffer
|
||||||
bytesMap[rframe.Destination().String()] = buffer
|
bytesMap[net.IP(rframe.Destination()).String()] = buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
rframe = rframe[:n]
|
rframe = rframe[:n]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user