rustdesk/libs/hbb_common/protos/rendezvous.proto

195 lines
3.9 KiB
Protocol Buffer
Raw Normal View History

2021-03-29 15:59:14 +08:00
syntax = "proto3";
package hbb;
message RegisterPeer {
string id = 1;
int32 serial = 2;
}
2021-07-27 23:53:12 +08:00
enum ConnType {
DEFAULT_CONN = 0;
FILE_TRANSFER = 1;
PORT_FORWARD = 2;
RDP = 3;
}
2021-03-29 15:59:14 +08:00
message RegisterPeerResponse { bool request_pk = 2; }
message PunchHoleRequest {
string id = 1;
NatType nat_type = 2;
2022-05-12 17:35:25 +08:00
string licence_key = 3;
2021-07-27 23:53:12 +08:00
ConnType conn_type = 4;
2022-05-12 17:35:25 +08:00
string token = 5;
2021-03-29 15:59:14 +08:00
}
message PunchHole {
bytes socket_addr = 1;
string relay_server = 2;
NatType nat_type = 3;
2023-03-15 19:29:03 +08:00
string request_region = 4;
2021-03-29 15:59:14 +08:00
}
message TestNatRequest {
int32 serial = 1;
}
// per my test, uint/int has no difference in encoding, int not good for negative, use sint for negative
message TestNatResponse {
int32 port = 1;
ConfigUpdate cu = 2; // for mobile
}
enum NatType {
UNKNOWN_NAT = 0;
ASYMMETRIC = 1;
SYMMETRIC = 2;
}
message PunchHoleSent {
bytes socket_addr = 1;
string id = 2;
string relay_server = 3;
NatType nat_type = 4;
2021-11-07 10:18:10 +08:00
string version = 5;
2023-03-15 19:29:03 +08:00
string request_region = 6;
2021-03-29 15:59:14 +08:00
}
message RegisterPk {
string id = 1;
bytes uuid = 2;
bytes pk = 3;
2022-05-12 17:35:25 +08:00
string old_id = 4;
2021-03-29 15:59:14 +08:00
}
message RegisterPkResponse {
enum Result {
2022-01-21 02:06:33 +08:00
OK = 0;
2021-03-29 15:59:14 +08:00
UUID_MISMATCH = 2;
2021-07-27 23:53:12 +08:00
ID_EXISTS = 3;
TOO_FREQUENT = 4;
INVALID_ID_FORMAT = 5;
NOT_SUPPORT = 6;
SERVER_ERROR = 7;
2021-03-29 15:59:14 +08:00
}
Result result = 1;
int32 keep_alive = 2;
2021-03-29 15:59:14 +08:00
}
message PunchHoleResponse {
bytes socket_addr = 1;
bytes pk = 2;
enum Failure {
2022-01-21 02:06:33 +08:00
ID_NOT_EXIST = 0;
2021-03-29 15:59:14 +08:00
OFFLINE = 2;
2021-11-14 23:22:05 +08:00
LICENSE_MISMATCH = 3;
LICENSE_OVERUSE = 4;
2021-03-29 15:59:14 +08:00
}
Failure failure = 3;
string relay_server = 4;
oneof union {
NatType nat_type = 5;
bool is_local = 6;
}
2021-07-27 23:53:12 +08:00
string other_failure = 7;
2021-03-29 15:59:14 +08:00
}
message ConfigUpdate {
int32 serial = 1;
repeated string rendezvous_servers = 2;
}
message RequestRelay {
string id = 1;
string uuid = 2;
bytes socket_addr = 3;
string relay_server = 4;
bool secure = 5;
2022-05-12 17:35:25 +08:00
string licence_key = 6;
2021-07-27 23:53:12 +08:00
ConnType conn_type = 7;
2022-05-12 17:35:25 +08:00
string token = 8;
2023-03-15 19:29:03 +08:00
string request_region = 9;
2021-03-29 15:59:14 +08:00
}
message RelayResponse {
bytes socket_addr = 1;
string uuid = 2;
string relay_server = 3;
oneof union {
string id = 4;
bytes pk = 5;
}
2021-07-27 23:53:12 +08:00
string refuse_reason = 6;
2021-11-07 10:18:10 +08:00
string version = 7;
2023-03-15 19:29:03 +08:00
string request_region = 8;
2021-03-29 15:59:14 +08:00
}
message SoftwareUpdate { string url = 1; }
// if in same intranet, punch hole won't work both for udp and tcp,
// even some router has below connection error if we connect itself,
// { kind: Other, error: "could not resolve to any address" },
// so we request local address to connect.
message FetchLocalAddr {
bytes socket_addr = 1;
string relay_server = 2;
2023-03-15 19:29:03 +08:00
string request_region = 3;
2021-03-29 15:59:14 +08:00
}
message LocalAddr {
bytes socket_addr = 1;
bytes local_addr = 2;
string relay_server = 3;
2021-05-11 19:02:18 +08:00
string id = 4;
2021-11-07 10:18:10 +08:00
string version = 5;
2023-03-15 19:29:03 +08:00
string request_region = 6;
2021-03-29 15:59:14 +08:00
}
2022-01-11 16:24:35 +08:00
message PeerDiscovery {
string cmd = 1;
string mac = 2;
string id = 3;
string username = 4;
string hostname = 5;
string platform = 6;
string misc = 7;
}
message OnlineRequest {
string id = 1;
repeated string peers = 2;
}
message OnlineResponse {
bytes states = 1;
}
2023-05-14 18:17:02 +08:00
message KeyExchange {
repeated bytes keys = 1;
}
2021-03-29 15:59:14 +08:00
message RendezvousMessage {
oneof union {
RegisterPeer register_peer = 6;
RegisterPeerResponse register_peer_response = 7;
PunchHoleRequest punch_hole_request = 8;
PunchHole punch_hole = 9;
PunchHoleSent punch_hole_sent = 10;
PunchHoleResponse punch_hole_response = 11;
FetchLocalAddr fetch_local_addr = 12;
LocalAddr local_addr = 13;
ConfigUpdate configure_update = 14;
RegisterPk register_pk = 15;
RegisterPkResponse register_pk_response = 16;
SoftwareUpdate software_update = 17;
RequestRelay request_relay = 18;
RelayResponse relay_response = 19;
TestNatRequest test_nat_request = 20;
TestNatResponse test_nat_response = 21;
2022-01-11 16:24:35 +08:00
PeerDiscovery peer_discovery = 22;
OnlineRequest online_request = 23;
OnlineResponse online_response = 24;
2023-05-14 18:17:02 +08:00
KeyExchange key_exchange = 25;
2021-03-29 15:59:14 +08:00
}
}