新TAP测试(TODO 解析arp)
This commit is contained in:
parent
87a90722bd
commit
160e8d122f
|
@ -16,6 +16,7 @@ import (
|
|||
"github.com/474420502/perfectshutdown"
|
||||
"github.com/songgao/packets/ethernet"
|
||||
"github.com/songgao/water"
|
||||
"github.com/songgao/water/waterutil"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
|
@ -109,7 +110,9 @@ func NewNetTunnel() *NetTunnel {
|
|||
// })
|
||||
case ethernet.IPv4:
|
||||
log.Printf("bytes len: %d type(ipv4): % x", len(rbuf), frame.Ethertype())
|
||||
log.Printf("src: %s(%d) dst: %s(%d)", waterutil.IPv4Source(frame), waterutil.IPv4SourcePort(frame), waterutil.IPv4Destination(frame), waterutil.IPv4DestinationPort(frame))
|
||||
log.Println(len(frame))
|
||||
|
||||
}
|
||||
|
||||
// TODO: 判断地址 转入对应的客户端发送数据
|
||||
|
|
|
@ -7,12 +7,12 @@ option go_package = "proto/gen";
|
|||
package frame;
|
||||
|
||||
service FrameService {
|
||||
rpc SendFrames (stream Request) returns (Response);
|
||||
rpc SendFrames (stream RequestFrames) returns (Response);
|
||||
rpc SendMacIP(RequestMacIP) returns (Response);
|
||||
}
|
||||
|
||||
// 请求
|
||||
message Request {
|
||||
int32 Type = 1;
|
||||
message RequestFrames {
|
||||
bytes Frames = 2;
|
||||
}
|
||||
|
||||
|
@ -21,4 +21,11 @@ message Response {
|
|||
int32 Code = 1;
|
||||
string Message = 2;
|
||||
bytes Data = 3;
|
||||
}
|
||||
|
||||
|
||||
// 请求
|
||||
message RequestMacIP {
|
||||
bytes IP = 1;
|
||||
bytes MAC = 2;
|
||||
}
|
Loading…
Reference in New Issue
Block a user