forked from vnt-dev/vnts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
fn main() { | ||
std::fs::create_dir_all("src/proto").unwrap(); | ||
protobuf_codegen::Codegen::new() | ||
.pure() | ||
.out_dir("src/proto") | ||
.inputs(&["proto/message.proto"]) | ||
.include("proto") | ||
.run() | ||
.expect("Codegen failed."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
syntax = "proto3"; | ||
message HandshakeRequest{ | ||
string version = 1; | ||
bool secret = 2; | ||
} | ||
message HandshakeResponse{ | ||
string version = 1; | ||
bool secret = 2; | ||
bytes public_key = 3; | ||
string key_finger = 4; | ||
} | ||
message SecretHandshakeRequest{ | ||
string token = 1; | ||
bytes key = 2; | ||
} | ||
message RegistrationRequest{ | ||
string token = 1; | ||
string device_id = 2; | ||
string name = 3; | ||
bool is_fast = 4; | ||
string version = 5; | ||
fixed32 virtual_ip = 6; | ||
bool allow_ip_change = 7; | ||
bool client_secret = 8; | ||
} | ||
|
||
message RegistrationResponse{ | ||
fixed32 virtual_ip = 1; | ||
fixed32 virtual_gateway = 2; | ||
fixed32 virtual_netmask = 3; | ||
uint32 epoch = 4; | ||
repeated DeviceInfo device_info_list = 5; | ||
fixed32 public_ip = 6; | ||
uint32 public_port = 7; | ||
bytes public_ipv6 = 8; | ||
} | ||
message DeviceInfo{ | ||
string name = 1; | ||
fixed32 virtual_ip = 2; | ||
uint32 device_status = 3; | ||
bool client_secret = 4; | ||
} | ||
|
||
message DeviceList{ | ||
uint32 epoch = 1; | ||
repeated DeviceInfo device_info_list = 2; | ||
} | ||
|
||
message PunchInfo{ | ||
repeated fixed32 public_ip_list = 2; | ||
uint32 public_port = 3; | ||
uint32 public_port_range = 4; | ||
PunchNatType nat_type = 5; | ||
bool reply = 6; | ||
fixed32 local_ip = 7; | ||
uint32 local_port = 8; | ||
bytes ipv6 = 9; | ||
uint32 ipv6_port = 10; | ||
} | ||
enum PunchNatType{ | ||
Symmetric = 0; | ||
Cone = 1; | ||
} |