新TAP测试

This commit is contained in:
黄思敏 2022-08-31 18:17:33 +08:00
parent 5bae5ca7b5
commit ac5ae1a5fb

View File

@ -41,7 +41,7 @@ func NewNetTunnel() *NetTunnel {
} }
nt.shutdown.OnClose(func() { nt.shutdown.OnClose(func() {
time.Sleep(time.Second * 2) time.Sleep(time.Second * 1)
log.Println("OnClose") log.Println("OnClose")
os.Exit(0) os.Exit(0)
}) })
@ -83,6 +83,7 @@ func NewNetTunnel() *NetTunnel {
var frame ethernet.Frame = rbuf var frame ethernet.Frame = rbuf
log.Println(len(frame))
switch frame.Ethertype() { switch frame.Ethertype() {
case ethernet.ARP: case ethernet.ARP:
log.Printf("bytes len: %d type(arp): % x", len(rbuf), frame.Ethertype()) // 数据长度 log.Printf("bytes len: %d type(arp): % x", len(rbuf), frame.Ethertype()) // 数据长度
@ -94,6 +95,7 @@ func NewNetTunnel() *NetTunnel {
client := value.(*RPCClient) client := value.(*RPCClient)
client.CheckConnect() client.CheckConnect()
client.Frame <- frame client.Frame <- frame
log.Println(client.realAddr)
return true return true
}) })
case ethernet.IPv4: case ethernet.IPv4: