2024-09-18 21:55:28 +08:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
|
import "common.proto";
|
|
|
|
|
|
|
|
|
|
package peer_rpc;
|
|
|
|
|
|
|
|
|
|
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_stun_info = 7;
|
|
|
|
|
google.protobuf.Timestamp last_update = 8;
|
|
|
|
|
uint32 version = 9;
|
2024-09-18 22:25:47 +08:00
|
|
|
|
|
|
|
|
string easytier_version = 10;
|
2024-09-18 21:55:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message PeerIdVersion {
|
|
|
|
|
uint32 peer_id = 1;
|
|
|
|
|
uint32 version = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message RouteConnBitmap {
|
|
|
|
|
repeated PeerIdVersion peer_ids = 1;
|
|
|
|
|
bytes bitmap = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message RoutePeerInfos { repeated RoutePeerInfo items = 1; }
|
|
|
|
|
|
|
|
|
|
message SyncRouteInfoRequest {
|
|
|
|
|
uint32 my_peer_id = 1;
|
|
|
|
|
uint64 my_session_id = 2;
|
|
|
|
|
bool is_initiator = 3;
|
|
|
|
|
RoutePeerInfos peer_infos = 4;
|
|
|
|
|
RouteConnBitmap conn_bitmap = 5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
service DirectConnectorRpc {
|
|
|
|
|
rpc GetIpList(GetIpListRequest) returns (GetIpListResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message TryPunchHoleRequest { common.SocketAddr local_mapped_addr = 1; }
|
|
|
|
|
|
|
|
|
|
message TryPunchHoleResponse { common.SocketAddr remote_mapped_addr = 1; }
|
|
|
|
|
|
|
|
|
|
message TryPunchSymmetricRequest {
|
|
|
|
|
common.SocketAddr listener_addr = 1;
|
|
|
|
|
uint32 port = 2;
|
|
|
|
|
repeated common.Ipv4Addr public_ips = 3;
|
|
|
|
|
uint32 min_port = 4;
|
|
|
|
|
uint32 max_port = 5;
|
|
|
|
|
uint32 transaction_id = 6;
|
|
|
|
|
uint32 round = 7;
|
|
|
|
|
uint32 last_port_index = 8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message TryPunchSymmetricResponse { uint32 last_port_index = 1; }
|
|
|
|
|
|
|
|
|
|
service UdpHolePunchRpc {
|
|
|
|
|
rpc TryPunchHole(TryPunchHoleRequest) returns (TryPunchHoleResponse);
|
|
|
|
|
rpc TryPunchSymmetric(TryPunchSymmetricRequest)
|
|
|
|
|
returns (TryPunchSymmetricResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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_digrest = 6;
|
|
|
|
|
}
|