syntax = "proto3"; package net_tunnel; option go_package = "./pkg/proto"; service TunnelService { // 建立控制连接 rpc Connect(stream Message) returns (stream Message); } // 通用消息格式 message Message { oneof content { ProxyConfigs register_configs = 1; ProxyData proxy_data = 2; RegisterProxiesError register_proxies_error = 3; ProxyError proxy_error = 4; } } // 代理配置 message ProxyConfigs { map configs = 1; } message ProxyConfig { string name = 1; ProxyType type = 2; string local_ip = 3; int32 local_port = 4; int32 remote_port = 5; } enum ProxyType { TCP = 0; UDP = 1; } // 代理数据 message ProxyData { string conn_id = 1; ProxyConfig proxy_config = 2; bytes data = 3; } message RegisterProxiesError { ProxyConfig proxy_config = 1; string error = 2; } message ProxyError { ProxyConfig proxy_config = 1; string conn_id = 2; string error = 3; }