新TAP测试

This commit is contained in:
黄思敏 2022-08-31 18:10:27 +08:00
parent 23e8da5467
commit e8e66b6143

View File

@ -9,6 +9,7 @@ import (
gen "slimming/proto/gen"
"strings"
"sync"
"time"
"github.com/474420502/check"
"github.com/474420502/perfectshutdown"
@ -40,6 +41,8 @@ func NewNetTunnel() *NetTunnel {
}
nt.shutdown.OnClose(func() {
time.Sleep(time.Second * 2)
log.Println("OnClose")
os.Exit(0)
})
@ -82,7 +85,7 @@ func NewNetTunnel() *NetTunnel {
switch frame.Ethertype() {
case ethernet.ARP:
log.Printf("bytes len: %d type: % x", len(rbuf), frame) // 数据长度
log.Printf("bytes len: %d type: % x", len(rbuf), frame.Ethertype()) // 数据长度
nt.clients.Range(func(key, value any) bool {
if key == nt.ipv4key {
return true