测试
This commit is contained in:
parent
26d8023cf1
commit
fb1b65184e
|
@ -7,6 +7,7 @@ import (
|
|||
"encoding/gob"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"os/exec"
|
||||
gen "slimming/proto/gen"
|
||||
"strings"
|
||||
|
@ -131,7 +132,7 @@ func (nc *NetCard) Run() {
|
|||
func NewNetCard() *NetCard {
|
||||
|
||||
config := water.Config{
|
||||
DeviceType: water.TAP,
|
||||
DeviceType: water.TUN,
|
||||
PlatformSpecificParams: water.PlatformSpecificParams{
|
||||
Name: "stun",
|
||||
},
|
||||
|
@ -179,7 +180,7 @@ func (nc *NetCard) runRead() {
|
|||
log.Fatal(err)
|
||||
}
|
||||
rframe = rframe[:n]
|
||||
if !waterutil.IsIPv4(rframe) {
|
||||
if !waterutil.IsIPv4(rframe) || waterutil.IPv4Source(rframe).Equal(net.IPv4(0, 0, 0, 0)) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -195,9 +196,8 @@ func (nc *NetCard) runRead() {
|
|||
|
||||
// log.Printf("Payload: % x\n", rframe.Payload())
|
||||
|
||||
log.Printf("Dst: %s Src %s\n", waterutil.IPv4Destination(rframe), waterutil.IPv4Source(rframe))
|
||||
|
||||
log.Printf("Ethertype: % x %v\n", rframe.Ethertype(), waterutil.IsIPv4(rframe))
|
||||
log.Printf("Dst: %s Src %s\n", waterutil.IPv4Destination(rframe), waterutil.IPv4Source(rframe))
|
||||
|
||||
var buffer *ExchangeBuffer
|
||||
if buffer, ok = bytesMap[realAddr]; !ok {
|
||||
|
|
Loading…
Reference in New Issue
Block a user