更新客户端和服务器的代理管理逻辑,添加UDP连接支持,重命名相关方法以提高可读性,修复了TCP和UDP数据处理中的错误,调整了protobuf定义以匹配新的命名空间。

This commit is contained in:
nite 2025-03-22 19:38:55 +11:00
parent d1997b6e1f
commit 11984f18de
10 changed files with 379 additions and 205 deletions

View File

@ -15,10 +15,10 @@ func main() {
cli := client.NewClient("localhost", 7000)
// 添加 TCP 代理示例
cli.AddProxy("ssh", pb.ProxyType_TCP, "127.0.0.1", 22, 2222)
// cli.AddProxy("ssh", pb.ProxyType_TCP, "127.0.0.1", 22, 2222)
// 添加 UDP 代理示例
// cli.AddProxy("dns", pb.ProxyType_UDP, "8.8.8.8", 53, 5353)
cli.AddProxy("dns", pb.ProxyType_UDP, "127.0.0.1", 9999, 10000)
// 启动客户端
if err := cli.Start(); err != nil {

View File

@ -6,7 +6,6 @@ import (
"log"
"net"
"os"
"strings"
"sync"
"time"
@ -18,28 +17,30 @@ import (
// Client 客户端
type Client struct {
serverAddr string
serverPort int
conn *grpc.ClientConn
client pb.TunnelServiceClient
stream pb.TunnelService_ConnectClient
ctx context.Context
cancel context.CancelFunc
proxies *pb.ProxyConfigs
mu sync.Mutex
connections sync.Map // map[connID]*ConnectionState
serverAddr string
serverPort int
conn *grpc.ClientConn
client pb.TunnelServiceClient
stream pb.TunnelService_ConnectClient
ctx context.Context
cancel context.CancelFunc
proxies *pb.ProxyConfigs
mu sync.Mutex
tcpConnections sync.Map // map[connID]*TCPConnectionState
udpConnections sync.Map // map[connID]*net.UDPConn
}
// NewClient 创建一个新的客户端
func NewClient(serverAddr string, serverPort int) *Client {
ctx, cancel := context.WithCancel(context.Background())
return &Client{
serverAddr: serverAddr,
serverPort: serverPort,
ctx: ctx,
cancel: cancel,
proxies: &pb.ProxyConfigs{},
connections: sync.Map{},
serverAddr: serverAddr,
serverPort: serverPort,
ctx: ctx,
cancel: cancel,
proxies: &pb.ProxyConfigs{},
tcpConnections: sync.Map{},
udpConnections: sync.Map{},
}
}
@ -72,7 +73,7 @@ func (c *Client) Start() error {
c.client = pb.NewTunnelServiceClient(conn)
// 建立控制连接
if err := c.establishControlConnection(); err != nil {
if err := c.connect(); err != nil {
return err
}
@ -82,10 +83,16 @@ func (c *Client) Start() error {
// Stop 停止客户端
func (c *Client) Stop() {
// 关闭所有连接
c.connections.Range(func(key, value interface{}) bool {
c.tcpConnections.Range(func(key, value any) bool {
connState := value.(*TCPConnectionState)
connState.Close()
c.connections.Delete(key)
c.tcpConnections.Delete(key)
return true
})
c.udpConnections.Range(func(key, value any) bool {
connState := value.(*net.UDPConn)
connState.Close()
c.udpConnections.Delete(key)
return true
})
@ -96,8 +103,8 @@ func (c *Client) Stop() {
}
}
// establishControlConnection 建立控制连接
func (c *Client) establishControlConnection() error {
// connect 建立控制连接
func (c *Client) connect() error {
stream, err := c.client.Connect(c.ctx)
if err != nil {
return fmt.Errorf("failed to establish control connection: %v", err)
@ -127,16 +134,21 @@ func (c *Client) receiveMessages() {
log.Printf("Control connection closed: %v", err)
// 尝试重连
time.Sleep(5 * time.Second)
if err := c.establishControlConnection(); err != nil {
if err := c.connect(); err != nil {
log.Printf("Failed to re-establish control connection: %v", err)
return
}
return
}
switch msg.GetContent().(type) {
switch v := msg.GetContent().(type) {
case *pb.Message_ProxyData:
c.handleProxyData(msg)
switch v.ProxyData.ProxyConfig.Type {
case pb.ProxyType_TCP:
c.handleTCPData(v)
case pb.ProxyType_UDP:
c.handleUDPData(v)
}
case *pb.Message_RegisterProxiesError:
c.handleRegisterProxiesError(msg)
case *pb.Message_RegisterConfigs:
@ -147,45 +159,6 @@ func (c *Client) receiveMessages() {
}
}
func (c *Client) handleProxyData(msg *pb.Message) {
proxyData := msg.GetProxyData()
log.Printf("Received proxy data for connection: %v", proxyData.ConnId)
// 处理代理数据
hostPort := net.JoinHostPort(proxyData.ProxyConfig.LocalIp, fmt.Sprintf("%d", proxyData.ProxyConfig.LocalPort))
existingConn, ok := c.connections.Load(proxyData.ConnId)
var connState *TCPConnectionState
if ok {
connState = existingConn.(*TCPConnectionState)
} else {
conn, err := net.Dial(strings.ToLower(proxyData.ProxyConfig.Type.String()), hostPort)
if err != nil {
log.Printf("Failed to connect to proxy: %v", err)
return
}
switch strings.ToLower(proxyData.ProxyConfig.Type.String()) {
case "tcp":
if tcpConn, ok := conn.(*net.TCPConn); ok {
_ = tcpConn.SetKeepAlive(true)
_ = tcpConn.SetKeepAlivePeriod(30 * time.Second)
_ = tcpConn.SetNoDelay(true)
}
}
connState = NewTCPConnectionState(conn, proxyData.ConnId, proxyData.ProxyConfig, c.stream)
c.connections.Store(proxyData.ConnId, connState)
}
err := connState.WriteData(proxyData.Data)
if err != nil {
log.Printf("Failed to write data: %v", err)
connState.Close()
c.connections.Delete(proxyData.ConnId)
return
}
connState.StartReading()
}
func (c *Client) handleRegisterProxiesError(msg *pb.Message) {
registerProxiesError := msg.GetRegisterProxiesError()
log.Printf("Register proxies error: %v", registerProxiesError.ProxyConfig.Name)
@ -201,9 +174,9 @@ func (c *Client) handleRegisterConfigs(msg *pb.Message) {
func (c *Client) handleProxyError(msg *pb.Message) {
proxyError := msg.GetProxyError()
connState, ok := c.connections.Load(proxyError.ConnId)
connState, ok := c.tcpConnections.Load(proxyError.ConnId)
if ok {
connState.(*TCPConnectionState).Close()
c.connections.Delete(proxyError.ConnId)
c.tcpConnections.Delete(proxyError.ConnId)
}
}

48
internal/client/tcp.go Normal file
View File

@ -0,0 +1,48 @@
package client
import (
"fmt"
"log"
"net"
pb "net-tunnel/pkg/proto"
"strings"
"time"
)
func (c *Client) handleTCPData(msg *pb.Message_ProxyData) {
log.Printf("Received proxy data for connection: %v", msg.ProxyData.ConnId)
// 处理代理数据
hostPort := net.JoinHostPort(msg.ProxyData.ProxyConfig.LocalIp, fmt.Sprintf("%d", msg.ProxyData.ProxyConfig.LocalPort))
existingConn, ok := c.tcpConnections.Load(msg.ProxyData.ConnId)
var connState *TCPConnectionState
if ok {
connState = existingConn.(*TCPConnectionState)
} else {
conn, err := net.Dial(strings.ToLower(msg.ProxyData.ProxyConfig.Type.String()), hostPort)
if err != nil {
log.Printf("Failed to connect to proxy: %v", err)
return
}
switch strings.ToLower(msg.ProxyData.ProxyConfig.Type.String()) {
case "tcp":
if tcpConn, ok := conn.(*net.TCPConn); ok {
_ = tcpConn.SetKeepAlive(true)
_ = tcpConn.SetKeepAlivePeriod(30 * time.Second)
_ = tcpConn.SetNoDelay(true)
}
}
connState = NewTCPConnectionState(conn, msg.ProxyData.ConnId, msg.ProxyData.ProxyConfig, c.stream)
c.tcpConnections.Store(msg.ProxyData.ConnId, connState)
}
err := connState.WriteData(msg.ProxyData.Data)
if err != nil {
log.Printf("Failed to write data: %v", err)
connState.Close()
c.tcpConnections.Delete(msg.ProxyData.ConnId)
return
}
connState.StartReading()
}

83
internal/client/udp.go Normal file
View File

@ -0,0 +1,83 @@
package client
import (
"fmt"
"log"
"net"
pb "net-tunnel/pkg/proto"
"time"
)
func (c *Client) handleUDPData(msg *pb.Message_ProxyData) {
log.Printf("Received UDP proxy data for connection: %v", msg.ProxyData.ConnId)
hostPort := net.JoinHostPort(msg.ProxyData.ProxyConfig.LocalIp, fmt.Sprintf("%d", msg.ProxyData.ProxyConfig.LocalPort))
// 获取或创建 UDP 连接
udpConnKey := msg.ProxyData.ConnId
var conn *net.UDPConn
existingConn, ok := c.udpConnections.Load(udpConnKey)
if ok {
conn = existingConn.(*net.UDPConn)
} else {
udpAddr, err := net.ResolveUDPAddr("udp", hostPort)
if err != nil {
log.Printf("Failed to resolve UDP address: %v", err)
return
}
conn, err = net.DialUDP("udp", nil, udpAddr)
if err != nil {
log.Printf("Failed to dial UDP address: %v", err)
return
}
c.udpConnections.Store(udpConnKey, conn)
go c.readFromUDPConn(msg, conn)
}
_, err := conn.Write(msg.ProxyData.Data)
if err != nil {
log.Printf("Failed to write data to UDP connection: %v", err)
conn.Close()
c.udpConnections.Delete(udpConnKey)
return
}
}
func (c *Client) readFromUDPConn(msg *pb.Message_ProxyData, conn *net.UDPConn) {
buffer := make([]byte, 4096)
for {
err := conn.SetReadDeadline(time.Now().Add(time.Minute * 10))
if err != nil {
log.Printf("Failed to set read deadline: %v", err)
return
}
n, _, err := conn.ReadFromUDP(buffer)
if err != nil {
if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
continue
}
log.Printf("Failed to read from UDP connection: %v", err)
return
}
if n > 0 {
msg := &pb.Message{
Content: &pb.Message_ProxyData{
ProxyData: &pb.ProxyData{
ConnId: msg.ProxyData.ConnId,
ProxyConfig: msg.ProxyData.ProxyConfig,
Data: buffer[:n],
},
},
}
if err := c.stream.Send(msg); err != nil {
log.Printf("Failed to send proxy data: %v", err)
break
}
}
}
conn.Close()
c.udpConnections.Delete(msg.ProxyData.ConnId)
log.Printf("UDP connection closed: %v", msg.ProxyData.ConnId)
}

View File

@ -18,6 +18,7 @@ type ProxyEntry struct {
TCPListener net.Listener
TCPConns sync.Map
UDPConn *net.UDPConn
UDPAddrs sync.Map // map[connID]net.UDPAddr
}
// ProxyManager 管理所有代理
@ -148,32 +149,36 @@ func (m *ProxyManager) handleTCPConnections(entry *ProxyEntry) {
break
}
go m.handleTCPConnection(entry, conn)
connID := fmt.Sprintf("%s_%d", conn.RemoteAddr().String(), time.Now().UnixNano())
entry.TCPConns.Store(connID, conn)
log.Printf("TCP connection for %s accepted", connID)
go m.handleTCPConnection(entry, connID, conn)
}
}
// handleUDPPackets 处理传入的 UDP 数据包
func (m *ProxyManager) handleUDPPackets(entry *ProxyEntry) {
// buffer := make([]byte, 4096)
// for {
// n, addr, err := entry.UDPConn.ReadFromUDP(buffer)
// if err != nil {
// // 连接可能已关闭
// log.Printf("UDP connection for %s closed: %v", entry.Config.Name, err)
// break
// }
buffer := make([]byte, 4096)
for {
n, addr, err := entry.UDPConn.ReadFromUDP(buffer)
if err != nil {
// 连接可能已关闭
log.Printf("UDP connection for %s closed: %v", entry.Config.Name, err)
break
}
entry.UDPAddrs.Store(addr.String(), addr)
log.Printf("UDP connection for %s accepted", addr.String())
// go m.handleUDPPacket(entry, buffer[:n], addr)
// }
go m.handleUDPPacket(entry, buffer[:n], addr)
}
}
func (m *ProxyManager) handleTCPConnection(entry *ProxyEntry, conn net.Conn) {
func (m *ProxyManager) handleTCPConnection(entry *ProxyEntry, connID string, conn net.Conn) {
if tcpConn, ok := conn.(*net.TCPConn); ok {
_ = tcpConn.SetKeepAlive(true)
_ = tcpConn.SetKeepAlivePeriod(30 * time.Second)
_ = tcpConn.SetNoDelay(true)
}
connID := fmt.Sprintf("%s_%d", conn.RemoteAddr().String(), time.Now().UnixNano())
defer func() {
conn.Close()
@ -182,15 +187,12 @@ func (m *ProxyManager) handleTCPConnection(entry *ProxyEntry, conn net.Conn) {
}()
// 获取客户端的控制连接
controlConn, ok := m.clientManager.Get(entry.ClientID)
c, ok := m.clientManager.Get(entry.ClientID)
if !ok {
log.Printf("Control connection not found for client %s", entry.ClientID)
return
}
entry.TCPConns.Store(connID, conn)
log.Printf("TCP connection for %s accepted", connID)
wg := sync.WaitGroup{}
wg.Add(1)
// 启动数据转发
@ -209,7 +211,7 @@ func (m *ProxyManager) handleTCPConnection(entry *ProxyEntry, conn net.Conn) {
}
// 发送数据到客户端
err = controlConn.Send(&proto.Message{
err = c.Send(&proto.Message{
Content: &proto.Message_ProxyData{
ProxyData: &proto.ProxyData{
ConnId: connID,
@ -228,5 +230,23 @@ func (m *ProxyManager) handleTCPConnection(entry *ProxyEntry, conn net.Conn) {
}
func (m *ProxyManager) handleUDPPacket(entry *ProxyEntry, data []byte, addr *net.UDPAddr) {
// entry.UDPConn.WriteToUDP(data, addr)
c, ok := m.clientManager.Get(entry.ClientID)
if !ok {
log.Printf("Control connection not found for client %s", entry.ClientID)
return
}
err := c.Send(&proto.Message{
Content: &proto.Message_ProxyData{
ProxyData: &proto.ProxyData{
ConnId: addr.String(),
ProxyConfig: entry.Config,
Data: data,
},
},
})
if err != nil {
log.Printf("Failed to send proxy data: %v", err)
return
}
}

View File

@ -60,6 +60,7 @@ func (s *Server) Connect(stream pb.TunnelService_ConnectServer) error {
clientID := "client_" + fmt.Sprint(time.Now().UnixNano())
conn := NewClientConnection(stream)
// 添加客户端
s.clientManager.Add(clientID, conn)
defer s.clientManager.Remove(clientID)
@ -135,7 +136,39 @@ func (s *Server) handleProxyData(clientID string, msg *pb.Message_ProxyData) {
}
func (s *Server) handleUDPProxyData(clientID string, msg *pb.Message_ProxyData) {
proxyEntry, ok := s.proxyManager.proxies.Load(msg.ProxyData.ProxyConfig.Name)
if !ok {
log.Printf("Proxy %s not found", msg.ProxyData.ProxyConfig.Name)
return
}
entry := proxyEntry.(*ProxyEntry)
addr, ok := entry.UDPAddrs.Load(msg.ProxyData.ConnId)
if !ok {
log.Printf("UDP connection %s not found", msg.ProxyData.ConnId)
return
}
_, err := entry.UDPConn.WriteToUDP(msg.ProxyData.Data, addr.(*net.UDPAddr))
if err != nil {
log.Printf("Failed to write data to UDP connection: %v", err)
entry.UDPAddrs.Delete(msg.ProxyData.ConnId)
controlConn, ok := s.clientManager.Get(clientID)
if !ok {
log.Printf("Control connection not found for client %s", clientID)
return
}
if err := controlConn.Send(&pb.Message{
Content: &pb.Message_ProxyError{
ProxyError: &pb.ProxyError{
ProxyConfig: msg.ProxyData.ProxyConfig,
ConnId: msg.ProxyData.ConnId,
Error: "Failed to write data to UDP connection",
},
},
}); err != nil {
log.Printf("Failed to send message to client %s: %v", clientID, err)
return
}
}
}
func (s *Server) handleTCPProxyData(clientID string, msg *pb.Message_ProxyData) {
@ -145,45 +178,42 @@ func (s *Server) handleTCPProxyData(clientID string, msg *pb.Message_ProxyData)
return
}
entry := proxyEntry.(*ProxyEntry)
switch entry.Config.Type {
case pb.ProxyType_TCP:
conn, ok := entry.TCPConns.Load(msg.ProxyData.ConnId)
if !ok {
log.Printf("TCP connection %s not found", msg.ProxyData.ConnId)
controlConn, ok := s.clientManager.Get(clientID)
if ok {
if err := controlConn.Send(&pb.Message{
Content: &pb.Message_ProxyError{
ProxyError: &pb.ProxyError{
ProxyConfig: msg.ProxyData.ProxyConfig,
ConnId: msg.ProxyData.ConnId,
Error: "TCP connection not found",
},
conn, ok := entry.TCPConns.Load(msg.ProxyData.ConnId)
if !ok {
log.Printf("TCP connection %s not found", msg.ProxyData.ConnId)
controlConn, ok := s.clientManager.Get(clientID)
if ok {
if err := controlConn.Send(&pb.Message{
Content: &pb.Message_ProxyError{
ProxyError: &pb.ProxyError{
ProxyConfig: msg.ProxyData.ProxyConfig,
ConnId: msg.ProxyData.ConnId,
Error: "TCP connection not found",
},
}); err != nil {
log.Printf("Failed to send message to client %s: %v", clientID, err)
}
},
}); err != nil {
log.Printf("Failed to send message to client %s: %v", clientID, err)
}
return
}
_, err := conn.(net.Conn).Write(msg.ProxyData.Data)
if err != nil {
log.Printf("Failed to write data to TCP connection: %v", err)
conn.(net.Conn).Close()
entry.TCPConns.Delete(msg.ProxyData.ConnId)
controlConn, ok := s.clientManager.Get(clientID)
if ok {
if err := controlConn.Send(&pb.Message{
Content: &pb.Message_ProxyError{
ProxyError: &pb.ProxyError{
ProxyConfig: msg.ProxyData.ProxyConfig,
ConnId: msg.ProxyData.ConnId,
Error: "Failed to write data to TCP connection",
},
return
}
_, err := conn.(net.Conn).Write(msg.ProxyData.Data)
if err != nil {
log.Printf("Failed to write data to TCP connection: %v", err)
conn.(net.Conn).Close()
entry.TCPConns.Delete(msg.ProxyData.ConnId)
controlConn, ok := s.clientManager.Get(clientID)
if ok {
if err := controlConn.Send(&pb.Message{
Content: &pb.Message_ProxyError{
ProxyError: &pb.ProxyError{
ProxyConfig: msg.ProxyData.ProxyConfig,
ConnId: msg.ProxyData.ConnId,
Error: "Failed to write data to TCP connection",
},
}); err != nil {
log.Printf("Failed to send message to client %s: %v", clientID, err)
}
},
}); err != nil {
log.Printf("Failed to send message to client %s: %v", clientID, err)
}
}
}

View File

@ -230,7 +230,7 @@ func (x *ProxyConfigs) GetConfigs() map[string]*ProxyConfig {
type ProxyConfig struct {
state protoimpl.MessageState `protogen:"open.v1"`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Type ProxyType `protobuf:"varint,2,opt,name=type,proto3,enum=nwct.ProxyType" json:"type,omitempty"`
Type ProxyType `protobuf:"varint,2,opt,name=type,proto3,enum=net_tunnel.ProxyType" json:"type,omitempty"`
LocalIp string `protobuf:"bytes,3,opt,name=local_ip,json=localIp,proto3" json:"local_ip,omitempty"`
LocalPort int32 `protobuf:"varint,4,opt,name=local_port,json=localPort,proto3" json:"local_port,omitempty"`
RemotePort int32 `protobuf:"varint,5,opt,name=remote_port,json=remotePort,proto3" json:"remote_port,omitempty"`
@ -480,72 +480,77 @@ var File_pkg_proto_tunnel_proto protoreflect.FileDescriptor
var file_pkg_proto_tunnel_proto_rawDesc = string([]byte{
0x0a, 0x16, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x75, 0x6e, 0x6e,
0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x6e, 0x77, 0x63, 0x74, 0x22, 0x90,
0x02, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x72, 0x65,
0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6e, 0x77, 0x63, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x78,
0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x48, 0x00, 0x52, 0x0f, 0x72, 0x65, 0x67, 0x69,
0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x30, 0x0a, 0x0a, 0x70,
0x72, 0x6f, 0x78, 0x79, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x0f, 0x2e, 0x6e, 0x77, 0x63, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x44, 0x61, 0x74, 0x61,
0x48, 0x00, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x52, 0x0a,
0x16, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x70, 0x72, 0x6f, 0x78, 0x69, 0x65,
0x73, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
0x6e, 0x77, 0x63, 0x74, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x72, 0x6f,
0x78, 0x69, 0x65, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x48, 0x00, 0x52, 0x14, 0x72, 0x65, 0x67,
0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6e, 0x65, 0x74, 0x5f, 0x74, 0x75,
0x6e, 0x6e, 0x65, 0x6c, 0x22, 0xa8, 0x02, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x12, 0x45, 0x0a, 0x10, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e,
0x66, 0x69, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x74,
0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e,
0x66, 0x69, 0x67, 0x73, 0x48, 0x00, 0x52, 0x0f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72,
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x36, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x78, 0x79,
0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6e, 0x65,
0x74, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x44, 0x61,
0x74, 0x61, 0x48, 0x00, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12,
0x58, 0x0a, 0x16, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x70, 0x72, 0x6f, 0x78,
0x69, 0x65, 0x73, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x20, 0x2e, 0x6e, 0x65, 0x74, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x52, 0x65, 0x67,
0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x78, 0x69, 0x65, 0x73, 0x45, 0x72, 0x72, 0x6f,
0x72, 0x12, 0x33, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72,
0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6e, 0x77, 0x63, 0x74, 0x2e, 0x50, 0x72,
0x6f, 0x78, 0x79, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x48, 0x00, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x78,
0x79, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
0x74, 0x22, 0x98, 0x01, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69,
0x67, 0x73, 0x12, 0x39, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x01, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6e, 0x77, 0x63, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79,
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x45,
0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x1a, 0x4d, 0x0a,
0x0c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
0x27, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11,
0x2e, 0x6e, 0x77, 0x63, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69,
0x67, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xa1, 0x01, 0x0a,
0x0b, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x12, 0x23, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f,
0x2e, 0x6e, 0x77, 0x63, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52,
0x72, 0x48, 0x00, 0x52, 0x14, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x72, 0x6f,
0x78, 0x69, 0x65, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x39, 0x0a, 0x0b, 0x70, 0x72, 0x6f,
0x78, 0x79, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16,
0x2e, 0x6e, 0x65, 0x74, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x78,
0x79, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x48, 0x00, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x45,
0x72, 0x72, 0x6f, 0x72, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22,
0xa4, 0x01, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73,
0x12, 0x3f, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x74, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x50,
0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x66,
0x69, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,
0x73, 0x1a, 0x53, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72,
0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
0x6b, 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x74, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e,
0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xa7, 0x01, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x78, 0x79,
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x04, 0x74, 0x79,
0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x74, 0x5f, 0x74,
0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52,
0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x69,
0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x70,
0x12, 0x1d, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04,
0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x50, 0x6f, 0x72, 0x74, 0x12,
0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x05,
0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x50, 0x6f, 0x72, 0x74,
0x22, 0x6e, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x17, 0x0a,
0x22, 0x74, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x17, 0x0a,
0x07, 0x63, 0x6f, 0x6e, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
0x63, 0x6f, 0x6e, 0x6e, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f,
0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6e,
0x77, 0x63, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52,
0x0b, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04,
0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
0x22, 0x62, 0x0a, 0x14, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x78,
0x69, 0x65, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x34, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x78,
0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11,
0x2e, 0x6e, 0x77, 0x63, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69,
0x67, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x14,
0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65,
0x72, 0x72, 0x6f, 0x72, 0x22, 0x71, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x45, 0x72, 0x72,
0x6f, 0x72, 0x12, 0x34, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x66,
0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6e, 0x77, 0x63, 0x74, 0x2e,
0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0b, 0x70, 0x72, 0x6f,
0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x6e,
0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x6e, 0x49,
0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2a, 0x1d, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x78, 0x79,
0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x43, 0x50, 0x10, 0x00, 0x12, 0x07, 0x0a,
0x03, 0x55, 0x44, 0x50, 0x10, 0x01, 0x32, 0x3c, 0x0a, 0x0d, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2b, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65,
0x63, 0x74, 0x12, 0x0d, 0x2e, 0x6e, 0x77, 0x63, 0x74, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x1a, 0x0d, 0x2e, 0x6e, 0x77, 0x63, 0x74, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x28, 0x01, 0x30, 0x01, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x63, 0x6f, 0x6e, 0x6e, 0x49, 0x64, 0x12, 0x3a, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f,
0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e,
0x65, 0x74, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43,
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66,
0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c,
0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x68, 0x0a, 0x14, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74,
0x65, 0x72, 0x50, 0x72, 0x6f, 0x78, 0x69, 0x65, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x3a,
0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x74, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65,
0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0b, 0x70,
0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72,
0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72,
0x22, 0x77, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x3a,
0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x74, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65,
0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0b, 0x70,
0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x6f,
0x6e, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6e,
0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2a, 0x1d, 0x0a, 0x09, 0x50, 0x72, 0x6f,
0x78, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x43, 0x50, 0x10, 0x00, 0x12,
0x07, 0x0a, 0x03, 0x55, 0x44, 0x50, 0x10, 0x01, 0x32, 0x48, 0x0a, 0x0d, 0x54, 0x75, 0x6e, 0x6e,
0x65, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x43, 0x6f, 0x6e,
0x6e, 0x65, 0x63, 0x74, 0x12, 0x13, 0x2e, 0x6e, 0x65, 0x74, 0x5f, 0x74, 0x75, 0x6e, 0x6e, 0x65,
0x6c, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x13, 0x2e, 0x6e, 0x65, 0x74, 0x5f,
0x74, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x28, 0x01,
0x30, 0x01, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
})
var (
@ -563,28 +568,28 @@ func file_pkg_proto_tunnel_proto_rawDescGZIP() []byte {
var file_pkg_proto_tunnel_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_pkg_proto_tunnel_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_pkg_proto_tunnel_proto_goTypes = []any{
(ProxyType)(0), // 0: nwct.ProxyType
(*Message)(nil), // 1: nwct.Message
(*ProxyConfigs)(nil), // 2: nwct.ProxyConfigs
(*ProxyConfig)(nil), // 3: nwct.ProxyConfig
(*ProxyData)(nil), // 4: nwct.ProxyData
(*RegisterProxiesError)(nil), // 5: nwct.RegisterProxiesError
(*ProxyError)(nil), // 6: nwct.ProxyError
nil, // 7: nwct.ProxyConfigs.ConfigsEntry
(ProxyType)(0), // 0: net_tunnel.ProxyType
(*Message)(nil), // 1: net_tunnel.Message
(*ProxyConfigs)(nil), // 2: net_tunnel.ProxyConfigs
(*ProxyConfig)(nil), // 3: net_tunnel.ProxyConfig
(*ProxyData)(nil), // 4: net_tunnel.ProxyData
(*RegisterProxiesError)(nil), // 5: net_tunnel.RegisterProxiesError
(*ProxyError)(nil), // 6: net_tunnel.ProxyError
nil, // 7: net_tunnel.ProxyConfigs.ConfigsEntry
}
var file_pkg_proto_tunnel_proto_depIdxs = []int32{
2, // 0: nwct.Message.register_configs:type_name -> nwct.ProxyConfigs
4, // 1: nwct.Message.proxy_data:type_name -> nwct.ProxyData
5, // 2: nwct.Message.register_proxies_error:type_name -> nwct.RegisterProxiesError
6, // 3: nwct.Message.proxy_error:type_name -> nwct.ProxyError
7, // 4: nwct.ProxyConfigs.configs:type_name -> nwct.ProxyConfigs.ConfigsEntry
0, // 5: nwct.ProxyConfig.type:type_name -> nwct.ProxyType
3, // 6: nwct.ProxyData.proxy_config:type_name -> nwct.ProxyConfig
3, // 7: nwct.RegisterProxiesError.proxy_config:type_name -> nwct.ProxyConfig
3, // 8: nwct.ProxyError.proxy_config:type_name -> nwct.ProxyConfig
3, // 9: nwct.ProxyConfigs.ConfigsEntry.value:type_name -> nwct.ProxyConfig
1, // 10: nwct.TunnelService.Connect:input_type -> nwct.Message
1, // 11: nwct.TunnelService.Connect:output_type -> nwct.Message
2, // 0: net_tunnel.Message.register_configs:type_name -> net_tunnel.ProxyConfigs
4, // 1: net_tunnel.Message.proxy_data:type_name -> net_tunnel.ProxyData
5, // 2: net_tunnel.Message.register_proxies_error:type_name -> net_tunnel.RegisterProxiesError
6, // 3: net_tunnel.Message.proxy_error:type_name -> net_tunnel.ProxyError
7, // 4: net_tunnel.ProxyConfigs.configs:type_name -> net_tunnel.ProxyConfigs.ConfigsEntry
0, // 5: net_tunnel.ProxyConfig.type:type_name -> net_tunnel.ProxyType
3, // 6: net_tunnel.ProxyData.proxy_config:type_name -> net_tunnel.ProxyConfig
3, // 7: net_tunnel.RegisterProxiesError.proxy_config:type_name -> net_tunnel.ProxyConfig
3, // 8: net_tunnel.ProxyError.proxy_config:type_name -> net_tunnel.ProxyConfig
3, // 9: net_tunnel.ProxyConfigs.ConfigsEntry.value:type_name -> net_tunnel.ProxyConfig
1, // 10: net_tunnel.TunnelService.Connect:input_type -> net_tunnel.Message
1, // 11: net_tunnel.TunnelService.Connect:output_type -> net_tunnel.Message
11, // [11:12] is the sub-list for method output_type
10, // [10:11] is the sub-list for method input_type
10, // [10:10] is the sub-list for extension type_name

View File

@ -1,6 +1,6 @@
syntax = "proto3";
package nwct;
package net_tunnel;
option go_package = "./pkg/proto";

View File

@ -19,7 +19,7 @@ import (
const _ = grpc.SupportPackageIsVersion9
const (
TunnelService_Connect_FullMethodName = "/nwct.TunnelService/Connect"
TunnelService_Connect_FullMethodName = "/net_tunnel.TunnelService/Connect"
)
// TunnelServiceClient is the client API for TunnelService service.
@ -102,7 +102,7 @@ type TunnelService_ConnectServer = grpc.BidiStreamingServer[Message, Message]
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var TunnelService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "nwct.TunnelService",
ServiceName: "net_tunnel.TunnelService",
HandlerType: (*TunnelServiceServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{

15
test/udp_server.py Normal file
View File

@ -0,0 +1,15 @@
import socket
# 绑定 IP 和端口
UDP_IP = "0.0.0.0" # 监听所有网络接口
UDP_PORT = 9999
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((UDP_IP, UDP_PORT))
print(f"UDP 服务器已启动,监听端口 {UDP_PORT}...")
while True:
data, addr = sock.recvfrom(1024) # buffer size 1024 bytes
print(f"Received message from {addr}: {data.decode()}")
sock.sendto(b"Message received", addr) # send response