mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-02 17:15:43 +00:00
refactor(core): separate portable core from native runtime (#2451)
Create easytier-core as the portable owner of configuration, connectivity, tunnels, peer and routing state, gateways, management, the data plane, and instance lifecycle. Keep operating-system integration, native protocol engines, process startup, and presentation in easytier behind explicit Host capability adapters. Create easytier-proto to own schemas, generated RPC types, descriptors, and feature-scoped protocol slices. Remove runtime protobuf reflection from core while preserving unknown route-peer fields across forwarding. Normalize instance construction through CoreInstance, CoreHostAdapters, CoreProcessRuntime, and InstanceManager. Make the runtime config store the only authoritative mutable configuration after startup. Move the portable TCP/UDP data plane into core and extract a generic OperationBroker for completion, cancellation, disposal, and capacity accounting. Expose the session-based FFI v2 completion API and keep the WASI guest ABI, wire schemas, and adapters with core. Migrate CLI, GUI, web, FFI, Android JNI, OHOS, uptime, and mobile consumers to the shared manager and core state. Add explicit user/web config ownership and revision-aware web reconciliation. Preserve configuration, wire, and management behavior while fixing regressions discovered by the full platform and integration matrix: - inherit advertised relay capabilities in foreign networks; - refresh OSPF peer state immediately after runtime config changes; - restore CLI GlobalCtx event output without forcing GUI logging; - retain legacy encryption names and standalone RPC tunnel metadata; - restore ICMP host composition and fragmented UDP handling; - use portable 64-bit atomics on 32-bit MIPS targets; and - retain discarded operations until late cancellation completes. Validate the refactor across 45 GitHub checks, including Linux, macOS, Windows, FreeBSD, web, GUI, Android, OHOS, feature profiles, and three-node and subnet-proxy integration tests. BREAKING CHANGE: internal Rust module paths are not preserved. Legacy native data-plane APIs are replaced by the session-based FFI v2 API. The dedicated Android data-plane wrapper is removed.
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "common.proto";
|
||||
|
||||
package acl;
|
||||
|
||||
// Enhanced protocol enum with more granular options
|
||||
enum Protocol {
|
||||
Unspecified = 0;
|
||||
TCP = 1;
|
||||
UDP = 2;
|
||||
ICMP = 3;
|
||||
ICMPv6 = 4;
|
||||
Any = 5;
|
||||
}
|
||||
|
||||
enum Action {
|
||||
Noop = 0;
|
||||
Allow = 1;
|
||||
Drop = 2; // Silent drop (no response)
|
||||
}
|
||||
|
||||
enum ChainType {
|
||||
UnspecifiedChain = 0;
|
||||
// send to this node
|
||||
Inbound = 1;
|
||||
// send from this node
|
||||
Outbound = 2;
|
||||
// subnet proxy
|
||||
Forward = 3;
|
||||
}
|
||||
|
||||
// Time-based access control
|
||||
message TimeWindow {
|
||||
// Days of week: 0=Sunday, 1=Monday, ..., 6=Saturday
|
||||
repeated uint32 days_of_week = 1;
|
||||
// Time in minutes from midnight (0-1439)
|
||||
uint32 start_time = 2;
|
||||
uint32 end_time = 3;
|
||||
// Timezone offset in minutes from UTC
|
||||
int32 timezone_offset = 4;
|
||||
}
|
||||
|
||||
// Enhanced rule with priority and metadata
|
||||
message Rule {
|
||||
// Rule identification and metadata
|
||||
string name = 1; // Human-readable rule name
|
||||
string description = 2; // Rule description
|
||||
uint32 priority = 3; // Higher number = higher priority (0-65535)
|
||||
bool enabled = 4; // Rule enabled/disabled state
|
||||
|
||||
// Core matching criteria
|
||||
Protocol protocol = 5;
|
||||
repeated string ports = 6;
|
||||
repeated string source_ips = 7; // Source IP ranges
|
||||
repeated string destination_ips = 8; // Destination IP ranges
|
||||
|
||||
// Enhanced matching criteria
|
||||
repeated string source_ports = 9; // Source port range
|
||||
|
||||
// Action and logging
|
||||
Action action = 10;
|
||||
|
||||
// Rate limiting (packets per second)
|
||||
uint32 rate_limit = 11; // 0 = no limit
|
||||
uint32 burst_limit = 12; // Burst allowance
|
||||
|
||||
// Connection tracking
|
||||
bool stateful = 13; // Enable connection tracking
|
||||
|
||||
// Group matching criteria
|
||||
repeated string source_groups = 14;
|
||||
repeated string destination_groups = 15;
|
||||
}
|
||||
|
||||
// Rule chain with metadata and optimization hints
|
||||
message Chain {
|
||||
// Chain identification
|
||||
string name = 1; // Human-readable chain name
|
||||
ChainType chain_type = 2;
|
||||
string description = 3; // Chain description
|
||||
bool enabled = 4; // Chain enabled/disabled state
|
||||
|
||||
// Rules in priority order (highest priority first)
|
||||
repeated Rule rules = 5;
|
||||
|
||||
// Default action when no rules match
|
||||
Action default_action = 6;
|
||||
}
|
||||
|
||||
message GroupInfo {
|
||||
repeated GroupIdentity declares = 1;
|
||||
repeated string members = 2;
|
||||
}
|
||||
|
||||
message GroupIdentity {
|
||||
string group_name = 1;
|
||||
string group_secret = 2;
|
||||
}
|
||||
|
||||
message AclV1 {
|
||||
repeated Chain chains = 1;
|
||||
GroupInfo group = 2;
|
||||
}
|
||||
|
||||
enum ConnState {
|
||||
New = 0;
|
||||
Established = 1;
|
||||
Related = 2;
|
||||
Invalid = 3;
|
||||
}
|
||||
|
||||
// Connection tracking entry for stateful ACLs
|
||||
message ConnTrackEntry {
|
||||
common.SocketAddr src_addr = 1;
|
||||
common.SocketAddr dst_addr = 2;
|
||||
Protocol protocol = 3; // IP protocol number (e.g., 6 = TCP, 17 = UDP)
|
||||
ConnState state = 4;
|
||||
uint64 created_at = 5; // Unix timestamp (seconds)
|
||||
uint64 last_seen = 6; // Unix timestamp (seconds)
|
||||
uint64 packet_count = 7;
|
||||
uint64 byte_count = 8;
|
||||
}
|
||||
|
||||
// Top-level ACL configuration
|
||||
message Acl {
|
||||
AclV1 acl_v1 = 2;
|
||||
}
|
||||
|
||||
message StatItem {
|
||||
uint64 packet_count = 1;
|
||||
uint64 byte_count = 2;
|
||||
}
|
||||
|
||||
message RuleStats {
|
||||
Rule rule = 1;
|
||||
StatItem stat = 2;
|
||||
}
|
||||
|
||||
message AclStats {
|
||||
repeated RuleStats rules = 1;
|
||||
repeated ConnTrackEntry conn_track = 2;
|
||||
map<string, uint64> global = 3;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "common.proto";
|
||||
import "acl.proto";
|
||||
import "api_instance.proto";
|
||||
import "api_manage.proto";
|
||||
|
||||
package api.config;
|
||||
|
||||
enum ConfigPatchAction {
|
||||
ADD = 0;
|
||||
REMOVE = 1;
|
||||
CLEAR = 2;
|
||||
}
|
||||
|
||||
message InstanceConfigPatch {
|
||||
optional string hostname = 1;
|
||||
optional common.Ipv4Inet ipv4 = 2;
|
||||
optional common.Ipv6Inet ipv6 = 3;
|
||||
repeated PortForwardPatch port_forwards = 4;
|
||||
optional AclPatch acl = 5;
|
||||
repeated ProxyNetworkPatch proxy_networks = 6;
|
||||
repeated RoutePatch routes = 7;
|
||||
repeated ExitNodePatch exit_nodes = 8;
|
||||
repeated UrlPatch mapped_listeners = 9;
|
||||
repeated UrlPatch connectors = 10;
|
||||
optional bool ipv6_public_addr_provider = 11;
|
||||
optional bool ipv6_public_addr_auto = 12;
|
||||
optional string ipv6_public_addr_prefix = 13;
|
||||
optional bool disable_relay_data = 14;
|
||||
}
|
||||
|
||||
message PortForwardPatch {
|
||||
ConfigPatchAction action = 1;
|
||||
common.PortForwardConfigPb cfg = 2;
|
||||
}
|
||||
|
||||
message StringPatch {
|
||||
ConfigPatchAction action = 1;
|
||||
string value = 2;
|
||||
}
|
||||
|
||||
message UrlPatch {
|
||||
ConfigPatchAction action = 1;
|
||||
common.Url url = 2;
|
||||
}
|
||||
|
||||
message AclPatch {
|
||||
optional acl.Acl acl = 1;
|
||||
repeated StringPatch tcp_whitelist = 2;
|
||||
repeated StringPatch udp_whitelist = 3;
|
||||
}
|
||||
|
||||
message ProxyNetworkPatch {
|
||||
ConfigPatchAction action = 1;
|
||||
common.Ipv4Inet cidr = 2;
|
||||
optional common.Ipv4Inet mapped_cidr = 3;
|
||||
}
|
||||
|
||||
message RoutePatch {
|
||||
ConfigPatchAction action = 1;
|
||||
common.Ipv4Inet cidr = 2;
|
||||
}
|
||||
|
||||
message ExitNodePatch {
|
||||
ConfigPatchAction action = 1;
|
||||
common.IpAddr node = 2;
|
||||
}
|
||||
|
||||
message PatchConfigRequest {
|
||||
InstanceConfigPatch patch = 1;
|
||||
api.instance.InstanceIdentifier instance = 2;
|
||||
}
|
||||
|
||||
message PatchConfigResponse {}
|
||||
|
||||
message GetConfigRequest {
|
||||
api.instance.InstanceIdentifier instance = 1;
|
||||
}
|
||||
|
||||
message GetConfigResponse {
|
||||
api.manage.NetworkConfig config = 1;
|
||||
}
|
||||
|
||||
service ConfigRpc {
|
||||
rpc PatchConfig(PatchConfigRequest) returns (PatchConfigResponse);
|
||||
rpc GetConfig(GetConfigRequest) returns (GetConfigResponse);
|
||||
}
|
||||
@@ -0,0 +1,380 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "common.proto";
|
||||
import "peer_rpc.proto";
|
||||
import "acl.proto";
|
||||
|
||||
package api.instance;
|
||||
|
||||
message InstanceIdentifier {
|
||||
message InstanceSelector { optional string name = 1; }
|
||||
|
||||
oneof selector {
|
||||
common.UUID id = 1;
|
||||
InstanceSelector instance_selector = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message Status {
|
||||
int32 code = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
message PeerConnStats {
|
||||
uint64 rx_bytes = 1;
|
||||
uint64 tx_bytes = 2;
|
||||
|
||||
uint64 rx_packets = 3;
|
||||
uint64 tx_packets = 4;
|
||||
|
||||
uint64 latency_us = 5;
|
||||
}
|
||||
|
||||
message PeerConnInfo {
|
||||
string conn_id = 1;
|
||||
uint32 my_peer_id = 2;
|
||||
uint32 peer_id = 3;
|
||||
repeated string features = 4;
|
||||
common.TunnelInfo tunnel = 5;
|
||||
PeerConnStats stats = 6;
|
||||
float loss_rate = 7;
|
||||
bool is_client = 8;
|
||||
string network_name = 9;
|
||||
bool is_closed = 10;
|
||||
bytes noise_local_static_pubkey = 11;
|
||||
bytes noise_remote_static_pubkey = 12;
|
||||
peer_rpc.SecureAuthLevel secure_auth_level = 13;
|
||||
peer_rpc.PeerIdentityType peer_identity_type = 14;
|
||||
}
|
||||
|
||||
message PeerInfo {
|
||||
uint32 peer_id = 1;
|
||||
repeated PeerConnInfo conns = 2;
|
||||
common.UUID default_conn_id = 3;
|
||||
repeated common.UUID directly_connected_conns = 4;
|
||||
}
|
||||
|
||||
message ListPeerRequest { InstanceIdentifier instance = 1; }
|
||||
|
||||
message ListPeerResponse {
|
||||
repeated PeerInfo peer_infos = 1;
|
||||
NodeInfo my_info = 2;
|
||||
}
|
||||
|
||||
message Route {
|
||||
uint32 peer_id = 1;
|
||||
common.Ipv4Inet ipv4_addr = 2;
|
||||
|
||||
uint32 next_hop_peer_id = 3;
|
||||
int32 cost = 4;
|
||||
int32 path_latency = 11;
|
||||
|
||||
repeated string proxy_cidrs = 5;
|
||||
string hostname = 6;
|
||||
common.StunInfo stun_info = 7;
|
||||
string inst_id = 8;
|
||||
string version = 9;
|
||||
common.PeerFeatureFlag feature_flag = 10;
|
||||
|
||||
optional uint32 next_hop_peer_id_latency_first = 12;
|
||||
optional int32 cost_latency_first = 13;
|
||||
optional int32 path_latency_latency_first = 14;
|
||||
|
||||
common.Ipv6Inet ipv6_addr = 15;
|
||||
common.Ipv6Inet public_ipv6_addr = 16;
|
||||
common.Ipv6Inet ipv6_public_addr_prefix = 17;
|
||||
}
|
||||
|
||||
message PeerRoutePair {
|
||||
Route route = 1;
|
||||
PeerInfo peer = 2;
|
||||
}
|
||||
|
||||
message NodeInfo {
|
||||
uint32 peer_id = 1;
|
||||
string ipv4_addr = 2;
|
||||
repeated string proxy_cidrs = 3;
|
||||
string hostname = 4;
|
||||
common.StunInfo stun_info = 5;
|
||||
string inst_id = 6;
|
||||
repeated string listeners = 7;
|
||||
string config = 8;
|
||||
string version = 9;
|
||||
common.PeerFeatureFlag feature_flag = 10;
|
||||
peer_rpc.GetIpListResponse ip_list = 11;
|
||||
common.Ipv6Inet public_ipv6_addr = 12;
|
||||
common.Ipv6Inet ipv6_public_addr_prefix = 13;
|
||||
}
|
||||
|
||||
message ShowNodeInfoRequest { InstanceIdentifier instance = 1; }
|
||||
|
||||
message ShowNodeInfoResponse { NodeInfo node_info = 1; }
|
||||
|
||||
message PublicIpv6LeaseInfo {
|
||||
uint32 peer_id = 1;
|
||||
string inst_id = 2;
|
||||
common.Ipv6Inet leased_addr = 3;
|
||||
int64 valid_until_unix_seconds = 4;
|
||||
bool reused = 5;
|
||||
}
|
||||
|
||||
message ListPublicIpv6InfoRequest { InstanceIdentifier instance = 1; }
|
||||
|
||||
message ListPublicIpv6InfoResponse {
|
||||
common.Ipv6Inet provider_prefix = 1;
|
||||
repeated PublicIpv6LeaseInfo provider_leases = 2;
|
||||
}
|
||||
|
||||
message ListRouteRequest { InstanceIdentifier instance = 1; }
|
||||
|
||||
message ListRouteResponse { repeated Route routes = 1; }
|
||||
|
||||
message DumpRouteRequest { InstanceIdentifier instance = 1; }
|
||||
|
||||
message DumpRouteResponse { string result = 1; }
|
||||
|
||||
message ListForeignNetworkRequest {
|
||||
InstanceIdentifier instance = 1;
|
||||
bool include_trusted_keys = 2;
|
||||
}
|
||||
|
||||
enum TrustedKeySourcePb {
|
||||
TRUSTED_KEY_SOURCE_PB_UNSPECIFIED = 0;
|
||||
TRUSTED_KEY_SOURCE_PB_OSPF_NODE = 1;
|
||||
TRUSTED_KEY_SOURCE_PB_OSPF_CREDENTIAL = 2;
|
||||
}
|
||||
|
||||
message TrustedKeyInfoPb {
|
||||
bytes pubkey = 1;
|
||||
TrustedKeySourcePb source = 2;
|
||||
optional int64 expiry_unix = 3;
|
||||
}
|
||||
|
||||
message ForeignNetworkEntryPb {
|
||||
repeated PeerInfo peers = 1;
|
||||
bytes network_secret_digest = 2;
|
||||
uint32 my_peer_id_for_this_network = 3;
|
||||
repeated TrustedKeyInfoPb trusted_keys = 4;
|
||||
}
|
||||
|
||||
message ListForeignNetworkResponse {
|
||||
// foreign network in local
|
||||
map<string, ForeignNetworkEntryPb> foreign_networks = 1;
|
||||
}
|
||||
|
||||
message ListGlobalForeignNetworkRequest { InstanceIdentifier instance = 1; }
|
||||
|
||||
message ListGlobalForeignNetworkResponse {
|
||||
// foreign network in the entire network
|
||||
message OneForeignNetwork {
|
||||
string network_name = 1;
|
||||
repeated uint32 peer_ids = 2;
|
||||
string last_updated = 3;
|
||||
uint32 version = 4;
|
||||
}
|
||||
|
||||
message ForeignNetworks { repeated OneForeignNetwork foreign_networks = 1; }
|
||||
|
||||
map<uint32, ForeignNetworks> foreign_networks = 1;
|
||||
}
|
||||
|
||||
message GetForeignNetworkSummaryRequest { InstanceIdentifier instance = 1; }
|
||||
|
||||
message GetForeignNetworkSummaryResponse {
|
||||
peer_rpc.RouteForeignNetworkSummary summary = 1;
|
||||
}
|
||||
|
||||
service PeerManageRpc {
|
||||
rpc ListPeer(ListPeerRequest) returns (ListPeerResponse);
|
||||
rpc ListPublicIpv6Info(ListPublicIpv6InfoRequest)
|
||||
returns (ListPublicIpv6InfoResponse);
|
||||
rpc ListRoute(ListRouteRequest) returns (ListRouteResponse);
|
||||
rpc DumpRoute(DumpRouteRequest) returns (DumpRouteResponse);
|
||||
rpc ListForeignNetwork(ListForeignNetworkRequest)
|
||||
returns (ListForeignNetworkResponse);
|
||||
rpc ListGlobalForeignNetwork(ListGlobalForeignNetworkRequest)
|
||||
returns (ListGlobalForeignNetworkResponse);
|
||||
rpc ShowNodeInfo(ShowNodeInfoRequest) returns (ShowNodeInfoResponse);
|
||||
rpc GetForeignNetworkSummary(GetForeignNetworkSummaryRequest)
|
||||
returns (GetForeignNetworkSummaryResponse);
|
||||
}
|
||||
|
||||
enum ConnectorStatus {
|
||||
CONNECTED = 0;
|
||||
DISCONNECTED = 1;
|
||||
CONNECTING = 2;
|
||||
}
|
||||
|
||||
message Connector {
|
||||
common.Url url = 1;
|
||||
ConnectorStatus status = 2;
|
||||
}
|
||||
|
||||
message ListConnectorRequest { InstanceIdentifier instance = 1; }
|
||||
|
||||
message ListConnectorResponse { repeated Connector connectors = 1; }
|
||||
|
||||
service ConnectorManageRpc {
|
||||
rpc ListConnector(ListConnectorRequest) returns (ListConnectorResponse);
|
||||
}
|
||||
|
||||
message MappedListener { common.Url url = 1; }
|
||||
|
||||
message ListMappedListenerRequest { InstanceIdentifier instance = 1; }
|
||||
|
||||
message ListMappedListenerResponse {
|
||||
repeated MappedListener mappedlisteners = 1;
|
||||
}
|
||||
|
||||
service MappedListenerManageRpc {
|
||||
rpc ListMappedListener(ListMappedListenerRequest)
|
||||
returns (ListMappedListenerResponse);
|
||||
}
|
||||
|
||||
message VpnPortalInfo {
|
||||
string vpn_type = 1;
|
||||
string client_config = 2;
|
||||
repeated string connected_clients = 3;
|
||||
}
|
||||
|
||||
message GetVpnPortalInfoRequest { InstanceIdentifier instance = 1; }
|
||||
message GetVpnPortalInfoResponse { VpnPortalInfo vpn_portal_info = 1; }
|
||||
|
||||
service VpnPortalRpc {
|
||||
rpc GetVpnPortalInfo(GetVpnPortalInfoRequest)
|
||||
returns (GetVpnPortalInfoResponse);
|
||||
}
|
||||
|
||||
enum TcpProxyEntryTransportType {
|
||||
TCP = 0;
|
||||
KCP = 1;
|
||||
QUIC = 2;
|
||||
}
|
||||
|
||||
enum TcpProxyEntryState {
|
||||
Unknown = 0;
|
||||
// receive syn packet but not start connecting to dst
|
||||
SynReceived = 1;
|
||||
// connecting to dst
|
||||
ConnectingDst = 2;
|
||||
// connected to dst
|
||||
Connected = 3;
|
||||
// connection closed
|
||||
Closed = 4;
|
||||
// closing src
|
||||
ClosingSrc = 5;
|
||||
// closing dst
|
||||
ClosingDst = 6;
|
||||
}
|
||||
|
||||
message TcpProxyEntry {
|
||||
common.SocketAddr src = 1;
|
||||
common.SocketAddr dst = 2;
|
||||
uint64 start_time = 3;
|
||||
TcpProxyEntryState state = 4;
|
||||
TcpProxyEntryTransportType transport_type = 5;
|
||||
}
|
||||
|
||||
message ListTcpProxyEntryRequest { InstanceIdentifier instance = 1; }
|
||||
|
||||
message ListTcpProxyEntryResponse { repeated TcpProxyEntry entries = 1; }
|
||||
|
||||
service TcpProxyRpc {
|
||||
rpc ListTcpProxyEntry(ListTcpProxyEntryRequest)
|
||||
returns (ListTcpProxyEntryResponse);
|
||||
}
|
||||
|
||||
message GetAclStatsRequest { InstanceIdentifier instance = 1; }
|
||||
|
||||
message GetAclStatsResponse { acl.AclStats acl_stats = 1; }
|
||||
|
||||
service AclManageRpc {
|
||||
rpc GetAclStats(GetAclStatsRequest) returns (GetAclStatsResponse);
|
||||
rpc GetWhitelist(GetWhitelistRequest) returns (GetWhitelistResponse);
|
||||
}
|
||||
|
||||
message GetWhitelistRequest { InstanceIdentifier instance = 1; }
|
||||
|
||||
message GetWhitelistResponse {
|
||||
repeated string tcp_ports = 1;
|
||||
repeated string udp_ports = 2;
|
||||
}
|
||||
|
||||
message ListPortForwardRequest { InstanceIdentifier instance = 1; }
|
||||
|
||||
message ListPortForwardResponse {
|
||||
repeated common.PortForwardConfigPb cfgs = 1;
|
||||
}
|
||||
|
||||
service PortForwardManageRpc {
|
||||
rpc ListPortForward(ListPortForwardRequest) returns (ListPortForwardResponse);
|
||||
}
|
||||
|
||||
message MetricSnapshot {
|
||||
string name = 1;
|
||||
uint64 value = 2;
|
||||
map<string, string> labels = 3;
|
||||
}
|
||||
|
||||
message GetStatsRequest { InstanceIdentifier instance = 1; }
|
||||
|
||||
message GetStatsResponse { repeated MetricSnapshot metrics = 1; }
|
||||
|
||||
message GetPrometheusStatsRequest { InstanceIdentifier instance = 1; }
|
||||
|
||||
message GetPrometheusStatsResponse { string prometheus_text = 1; }
|
||||
|
||||
service StatsRpc {
|
||||
rpc GetStats(GetStatsRequest) returns (GetStatsResponse);
|
||||
rpc GetPrometheusStats(GetPrometheusStatsRequest)
|
||||
returns (GetPrometheusStatsResponse);
|
||||
}
|
||||
|
||||
// Credential management messages
|
||||
|
||||
message GenerateCredentialRequest {
|
||||
repeated string groups = 1; // optional: ACL groups for this credential
|
||||
bool allow_relay = 2; // optional: allow relay through credential node
|
||||
repeated string allowed_proxy_cidrs = 3; // optional: restrict proxy_cidrs
|
||||
int64 ttl_seconds = 4; // must be > 0: credential TTL in seconds (0 / omitted is invalid)
|
||||
optional string credential_id = 5; // optional: user-specified credential id, reused if already exists
|
||||
InstanceIdentifier instance = 6; // target network instance
|
||||
optional bool reusable = 7; // default true: allow multiple peers to reuse this credential
|
||||
}
|
||||
|
||||
message GenerateCredentialResponse {
|
||||
string credential_id = 1; // UUID
|
||||
string credential_secret = 2; // private key base64
|
||||
}
|
||||
|
||||
message RevokeCredentialRequest {
|
||||
string credential_id = 1;
|
||||
InstanceIdentifier instance = 2; // target network instance
|
||||
}
|
||||
|
||||
message RevokeCredentialResponse {
|
||||
bool success = 1;
|
||||
}
|
||||
|
||||
message ListCredentialsRequest {
|
||||
InstanceIdentifier instance = 1; // target network instance
|
||||
}
|
||||
|
||||
message CredentialInfo {
|
||||
string credential_id = 1; // UUID
|
||||
repeated string groups = 2;
|
||||
bool allow_relay = 3;
|
||||
int64 expiry_unix = 4;
|
||||
repeated string allowed_proxy_cidrs = 5;
|
||||
optional bool reusable = 6;
|
||||
}
|
||||
|
||||
message ListCredentialsResponse {
|
||||
repeated CredentialInfo credentials = 1;
|
||||
}
|
||||
|
||||
service CredentialManageRpc {
|
||||
rpc GenerateCredential(GenerateCredentialRequest) returns (GenerateCredentialResponse);
|
||||
rpc RevokeCredential(RevokeCredentialRequest) returns (RevokeCredentialResponse);
|
||||
rpc ListCredentials(ListCredentialsRequest) returns (ListCredentialsResponse);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package api.logger;
|
||||
|
||||
enum LogLevel {
|
||||
DISABLED = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
INFO = 3;
|
||||
DEBUG = 4;
|
||||
TRACE = 5;
|
||||
}
|
||||
|
||||
message SetLoggerConfigRequest { LogLevel level = 1; }
|
||||
|
||||
message SetLoggerConfigResponse {}
|
||||
|
||||
message GetLoggerConfigRequest {}
|
||||
|
||||
message GetLoggerConfigResponse { LogLevel level = 1; }
|
||||
service LoggerRpc {
|
||||
rpc SetLoggerConfig(SetLoggerConfigRequest) returns (SetLoggerConfigResponse);
|
||||
rpc GetLoggerConfig(GetLoggerConfigRequest) returns (GetLoggerConfigResponse);
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "common.proto";
|
||||
import "peer_rpc.proto";
|
||||
import "api_instance.proto";
|
||||
import "acl.proto";
|
||||
|
||||
package api.manage;
|
||||
|
||||
enum NetworkingMethod {
|
||||
PublicServer = 0;
|
||||
Manual = 1;
|
||||
Standalone = 2;
|
||||
}
|
||||
|
||||
enum ConfigSource {
|
||||
ConfigSourceUnspecified = 0;
|
||||
ConfigSourceUser = 1;
|
||||
ConfigSourceWeb = 2;
|
||||
}
|
||||
|
||||
message NetworkConfig {
|
||||
optional string instance_id = 1;
|
||||
|
||||
optional bool dhcp = 2;
|
||||
optional string virtual_ipv4 = 3;
|
||||
optional int32 network_length = 4;
|
||||
optional string hostname = 5;
|
||||
optional string network_name = 6;
|
||||
optional string network_secret = 7;
|
||||
optional NetworkingMethod networking_method = 8;
|
||||
|
||||
optional string public_server_url = 9;
|
||||
repeated string peer_urls = 10;
|
||||
|
||||
repeated string proxy_cidrs = 11;
|
||||
|
||||
optional bool enable_vpn_portal = 12;
|
||||
optional int32 vpn_portal_listen_port = 13;
|
||||
optional string vpn_portal_client_network_addr = 14;
|
||||
optional int32 vpn_portal_client_network_len = 15;
|
||||
|
||||
optional bool advanced_settings = 16;
|
||||
|
||||
repeated string listener_urls = 17;
|
||||
// optional int32 rpc_port = 18;
|
||||
optional bool latency_first = 19;
|
||||
|
||||
optional string dev_name = 20;
|
||||
|
||||
optional bool use_smoltcp = 21;
|
||||
optional bool disable_ipv6 = 47;
|
||||
optional bool enable_kcp_proxy = 22;
|
||||
optional bool disable_kcp_input = 23;
|
||||
optional bool disable_p2p = 24;
|
||||
optional bool bind_device = 25;
|
||||
optional bool no_tun = 26;
|
||||
|
||||
optional bool enable_exit_node = 27;
|
||||
optional bool relay_all_peer_rpc = 28;
|
||||
optional bool multi_thread = 29;
|
||||
optional bool enable_relay_network_whitelist = 30;
|
||||
repeated string relay_network_whitelist = 31;
|
||||
optional bool enable_manual_routes = 32;
|
||||
repeated string routes = 33;
|
||||
repeated string exit_nodes = 34;
|
||||
optional bool proxy_forward_by_system = 35;
|
||||
optional bool disable_encryption = 36;
|
||||
optional bool enable_socks5 = 37;
|
||||
optional int32 socks5_port = 38;
|
||||
optional bool disable_udp_hole_punching = 39;
|
||||
optional int32 mtu = 40;
|
||||
repeated string mapped_listeners = 41;
|
||||
|
||||
optional bool enable_magic_dns = 42;
|
||||
optional bool enable_private_mode = 43;
|
||||
|
||||
// repeated string rpc_portal_whitelists = 44;
|
||||
|
||||
optional bool enable_quic_proxy = 45;
|
||||
optional bool disable_quic_input = 46;
|
||||
optional int32 quic_listen_port = 50 [deprecated = true];
|
||||
repeated PortForwardConfig port_forwards = 48;
|
||||
|
||||
optional bool disable_sym_hole_punching = 49;
|
||||
|
||||
optional bool p2p_only = 51;
|
||||
optional common.CompressionAlgoPb data_compress_algo = 52;
|
||||
optional string encryption_algorithm = 53;
|
||||
optional bool disable_tcp_hole_punching = 54;
|
||||
|
||||
common.SecureModeConfig secure_mode = 55;
|
||||
optional acl.Acl acl = 56;
|
||||
optional string credential_file = 57;
|
||||
optional bool lazy_p2p = 58;
|
||||
optional bool need_p2p = 59;
|
||||
optional uint64 instance_recv_bps_limit = 60;
|
||||
optional bool disable_upnp = 61;
|
||||
optional bool ipv6_public_addr_provider = 62;
|
||||
optional bool ipv6_public_addr_auto = 63;
|
||||
optional string ipv6_public_addr_prefix = 64;
|
||||
optional bool disable_relay_data = 65;
|
||||
optional bool enable_udp_broadcast_relay = 66;
|
||||
optional uint32 socket_mark = 67;
|
||||
repeated NetworkPeerConfig peers = 68;
|
||||
}
|
||||
|
||||
message NetworkPeerConfig {
|
||||
string uri = 1;
|
||||
optional string peer_public_key = 2;
|
||||
}
|
||||
|
||||
message PortForwardConfig {
|
||||
string bind_ip = 1;
|
||||
uint32 bind_port = 2;
|
||||
string dst_ip = 3;
|
||||
uint32 dst_port = 4;
|
||||
string proto = 5;
|
||||
}
|
||||
|
||||
message MyNodeInfo {
|
||||
common.Ipv4Inet virtual_ipv4 = 1;
|
||||
string hostname = 2;
|
||||
string version = 3;
|
||||
peer_rpc.GetIpListResponse ips = 4;
|
||||
common.StunInfo stun_info = 5;
|
||||
repeated common.Url listeners = 6;
|
||||
optional string vpn_portal_cfg = 7;
|
||||
uint32 peer_id = 8;
|
||||
}
|
||||
|
||||
message NetworkInstanceRunningInfo {
|
||||
string dev_name = 1;
|
||||
MyNodeInfo my_node_info = 2;
|
||||
repeated string events = 3;
|
||||
repeated api.instance.Route routes = 4;
|
||||
repeated api.instance.PeerInfo peers = 5;
|
||||
repeated api.instance.PeerRoutePair peer_route_pairs = 6;
|
||||
bool running = 7;
|
||||
optional string error_msg = 8;
|
||||
peer_rpc.RouteForeignNetworkSummary foreign_network_summary = 9;
|
||||
}
|
||||
|
||||
message NetworkInstanceRunningInfoMap {
|
||||
map<string, NetworkInstanceRunningInfo> map = 1;
|
||||
}
|
||||
|
||||
message NetworkMeta {
|
||||
common.UUID inst_id = 1;
|
||||
string network_name = 2;
|
||||
uint32 config_permission = 3;
|
||||
string instance_name = 4;
|
||||
ConfigSource source = 5;
|
||||
}
|
||||
|
||||
message ValidateConfigRequest { NetworkConfig config = 1; }
|
||||
|
||||
message ValidateConfigResponse { string toml_config = 1; }
|
||||
|
||||
message RunNetworkInstanceRequest {
|
||||
common.UUID inst_id = 1;
|
||||
NetworkConfig config = 2;
|
||||
bool overwrite = 3;
|
||||
ConfigSource source = 4;
|
||||
}
|
||||
|
||||
message RunNetworkInstanceResponse { common.UUID inst_id = 1; }
|
||||
|
||||
message RetainNetworkInstanceRequest { repeated common.UUID inst_ids = 1; }
|
||||
|
||||
message RetainNetworkInstanceResponse {
|
||||
repeated common.UUID remain_inst_ids = 1;
|
||||
}
|
||||
|
||||
message CollectNetworkInfoRequest { repeated common.UUID inst_ids = 1; }
|
||||
|
||||
message CollectNetworkInfoResponse { NetworkInstanceRunningInfoMap info = 1; }
|
||||
|
||||
message ListNetworkInstanceRequest {}
|
||||
|
||||
message ListNetworkInstanceResponse { repeated common.UUID inst_ids = 1; }
|
||||
|
||||
message DeleteNetworkInstanceRequest { repeated common.UUID inst_ids = 1; }
|
||||
|
||||
message DeleteNetworkInstanceResponse {
|
||||
repeated common.UUID remain_inst_ids = 1;
|
||||
}
|
||||
|
||||
message GetNetworkInstanceConfigRequest { common.UUID inst_id = 1; }
|
||||
|
||||
message GetNetworkInstanceConfigResponse {
|
||||
NetworkConfig config = 1;
|
||||
ConfigSource source = 2;
|
||||
}
|
||||
|
||||
message ListNetworkInstanceMetaRequest { repeated common.UUID inst_ids = 1; }
|
||||
|
||||
message ListNetworkInstanceMetaResponse { repeated NetworkMeta metas = 1; }
|
||||
|
||||
service WebClientService {
|
||||
rpc ValidateConfig(ValidateConfigRequest) returns (ValidateConfigResponse) {}
|
||||
rpc RunNetworkInstance(RunNetworkInstanceRequest)
|
||||
returns (RunNetworkInstanceResponse) {}
|
||||
rpc RetainNetworkInstance(RetainNetworkInstanceRequest)
|
||||
returns (RetainNetworkInstanceResponse) {}
|
||||
rpc CollectNetworkInfo(CollectNetworkInfoRequest)
|
||||
returns (CollectNetworkInfoResponse) {}
|
||||
rpc ListNetworkInstance(ListNetworkInstanceRequest)
|
||||
returns (ListNetworkInstanceResponse) {}
|
||||
rpc DeleteNetworkInstance(DeleteNetworkInstanceRequest)
|
||||
returns (DeleteNetworkInstanceResponse) {}
|
||||
rpc GetNetworkInstanceConfig(GetNetworkInstanceConfigRequest)
|
||||
returns (GetNetworkInstanceConfigResponse) {}
|
||||
rpc ListNetworkInstanceMeta(ListNetworkInstanceMetaRequest)
|
||||
returns (ListNetworkInstanceMetaResponse) {}
|
||||
}
|
||||
@@ -0,0 +1,269 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "error.proto";
|
||||
|
||||
package common;
|
||||
|
||||
message FlagsInConfig {
|
||||
string default_protocol = 1;
|
||||
string dev_name = 2;
|
||||
bool enable_encryption = 3;
|
||||
bool enable_ipv6 = 4;
|
||||
uint32 mtu = 5;
|
||||
bool latency_first = 6;
|
||||
bool enable_exit_node = 7;
|
||||
bool no_tun = 8;
|
||||
bool use_smoltcp = 9;
|
||||
string relay_network_whitelist = 10;
|
||||
bool disable_p2p = 11;
|
||||
bool relay_all_peer_rpc = 12;
|
||||
bool disable_udp_hole_punching = 13;
|
||||
// string ipv6_listener = 14; [deprecated = true]; use -l udp://[::]:12345
|
||||
// instead
|
||||
bool multi_thread = 15;
|
||||
CompressionAlgoPb data_compress_algo = 16;
|
||||
bool bind_device = 17;
|
||||
|
||||
// should we convert all tcp streams into kcp streams
|
||||
bool enable_kcp_proxy = 18;
|
||||
// does this peer allow kcp input
|
||||
bool disable_kcp_input = 19;
|
||||
// disable relay local network kcp packets
|
||||
bool disable_relay_kcp = 20;
|
||||
bool proxy_forward_by_system = 21;
|
||||
|
||||
// enable magic dns or not
|
||||
bool accept_dns = 22;
|
||||
// enable private mode
|
||||
bool private_mode = 23;
|
||||
|
||||
// should we convert all tcp streams into quic streams
|
||||
bool enable_quic_proxy = 24;
|
||||
// does this peer allow quic input
|
||||
bool disable_quic_input = 25;
|
||||
// disable relay local network quic packets
|
||||
bool disable_relay_quic = 35;
|
||||
|
||||
// quic listen port
|
||||
uint32 quic_listen_port = 33 [deprecated = true];
|
||||
|
||||
// a global relay limit, only work for foreign network
|
||||
uint64 foreign_relay_bps_limit = 26;
|
||||
|
||||
uint32 multi_thread_count = 27;
|
||||
|
||||
// enable relay foreign network kcp packets
|
||||
bool enable_relay_foreign_network_kcp = 28;
|
||||
|
||||
// enable relay foreign network quic packets
|
||||
bool enable_relay_foreign_network_quic = 36;
|
||||
|
||||
// encryption algorithm to use, empty string means default (aes-gcm)
|
||||
string encryption_algorithm = 29;
|
||||
|
||||
// disable symmetric nat hole punching, treat symmetric as cone when enabled
|
||||
bool disable_sym_hole_punching = 30;
|
||||
|
||||
// tld dns zone for magic dns
|
||||
string tld_dns_zone = 31;
|
||||
|
||||
bool p2p_only = 32;
|
||||
|
||||
bool disable_tcp_hole_punching = 34;
|
||||
|
||||
bool lazy_p2p = 37;
|
||||
bool need_p2p = 38;
|
||||
uint64 instance_recv_bps_limit = 39;
|
||||
bool disable_upnp = 40;
|
||||
bool disable_relay_data = 41;
|
||||
bool enable_udp_broadcast_relay = 42;
|
||||
|
||||
// Linux-only: SO_MARK (fwmark) value applied to every outbound underlay
|
||||
// socket (TCP/UDP/QUIC/WS/WG connectors and listeners). Unset = leave
|
||||
// SO_MARK untouched (kernel default 0). Any set value (including 0) is
|
||||
// applied via setsockopt. Requires CAP_NET_ADMIN; silently ignored on
|
||||
// non-Linux platforms.
|
||||
optional uint32 socket_mark = 43;
|
||||
}
|
||||
|
||||
message RpcDescriptor {
|
||||
// allow same service registered multiple times in different domain
|
||||
string domain_name = 1;
|
||||
|
||||
string proto_name = 2;
|
||||
string service_name = 3;
|
||||
uint32 method_index = 4;
|
||||
}
|
||||
|
||||
message RpcRequest {
|
||||
RpcDescriptor descriptor = 1 [ deprecated = true ];
|
||||
|
||||
bytes request = 2;
|
||||
int32 timeout_ms = 3;
|
||||
}
|
||||
|
||||
message RpcResponse {
|
||||
bytes response = 1;
|
||||
error.Error error = 2;
|
||||
|
||||
uint64 runtime_us = 3;
|
||||
}
|
||||
|
||||
enum CompressionAlgoPb {
|
||||
Invalid = 0;
|
||||
None = 1;
|
||||
Zstd = 2;
|
||||
}
|
||||
|
||||
message RpcCompressionInfo {
|
||||
// use this to compress the content
|
||||
CompressionAlgoPb algo = 1;
|
||||
|
||||
// tell the peer which compression algo is used to compress the next
|
||||
// response/request
|
||||
CompressionAlgoPb accepted_algo = 2;
|
||||
}
|
||||
|
||||
message RpcPacket {
|
||||
uint32 from_peer = 1;
|
||||
uint32 to_peer = 2;
|
||||
int64 transaction_id = 3;
|
||||
|
||||
RpcDescriptor descriptor = 4;
|
||||
bytes body = 5;
|
||||
bool is_request = 6;
|
||||
|
||||
uint32 total_pieces = 7;
|
||||
uint32 piece_idx = 8;
|
||||
|
||||
int32 trace_id = 9;
|
||||
|
||||
RpcCompressionInfo compression_info = 10;
|
||||
}
|
||||
|
||||
message Void {}
|
||||
|
||||
message UUID {
|
||||
uint32 part1 = 1;
|
||||
uint32 part2 = 2;
|
||||
uint32 part3 = 3;
|
||||
uint32 part4 = 4;
|
||||
}
|
||||
|
||||
enum NatType {
|
||||
// has NAT; but own a single public IP, port is not changed
|
||||
Unknown = 0;
|
||||
OpenInternet = 1;
|
||||
NoPAT = 2;
|
||||
FullCone = 3;
|
||||
Restricted = 4;
|
||||
PortRestricted = 5;
|
||||
Symmetric = 6;
|
||||
SymUdpFirewall = 7;
|
||||
SymmetricEasyInc = 8;
|
||||
SymmetricEasyDec = 9;
|
||||
}
|
||||
|
||||
message Ipv4Addr { uint32 addr = 1; }
|
||||
|
||||
message Ipv6Addr {
|
||||
uint32 part1 = 1;
|
||||
uint32 part2 = 2;
|
||||
uint32 part3 = 3;
|
||||
uint32 part4 = 4;
|
||||
}
|
||||
|
||||
message IpAddr {
|
||||
oneof ip {
|
||||
Ipv4Addr ipv4 = 1;
|
||||
Ipv6Addr ipv6 = 2;
|
||||
};
|
||||
}
|
||||
|
||||
message Ipv4Inet {
|
||||
Ipv4Addr address = 1;
|
||||
uint32 network_length = 2;
|
||||
}
|
||||
|
||||
message Ipv6Inet {
|
||||
Ipv6Addr address = 1;
|
||||
uint32 network_length = 2;
|
||||
}
|
||||
|
||||
message IpInet {
|
||||
oneof ip {
|
||||
Ipv4Inet ipv4 = 1;
|
||||
Ipv6Inet ipv6 = 2;
|
||||
};
|
||||
}
|
||||
|
||||
message Url { string url = 1; }
|
||||
|
||||
message SocketAddr {
|
||||
oneof ip {
|
||||
Ipv4Addr ipv4 = 1;
|
||||
Ipv6Addr ipv6 = 2;
|
||||
};
|
||||
uint32 port = 3;
|
||||
}
|
||||
|
||||
message TunnelInfo {
|
||||
string tunnel_type = 1;
|
||||
common.Url local_addr = 2;
|
||||
common.Url remote_addr = 3;
|
||||
common.Url resolved_remote_addr = 4;
|
||||
}
|
||||
|
||||
message StunInfo {
|
||||
NatType udp_nat_type = 1;
|
||||
NatType tcp_nat_type = 2;
|
||||
int64 last_update_time = 3;
|
||||
repeated string public_ip = 4;
|
||||
uint32 min_port = 5;
|
||||
uint32 max_port = 6;
|
||||
}
|
||||
|
||||
message PeerFeatureFlag {
|
||||
bool is_public_server = 1;
|
||||
bool avoid_relay_data = 2;
|
||||
bool kcp_input = 3;
|
||||
bool no_relay_kcp = 4;
|
||||
bool support_conn_list_sync = 5;
|
||||
bool quic_input = 6;
|
||||
bool no_relay_quic = 7;
|
||||
bool is_credential_peer = 8;
|
||||
bool need_p2p = 9;
|
||||
bool disable_p2p = 10;
|
||||
bool ipv6_public_addr_provider = 11;
|
||||
}
|
||||
|
||||
enum SocketType {
|
||||
TCP = 0;
|
||||
UDP = 1;
|
||||
}
|
||||
|
||||
message PortForwardConfigPb {
|
||||
SocketAddr bind_addr = 1;
|
||||
SocketAddr dst_addr = 2;
|
||||
SocketType socket_type = 3;
|
||||
}
|
||||
|
||||
message ProxyDstInfo { SocketAddr dst_addr = 1; }
|
||||
|
||||
message LimiterConfig {
|
||||
optional uint64 burst_rate =
|
||||
1; // default 1 means no burst (capacity is same with bps)
|
||||
optional uint64 bps = 2; // default 0 means no limit (unit is B/s)
|
||||
optional uint64 fill_duration_ms =
|
||||
3; // default 10ms, the period to fill the bucket
|
||||
}
|
||||
|
||||
message SecureModeConfig {
|
||||
bool enabled = 1;
|
||||
|
||||
// base64(X25519 private key), used by shared node to present a stable identity
|
||||
optional string local_private_key = 2;
|
||||
|
||||
// base64(X25519 public key), required if local_private_key is set
|
||||
optional string local_public_key = 3;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "common.proto";
|
||||
|
||||
package core_config;
|
||||
|
||||
message CoreConfig {
|
||||
NodeConfig node = 1;
|
||||
RouteConfig routes = 2;
|
||||
PeerPolicyConfig peer_policy = 3;
|
||||
TrafficConfig traffic = 4;
|
||||
}
|
||||
|
||||
message NodeConfig {
|
||||
optional uint32 peer_id = 1;
|
||||
optional common.UUID instance_id = 2;
|
||||
optional string hostname = 3;
|
||||
string network_name = 4;
|
||||
}
|
||||
|
||||
message RouteConfig {
|
||||
optional IpPrefix ipv4 = 1;
|
||||
optional IpPrefix ipv6 = 2;
|
||||
repeated IpPrefix advertised_routes = 3;
|
||||
repeated ProxyNetworkConfig proxy_networks = 4;
|
||||
repeated ForeignNetworkConfig foreign_networks = 5;
|
||||
}
|
||||
|
||||
message IpPrefix {
|
||||
common.IpAddr address = 1;
|
||||
uint32 prefix_len = 2;
|
||||
}
|
||||
|
||||
message ProxyNetworkConfig {
|
||||
IpPrefix real = 1;
|
||||
optional IpPrefix mapped = 2;
|
||||
}
|
||||
|
||||
message ForeignNetworkConfig {
|
||||
string name = 1;
|
||||
repeated IpPrefix cidrs = 2;
|
||||
}
|
||||
|
||||
message PeerPolicyConfig {
|
||||
optional bool p2p_enabled = 1;
|
||||
optional bool relay_peer_rpc = 2;
|
||||
optional bool relay_data = 3;
|
||||
optional bool latency_first = 4;
|
||||
optional bool encryption_required = 5;
|
||||
}
|
||||
|
||||
message TrafficConfig {
|
||||
optional uint32 mtu = 1;
|
||||
optional uint64 instance_recv_bps_limit = 2;
|
||||
optional uint64 foreign_relay_bps_limit = 3;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "common.proto";
|
||||
import "peer_rpc.proto";
|
||||
|
||||
package core.peer;
|
||||
|
||||
message PeerConnStats {
|
||||
uint64 rx_bytes = 1;
|
||||
uint64 tx_bytes = 2;
|
||||
|
||||
uint64 rx_packets = 3;
|
||||
uint64 tx_packets = 4;
|
||||
|
||||
uint64 latency_us = 5;
|
||||
}
|
||||
|
||||
message PeerConnInfo {
|
||||
string conn_id = 1;
|
||||
uint32 my_peer_id = 2;
|
||||
uint32 peer_id = 3;
|
||||
repeated string features = 4;
|
||||
common.TunnelInfo tunnel = 5;
|
||||
PeerConnStats stats = 6;
|
||||
float loss_rate = 7;
|
||||
bool is_client = 8;
|
||||
string network_name = 9;
|
||||
bool is_closed = 10;
|
||||
bytes noise_local_static_pubkey = 11;
|
||||
bytes noise_remote_static_pubkey = 12;
|
||||
peer_rpc.SecureAuthLevel secure_auth_level = 13;
|
||||
peer_rpc.PeerIdentityType peer_identity_type = 14;
|
||||
}
|
||||
|
||||
message PeerInfo {
|
||||
uint32 peer_id = 1;
|
||||
repeated PeerConnInfo conns = 2;
|
||||
common.UUID default_conn_id = 3;
|
||||
repeated common.UUID directly_connected_conns = 4;
|
||||
}
|
||||
|
||||
message Route {
|
||||
uint32 peer_id = 1;
|
||||
common.Ipv4Inet ipv4_addr = 2;
|
||||
|
||||
uint32 next_hop_peer_id = 3;
|
||||
int32 cost = 4;
|
||||
int32 path_latency = 11;
|
||||
|
||||
repeated string proxy_cidrs = 5;
|
||||
string hostname = 6;
|
||||
common.StunInfo stun_info = 7;
|
||||
string inst_id = 8;
|
||||
string version = 9;
|
||||
common.PeerFeatureFlag feature_flag = 10;
|
||||
|
||||
optional uint32 next_hop_peer_id_latency_first = 12;
|
||||
optional int32 cost_latency_first = 13;
|
||||
optional int32 path_latency_latency_first = 14;
|
||||
|
||||
common.Ipv6Inet ipv6_addr = 15;
|
||||
common.Ipv6Inet public_ipv6_addr = 16;
|
||||
common.Ipv6Inet ipv6_public_addr_prefix = 17;
|
||||
}
|
||||
|
||||
message PublicIpv6LeaseInfo {
|
||||
uint32 peer_id = 1;
|
||||
string inst_id = 2;
|
||||
common.Ipv6Inet leased_addr = 3;
|
||||
int64 valid_until_unix_seconds = 4;
|
||||
bool reused = 5;
|
||||
}
|
||||
|
||||
message ListPublicIpv6InfoResponse {
|
||||
common.Ipv6Inet provider_prefix = 1;
|
||||
repeated PublicIpv6LeaseInfo provider_leases = 2;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
syntax = "proto3";
|
||||
package error;
|
||||
|
||||
message OtherError { string error_message = 1; }
|
||||
|
||||
message InvalidMethodIndex {
|
||||
string service_name = 1;
|
||||
uint32 method_index = 2;
|
||||
}
|
||||
|
||||
message InvalidService { string service_name = 1; }
|
||||
|
||||
message ProstDecodeError {}
|
||||
|
||||
message ProstEncodeError {}
|
||||
|
||||
message ExecuteError { string error_message = 1; }
|
||||
|
||||
message MalformatRpcPacket { string error_message = 1; }
|
||||
|
||||
message Timeout { string error_message = 1; }
|
||||
|
||||
message Error {
|
||||
oneof error_kind {
|
||||
OtherError other_error = 1;
|
||||
InvalidMethodIndex invalid_method_index = 2;
|
||||
InvalidService invalid_service = 3;
|
||||
ProstDecodeError prost_decode_error = 4;
|
||||
ProstEncodeError prost_encode_error = 5;
|
||||
ExecuteError execute_error = 6;
|
||||
MalformatRpcPacket malformat_rpc_packet = 7;
|
||||
Timeout timeout = 8;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "common.proto";
|
||||
import "api_instance.proto";
|
||||
|
||||
package magic_dns;
|
||||
|
||||
message DnsRecordA {
|
||||
string name = 1;
|
||||
common.Ipv4Addr value = 2;
|
||||
int32 ttl = 3;
|
||||
}
|
||||
|
||||
message DnsRecordSOA {
|
||||
string name = 1;
|
||||
string value = 2;
|
||||
}
|
||||
|
||||
message DnsRecord {
|
||||
oneof record {
|
||||
DnsRecordA a = 1;
|
||||
DnsRecordSOA soa = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message DnsRecordList {
|
||||
repeated DnsRecord records = 1;
|
||||
}
|
||||
|
||||
message UpdateDnsRecordRequest {
|
||||
string zone = 1;
|
||||
repeated api.instance.Route routes = 2;
|
||||
}
|
||||
|
||||
message GetDnsRecordResponse {
|
||||
map<string, DnsRecordList> records = 1;
|
||||
}
|
||||
|
||||
message HandshakeRequest {}
|
||||
|
||||
message HandshakeResponse {}
|
||||
|
||||
service MagicDnsServerRpc {
|
||||
rpc Handshake(HandshakeRequest) returns (HandshakeResponse) {}
|
||||
rpc Heartbeat(common.Void) returns (common.Void) {}
|
||||
rpc UpdateDnsRecord(UpdateDnsRecordRequest) returns (common.Void) {}
|
||||
rpc GetDnsRecord(common.Void) returns (GetDnsRecordResponse) {}
|
||||
}
|
||||
@@ -0,0 +1,388 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "common.proto";
|
||||
|
||||
package peer_rpc;
|
||||
|
||||
message TrustedCredentialPubkey {
|
||||
bytes pubkey = 1; // X25519 public key (32 bytes)
|
||||
repeated string groups = 2; // ACL groups this credential belongs to
|
||||
bool allow_relay = 3; // whether this credential node can relay data
|
||||
int64 expiry_unix = 4; // expiry time (Unix timestamp)
|
||||
repeated string allowed_proxy_cidrs = 5; // allowed proxy_cidrs ranges
|
||||
optional bool reusable = 6; // whether multiple peers may use the same credential concurrently
|
||||
}
|
||||
|
||||
message TrustedCredentialPubkeyProof {
|
||||
TrustedCredentialPubkey credential = 1;
|
||||
bytes credential_hmac = 2;
|
||||
}
|
||||
|
||||
message RoutePeerInfo {
|
||||
// means next hop in route table.
|
||||
uint32 peer_id = 1;
|
||||
common.UUID inst_id = 2;
|
||||
uint32 cost = 3;
|
||||
optional common.Ipv4Addr ipv4_addr = 4;
|
||||
repeated string proxy_cidrs = 5;
|
||||
optional string hostname = 6;
|
||||
common.NatType udp_nat_type = 7;
|
||||
google.protobuf.Timestamp last_update = 8;
|
||||
uint32 version = 9;
|
||||
|
||||
string easytier_version = 10;
|
||||
common.PeerFeatureFlag feature_flag = 11;
|
||||
uint64 peer_route_id = 12;
|
||||
|
||||
uint32 network_length = 13;
|
||||
|
||||
optional uint32 quic_port = 14 [deprecated = true];
|
||||
optional common.Ipv6Inet ipv6_addr = 15;
|
||||
|
||||
repeated PeerGroupInfo groups = 16;
|
||||
|
||||
common.NatType tcp_nat_type = 17;
|
||||
bytes noise_static_pubkey = 18;
|
||||
|
||||
// Trusted credential public keys published by admin nodes (holding network_secret)
|
||||
repeated TrustedCredentialPubkeyProof trusted_credential_pubkeys = 19;
|
||||
|
||||
optional common.Ipv6Inet ipv6_public_addr_prefix = 22;
|
||||
optional common.Ipv6Inet ipv6_public_addr_lease = 24;
|
||||
}
|
||||
|
||||
message PeerIdVersion {
|
||||
uint32 peer_id = 1;
|
||||
uint32 version = 2;
|
||||
}
|
||||
|
||||
message RouteConnBitmap {
|
||||
repeated PeerIdVersion peer_ids = 1;
|
||||
bytes bitmap = 2;
|
||||
}
|
||||
|
||||
message RouteConnPeerList {
|
||||
message PeerConnInfo {
|
||||
PeerIdVersion peer_id = 1;
|
||||
repeated uint32 connected_peer_ids = 2;
|
||||
}
|
||||
repeated PeerConnInfo peer_conn_infos = 1;
|
||||
}
|
||||
|
||||
message RoutePeerInfos { repeated RoutePeerInfo items = 1; }
|
||||
|
||||
message ForeignNetworkRouteInfoKey {
|
||||
uint32 peer_id = 1;
|
||||
string network_name = 2;
|
||||
}
|
||||
|
||||
message ForeignNetworkRouteInfoEntry {
|
||||
repeated uint32 foreign_peer_ids = 1;
|
||||
google.protobuf.Timestamp last_update = 2;
|
||||
uint32 version = 3;
|
||||
bytes network_secret_digest = 4;
|
||||
uint32 my_peer_id_for_this_network = 5;
|
||||
}
|
||||
|
||||
message RouteForeignNetworkInfos {
|
||||
message Info {
|
||||
ForeignNetworkRouteInfoKey key = 1;
|
||||
ForeignNetworkRouteInfoEntry value = 2;
|
||||
}
|
||||
repeated Info infos = 1;
|
||||
}
|
||||
|
||||
message RouteForeignNetworkSummary {
|
||||
message Info {
|
||||
uint32 peer_id = 1;
|
||||
uint32 network_count = 2;
|
||||
uint32 peer_count = 3;
|
||||
}
|
||||
|
||||
map<uint32, Info> info_map = 1;
|
||||
}
|
||||
|
||||
message PeerGroupInfo {
|
||||
string group_name = 1;
|
||||
bytes group_proof = 2;
|
||||
}
|
||||
|
||||
message SyncRouteInfoRequest {
|
||||
uint32 my_peer_id = 1;
|
||||
uint64 my_session_id = 2;
|
||||
bool is_initiator = 3;
|
||||
RoutePeerInfos peer_infos = 4;
|
||||
oneof conn_info {
|
||||
RouteConnBitmap conn_bitmap = 5;
|
||||
RouteConnPeerList conn_peer_list = 7;
|
||||
}
|
||||
RouteForeignNetworkInfos foreign_network_infos = 6;
|
||||
}
|
||||
|
||||
enum SyncRouteInfoError {
|
||||
DuplicatePeerId = 0;
|
||||
Stopped = 1;
|
||||
}
|
||||
|
||||
message SyncRouteInfoResponse {
|
||||
bool is_initiator = 1;
|
||||
uint64 session_id = 2;
|
||||
optional SyncRouteInfoError error = 3;
|
||||
}
|
||||
|
||||
service OspfRouteRpc {
|
||||
// Generates a "hello" greeting based on the supplied info.
|
||||
rpc SyncRouteInfo(SyncRouteInfoRequest) returns (SyncRouteInfoResponse);
|
||||
}
|
||||
|
||||
message AcquireIpv6PublicAddrLeaseRequest {
|
||||
uint32 peer_id = 1;
|
||||
common.UUID inst_id = 2;
|
||||
}
|
||||
|
||||
message RenewIpv6PublicAddrLeaseRequest {
|
||||
uint32 peer_id = 1;
|
||||
common.UUID inst_id = 2;
|
||||
common.Ipv6Inet leased_addr = 3;
|
||||
}
|
||||
|
||||
message ReleaseIpv6PublicAddrLeaseRequest {
|
||||
uint32 peer_id = 1;
|
||||
common.UUID inst_id = 2;
|
||||
}
|
||||
|
||||
message GetIpv6PublicAddrLeaseRequest {
|
||||
uint32 peer_id = 1;
|
||||
common.UUID inst_id = 2;
|
||||
}
|
||||
|
||||
message Ipv6PublicAddrLeaseReply {
|
||||
uint32 provider_peer_id = 1;
|
||||
common.UUID provider_inst_id = 2;
|
||||
common.Ipv6Inet provider_prefix = 3;
|
||||
common.Ipv6Inet leased_addr = 4;
|
||||
google.protobuf.Timestamp valid_until = 5;
|
||||
bool reused = 6;
|
||||
optional string error_msg = 7;
|
||||
}
|
||||
|
||||
service PublicIpv6AddrRpc {
|
||||
rpc AcquireLease(AcquireIpv6PublicAddrLeaseRequest)
|
||||
returns (Ipv6PublicAddrLeaseReply);
|
||||
rpc RenewLease(RenewIpv6PublicAddrLeaseRequest)
|
||||
returns (Ipv6PublicAddrLeaseReply);
|
||||
rpc ReleaseLease(ReleaseIpv6PublicAddrLeaseRequest) returns (common.Void);
|
||||
rpc GetLease(GetIpv6PublicAddrLeaseRequest) returns (Ipv6PublicAddrLeaseReply);
|
||||
}
|
||||
|
||||
message GetIpListRequest {}
|
||||
|
||||
message GetIpListResponse {
|
||||
common.Ipv4Addr public_ipv4 = 1;
|
||||
repeated common.Ipv4Addr interface_ipv4s = 2;
|
||||
common.Ipv6Addr public_ipv6 = 3;
|
||||
repeated common.Ipv6Addr interface_ipv6s = 4;
|
||||
repeated common.Url listeners = 5;
|
||||
}
|
||||
|
||||
message SendUdpHolePunchPacketRequest {
|
||||
common.SocketAddr connector_addr = 1;
|
||||
uint32 listener_port = 2;
|
||||
common.Ipv6Addr preferred_src_ipv6 = 3;
|
||||
repeated common.SocketAddr connector_addrs = 4;
|
||||
}
|
||||
|
||||
service DirectConnectorRpc {
|
||||
rpc GetIpList(GetIpListRequest) returns (GetIpListResponse);
|
||||
rpc SendUdpHolePunchPacket(SendUdpHolePunchPacketRequest) returns (common.Void);
|
||||
}
|
||||
|
||||
message SelectPunchListenerRequest {
|
||||
bool force_new = 1;
|
||||
bool prefer_port_mapping = 2;
|
||||
}
|
||||
|
||||
message SelectPunchListenerResponse {
|
||||
common.SocketAddr listener_mapped_addr = 1;
|
||||
}
|
||||
|
||||
message SendPunchPacketConeRequest {
|
||||
common.SocketAddr listener_mapped_addr = 1;
|
||||
common.SocketAddr dest_addr = 2;
|
||||
uint32 transaction_id = 3;
|
||||
// send this many packets in a batch
|
||||
uint32 packet_count_per_batch = 4;
|
||||
// send total this batch count, total packet count = packet_batch_size * packet_batch_count
|
||||
uint32 packet_batch_count = 5;
|
||||
// interval between each batch
|
||||
uint32 packet_interval_ms = 6;
|
||||
}
|
||||
|
||||
message SendPunchPacketHardSymRequest {
|
||||
common.SocketAddr listener_mapped_addr = 1;
|
||||
|
||||
repeated common.Ipv4Addr public_ips = 2;
|
||||
uint32 transaction_id = 3;
|
||||
uint32 port_index = 4;
|
||||
uint32 round = 5;
|
||||
}
|
||||
|
||||
message SendPunchPacketHardSymResponse { uint32 next_port_index = 1; }
|
||||
|
||||
message SendPunchPacketEasySymRequest {
|
||||
common.SocketAddr listener_mapped_addr = 1;
|
||||
repeated common.Ipv4Addr public_ips = 2;
|
||||
uint32 transaction_id = 3;
|
||||
|
||||
uint32 base_port_num = 4;
|
||||
uint32 max_port_num = 5;
|
||||
bool is_incremental = 6;
|
||||
}
|
||||
|
||||
message SendPunchPacketBothEasySymRequest {
|
||||
uint32 udp_socket_count = 1;
|
||||
common.Ipv4Addr public_ip = 2;
|
||||
uint32 transaction_id = 3;
|
||||
|
||||
uint32 dst_port_num = 4;
|
||||
uint32 wait_time_ms = 5;
|
||||
}
|
||||
|
||||
message SendPunchPacketBothEasySymResponse {
|
||||
// is doing punch with other peer
|
||||
bool is_busy = 1;
|
||||
common.SocketAddr base_mapped_addr = 2;
|
||||
}
|
||||
|
||||
service UdpHolePunchRpc {
|
||||
rpc SelectPunchListener(SelectPunchListenerRequest)
|
||||
returns (SelectPunchListenerResponse);
|
||||
|
||||
// send packet to one remote_addr, used by nat1-3 to nat1-3
|
||||
rpc SendPunchPacketCone(SendPunchPacketConeRequest) returns (common.Void);
|
||||
|
||||
// send packet to multiple remote_addr (birthday attack), used by nat4 to nat1-3
|
||||
rpc SendPunchPacketHardSym(SendPunchPacketHardSymRequest)
|
||||
returns (SendPunchPacketHardSymResponse);
|
||||
rpc SendPunchPacketEasySym(SendPunchPacketEasySymRequest)
|
||||
returns (common.Void);
|
||||
|
||||
// nat4 to nat4 (both predictably)
|
||||
rpc SendPunchPacketBothEasySym(SendPunchPacketBothEasySymRequest)
|
||||
returns (SendPunchPacketBothEasySymResponse);
|
||||
}
|
||||
|
||||
message TcpHolePunchRequest { common.SocketAddr connector_mapped_addr = 1; }
|
||||
|
||||
message TcpHolePunchResponse { common.SocketAddr listener_mapped_addr = 1; }
|
||||
|
||||
service TcpHolePunchRpc {
|
||||
rpc ExchangeMappedAddr(TcpHolePunchRequest) returns (TcpHolePunchResponse);
|
||||
}
|
||||
|
||||
message DirectConnectedPeerInfo { int32 latency_ms = 1; }
|
||||
|
||||
message PeerInfoForGlobalMap {
|
||||
map<uint32, DirectConnectedPeerInfo> direct_peers = 1;
|
||||
}
|
||||
|
||||
message ReportPeersRequest {
|
||||
uint32 my_peer_id = 1;
|
||||
PeerInfoForGlobalMap peer_infos = 2;
|
||||
}
|
||||
|
||||
message ReportPeersResponse {}
|
||||
|
||||
message GlobalPeerMap { map<uint32, PeerInfoForGlobalMap> map = 1; }
|
||||
|
||||
message GetGlobalPeerMapRequest { uint64 digest = 1; }
|
||||
|
||||
message GetGlobalPeerMapResponse {
|
||||
map<uint32, PeerInfoForGlobalMap> global_peer_map = 1;
|
||||
optional uint64 digest = 2;
|
||||
}
|
||||
|
||||
service PeerCenterRpc {
|
||||
rpc ReportPeers(ReportPeersRequest) returns (ReportPeersResponse);
|
||||
rpc GetGlobalPeerMap(GetGlobalPeerMapRequest)
|
||||
returns (GetGlobalPeerMapResponse);
|
||||
}
|
||||
|
||||
message HandshakeRequest {
|
||||
uint32 magic = 1;
|
||||
uint32 my_peer_id = 2;
|
||||
uint32 version = 3;
|
||||
repeated string features = 4;
|
||||
string network_name = 5;
|
||||
bytes network_secret_digest = 6;
|
||||
}
|
||||
|
||||
message KcpConnData {
|
||||
common.SocketAddr src = 1;
|
||||
common.SocketAddr dst = 4;
|
||||
}
|
||||
|
||||
enum SecureAuthLevel {
|
||||
None = 0;
|
||||
EncryptedUnauthenticated = 1;
|
||||
PeerVerified = 2;
|
||||
NetworkSecretConfirmed = 3;
|
||||
}
|
||||
|
||||
enum PeerIdentityType {
|
||||
Admin = 0;
|
||||
Credential = 1;
|
||||
SharedNode = 2;
|
||||
}
|
||||
|
||||
enum PeerConnSessionActionPb {
|
||||
Join = 0;
|
||||
Sync = 1;
|
||||
Create = 2;
|
||||
}
|
||||
|
||||
message PeerConnNoiseMsg1Pb {
|
||||
uint32 version = 1;
|
||||
string a_network_name = 2;
|
||||
optional uint32 a_session_generation = 3;
|
||||
common.UUID a_conn_id = 4;
|
||||
string client_encryption_algorithm = 5;
|
||||
}
|
||||
|
||||
message PeerConnNoiseMsg2Pb {
|
||||
string b_network_name = 1;
|
||||
uint32 role_hint = 2;
|
||||
PeerConnSessionActionPb action = 3;
|
||||
uint32 b_session_generation = 4;
|
||||
optional bytes root_key_32 = 5;
|
||||
uint32 initial_epoch = 6;
|
||||
common.UUID b_conn_id = 7;
|
||||
common.UUID a_conn_id_echo = 8;
|
||||
optional bytes secret_proof_32 = 9;
|
||||
string server_encryption_algorithm = 10;
|
||||
}
|
||||
|
||||
message RelayNoiseMsg1Pb {
|
||||
uint32 version = 1;
|
||||
optional uint32 a_session_generation = 3;
|
||||
common.UUID a_conn_id = 4;
|
||||
string client_encryption_algorithm = 5;
|
||||
}
|
||||
|
||||
message RelayNoiseMsg2Pb {
|
||||
PeerConnSessionActionPb action = 3;
|
||||
uint32 b_session_generation = 4;
|
||||
optional bytes root_key_32 = 5;
|
||||
uint32 initial_epoch = 6;
|
||||
common.UUID b_conn_id = 7;
|
||||
common.UUID a_conn_id_echo = 8;
|
||||
string server_encryption_algorithm = 10;
|
||||
}
|
||||
|
||||
message PeerConnNoiseMsg3Pb {
|
||||
common.UUID a_conn_id_echo = 1;
|
||||
common.UUID b_conn_id_echo = 2;
|
||||
optional bytes secret_proof_32 = 3;
|
||||
bytes secret_digest = 4;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package tests;
|
||||
|
||||
/// The Greeting service. This service is used to generate greetings for various
|
||||
/// use-cases.
|
||||
service Greeting {
|
||||
// Generates a "hello" greeting based on the supplied info.
|
||||
rpc SayHello(SayHelloRequest) returns (SayHelloResponse);
|
||||
// Generates a "goodbye" greeting based on the supplied info.
|
||||
rpc SayGoodbye(SayGoodbyeRequest) returns (SayGoodbyeResponse);
|
||||
}
|
||||
|
||||
// The request for an `Greeting.SayHello` call.
|
||||
message SayHelloRequest { string name = 1; }
|
||||
|
||||
// The response for an `Greeting.SayHello` call.
|
||||
message SayHelloResponse { string greeting = 1; }
|
||||
|
||||
// The request for an `Greeting.SayGoodbye` call.
|
||||
message SayGoodbyeRequest { string name = 1; }
|
||||
|
||||
// The response for an `Greeting.SayGoodbye` call.
|
||||
message SayGoodbyeResponse { string greeting = 1; }
|
||||
@@ -0,0 +1,38 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "common.proto";
|
||||
|
||||
package web;
|
||||
|
||||
message DeviceOsInfo {
|
||||
string os_type = 1;
|
||||
string version = 2;
|
||||
string distribution = 3;
|
||||
}
|
||||
|
||||
message HeartbeatRequest {
|
||||
common.UUID machine_id = 1;
|
||||
common.UUID inst_id = 2;
|
||||
string user_token = 3;
|
||||
|
||||
string easytier_version = 4;
|
||||
string report_time = 5;
|
||||
string hostname = 6;
|
||||
|
||||
repeated common.UUID running_network_instances = 7;
|
||||
DeviceOsInfo device_os = 8;
|
||||
bool support_config_source = 9;
|
||||
}
|
||||
|
||||
message HeartbeatResponse {}
|
||||
|
||||
message GetFeatureRequest {}
|
||||
|
||||
message GetFeatureResponse {
|
||||
bool support_encryption = 1;
|
||||
}
|
||||
|
||||
service WebServerService {
|
||||
rpc Heartbeat(HeartbeatRequest) returns (HeartbeatResponse);
|
||||
rpc GetFeature(GetFeatureRequest) returns (GetFeatureResponse);
|
||||
}
|
||||
Reference in New Issue
Block a user