新TAP测试

This commit is contained in:
黄思敏 2022-08-31 18:11:50 +08:00
parent e8e66b6143
commit b885839c09
2 changed files with 3 additions and 2 deletions

View File

@ -85,7 +85,7 @@ func NewNetTunnel() *NetTunnel {
switch frame.Ethertype() { switch frame.Ethertype() {
case ethernet.ARP: case ethernet.ARP:
log.Printf("bytes len: %d type: % x", len(rbuf), frame.Ethertype()) // 数据长度 log.Printf("bytes len: %d type(arp): % x", len(rbuf), frame.Ethertype()) // 数据长度
nt.clients.Range(func(key, value any) bool { nt.clients.Range(func(key, value any) bool {
if key == nt.ipv4key { if key == nt.ipv4key {
return true return true
@ -97,7 +97,7 @@ func NewNetTunnel() *NetTunnel {
return true return true
}) })
case ethernet.IPv4: case ethernet.IPv4:
log.Printf("bytes len: %d type: % x", len(rbuf), frame) log.Printf("bytes len: %d type(ipv4): % x", len(rbuf), frame.Ethertype())
log.Println(len(frame)) log.Println(len(frame))
} }

View File

@ -97,6 +97,7 @@ func (cli *RPCClient) run() {
// Contact the server and print out its response. // Contact the server and print out its response.
buf.Reset() buf.Reset()
Compress(buf, frames) Compress(buf, frames)
frames = nil
// 发到对面的网卡 // 发到对面的网卡
err = stream.Send(&gen.Request{ err = stream.Send(&gen.Request{