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