@@ -17,31 +17,31 @@ package vpn;
1717// msg_id which it sets on the request, the responder sets response_to that msg_id on the response
1818// message
1919message RPC {
20- uint64 msg_id = 1 ;
21- uint64 response_to = 2 ;
20+ uint64 msg_id = 1 ;
21+ uint64 response_to = 2 ;
2222}
2323
2424// ManagerMessage is a message from the manager (to the tunnel).
2525message ManagerMessage {
26- RPC rpc = 1 ;
27- oneof msg {
28- GetPeerUpdate get_peer_update = 2 ;
29- NetworkSettingsResponse network_settings = 3 ;
30- StartRequest start = 4 ;
31- StopRequest stop = 5 ;
32- }
26+ RPC rpc = 1 ;
27+ oneof msg {
28+ GetPeerUpdate get_peer_update = 2 ;
29+ NetworkSettingsResponse network_settings = 3 ;
30+ StartRequest start = 4 ;
31+ StopRequest stop = 5 ;
32+ }
3333}
3434
3535// TunnelMessage is a message from the tunnel (to the manager).
3636message TunnelMessage {
37- RPC rpc = 1 ;
38- oneof msg {
39- Log log = 2 ;
40- PeerUpdate peer_update = 3 ;
41- NetworkSettingsRequest network_settings = 4 ;
42- StartResponse start = 5 ;
43- StopResponse stop = 6 ;
44- }
37+ RPC rpc = 1 ;
38+ oneof msg {
39+ Log log = 2 ;
40+ PeerUpdate peer_update = 3 ;
41+ NetworkSettingsRequest network_settings = 4 ;
42+ StartResponse start = 5 ;
43+ StopResponse stop = 6 ;
44+ }
4545}
4646
4747// ClientMessage is a message from the client (to the service). Windows only.
@@ -50,7 +50,7 @@ message ClientMessage {
5050 oneof msg {
5151 StartRequest start = 2 ;
5252 StopRequest stop = 3 ;
53- StatusRequest status = 4 ;
53+ StatusRequest status = 4 ;
5454 }
5555}
5656
@@ -60,32 +60,32 @@ message ServiceMessage {
6060 oneof msg {
6161 StartResponse start = 2 ;
6262 StopResponse stop = 3 ;
63- Status status = 4 ; // either in reply to a StatusRequest or broadcasted
63+ Status status = 4 ; // either in reply to a StatusRequest or broadcasted
6464 }
6565}
6666
6767// Log is a log message generated by the tunnel. The manager should log it to the system log. It is
6868// one-way tunnel -> manager with no response.
6969message Log {
70- enum Level {
71- // these are designed to match slog levels
72- DEBUG = 0 ;
73- INFO = 1 ;
74- WARN = 2 ;
75- ERROR = 3 ;
76- CRITICAL = 4 ;
77- FATAL = 5 ;
78- }
79- Level level = 1 ;
80-
81- string message = 2 ;
82- repeated string logger_names = 3 ;
83-
84- message Field {
85- string name = 1 ;
86- string value = 2 ;
87- }
88- repeated Field fields = 4 ;
70+ enum Level {
71+ // these are designed to match slog levels
72+ DEBUG = 0 ;
73+ INFO = 1 ;
74+ WARN = 2 ;
75+ ERROR = 3 ;
76+ CRITICAL = 4 ;
77+ FATAL = 5 ;
78+ }
79+ Level level = 1 ;
80+
81+ string message = 2 ;
82+ repeated string logger_names = 3 ;
83+
84+ message Field {
85+ string name = 1 ;
86+ string value = 2 ;
87+ }
88+ repeated Field fields = 4 ;
8989}
9090
9191// GetPeerUpdate asks for a PeerUpdate with a full set of data.
@@ -95,121 +95,121 @@ message GetPeerUpdate {}
9595// response to GetPeerUpdate (which dumps the full set). It is also generated on any changes (not in
9696// response to any request).
9797message PeerUpdate {
98- repeated Workspace upserted_workspaces = 1 ;
99- repeated Agent upserted_agents = 2 ;
100- repeated Workspace deleted_workspaces = 3 ;
101- repeated Agent deleted_agents = 4 ;
98+ repeated Workspace upserted_workspaces = 1 ;
99+ repeated Agent upserted_agents = 2 ;
100+ repeated Workspace deleted_workspaces = 3 ;
101+ repeated Agent deleted_agents = 4 ;
102102}
103103
104104message Workspace {
105- bytes id = 1 ; // UUID
106- string name = 2 ;
107-
108- enum Status {
109- UNKNOWN = 0 ;
110- PENDING = 1 ;
111- STARTING = 2 ;
112- RUNNING = 3 ;
113- STOPPING = 4 ;
114- STOPPED = 5 ;
115- FAILED = 6 ;
116- CANCELING = 7 ;
117- CANCELED = 8 ;
118- DELETING = 9 ;
119- DELETED = 10 ;
120- }
121- Status status = 3 ;
105+ bytes id = 1 ; // UUID
106+ string name = 2 ;
107+
108+ enum Status {
109+ UNKNOWN = 0 ;
110+ PENDING = 1 ;
111+ STARTING = 2 ;
112+ RUNNING = 3 ;
113+ STOPPING = 4 ;
114+ STOPPED = 5 ;
115+ FAILED = 6 ;
116+ CANCELING = 7 ;
117+ CANCELED = 8 ;
118+ DELETING = 9 ;
119+ DELETED = 10 ;
120+ }
121+ Status status = 3 ;
122122}
123123
124124message Agent {
125- bytes id = 1 ; // UUID
126- string name = 2 ;
127- bytes workspace_id = 3 ; // UUID
128- repeated string fqdn = 4 ;
129- repeated string ip_addrs = 5 ;
130- // last_handshake is the primary indicator of whether we are connected to a peer. Zero value or
131- // anything longer than 5 minutes ago means there is a problem.
132- google.protobuf.Timestamp last_handshake = 6 ;
125+ bytes id = 1 ; // UUID
126+ string name = 2 ;
127+ bytes workspace_id = 3 ; // UUID
128+ repeated string fqdn = 4 ;
129+ repeated string ip_addrs = 5 ;
130+ // last_handshake is the primary indicator of whether we are connected to a peer. Zero value or
131+ // anything longer than 5 minutes ago means there is a problem.
132+ google.protobuf.Timestamp last_handshake = 6 ;
133133}
134134
135135// NetworkSettingsRequest is based on
136136// https://developer.apple.com/documentation/networkextension/nepackettunnelnetworksettings for
137137// macOS. It is a request/response message with response NetworkSettingsResponse
138138message NetworkSettingsRequest {
139- uint32 tunnel_overhead_bytes = 1 ;
140- uint32 mtu = 2 ;
141-
142- message DNSSettings {
143- repeated string servers = 1 ;
144- repeated string search_domains = 2 ;
145- // domain_name is the primary domain name of the tunnel
146- string domain_name = 3 ;
147- repeated string match_domains = 4 ;
148- // match_domains_no_search specifies if the domains in the matchDomains list should not be
149- // appended to the resolver’s list of search domains.
150- bool match_domains_no_search = 5 ;
151- }
152- DNSSettings dns_settings = 3 ;
153-
154- string tunnel_remote_address = 4 ;
155-
156- message IPv4Settings {
157- repeated string addrs = 1 ;
158- repeated string subnet_masks = 2 ;
159- // router is the next-hop router in dotted-decimal format
160- string router = 3 ;
161-
162- message IPv4Route {
163- string destination = 1 ;
164- string mask = 2 ;
165- // router is the next-hop router in dotted-decimal format
166- string router = 3 ;
167- }
168- repeated IPv4Route included_routes = 4 ;
169- repeated IPv4Route excluded_routes = 5 ;
170- }
171- IPv4Settings ipv4_settings = 5 ;
172-
173- message IPv6Settings {
174- repeated string addrs = 1 ;
175- repeated uint32 prefix_lengths = 2 ;
176-
177- message IPv6Route {
178- string destination = 1 ;
179- uint32 prefix_length = 2 ;
180- // router is the address of the next-hop
181- string router = 3 ;
182- }
183- repeated IPv6Route included_routes = 3 ;
184- repeated IPv6Route excluded_routes = 4 ;
185- }
186- IPv6Settings ipv6_settings = 6 ;
139+ uint32 tunnel_overhead_bytes = 1 ;
140+ uint32 mtu = 2 ;
141+
142+ message DNSSettings {
143+ repeated string servers = 1 ;
144+ repeated string search_domains = 2 ;
145+ // domain_name is the primary domain name of the tunnel
146+ string domain_name = 3 ;
147+ repeated string match_domains = 4 ;
148+ // match_domains_no_search specifies if the domains in the matchDomains list should not be
149+ // appended to the resolver’s list of search domains.
150+ bool match_domains_no_search = 5 ;
151+ }
152+ DNSSettings dns_settings = 3 ;
153+
154+ string tunnel_remote_address = 4 ;
155+
156+ message IPv4Settings {
157+ repeated string addrs = 1 ;
158+ repeated string subnet_masks = 2 ;
159+ // router is the next-hop router in dotted-decimal format
160+ string router = 3 ;
161+
162+ message IPv4Route {
163+ string destination = 1 ;
164+ string mask = 2 ;
165+ // router is the next-hop router in dotted-decimal format
166+ string router = 3 ;
167+ }
168+ repeated IPv4Route included_routes = 4 ;
169+ repeated IPv4Route excluded_routes = 5 ;
170+ }
171+ IPv4Settings ipv4_settings = 5 ;
172+
173+ message IPv6Settings {
174+ repeated string addrs = 1 ;
175+ repeated uint32 prefix_lengths = 2 ;
176+
177+ message IPv6Route {
178+ string destination = 1 ;
179+ uint32 prefix_length = 2 ;
180+ // router is the address of the next-hop
181+ string router = 3 ;
182+ }
183+ repeated IPv6Route included_routes = 3 ;
184+ repeated IPv6Route excluded_routes = 4 ;
185+ }
186+ IPv6Settings ipv6_settings = 6 ;
187187}
188188
189189// NetworkSettingsResponse is the response from the manager to the tunnel for a
190190// NetworkSettingsRequest
191191message NetworkSettingsResponse {
192- bool success = 1 ;
193- string error_message = 2 ;
192+ bool success = 1 ;
193+ string error_message = 2 ;
194194}
195195
196196// StartRequest is a request from the manager to start the tunnel. The tunnel replies with a
197197// StartResponse.
198198message StartRequest {
199- int32 tunnel_file_descriptor = 1 ;
200- string coder_url = 2 ;
201- string api_token = 3 ;
202- // Additional HTTP headers added to all requests
203- message Header {
204- string name = 1 ;
205- string value = 2 ;
206- }
207- repeated Header headers = 4 ;
199+ int32 tunnel_file_descriptor = 1 ;
200+ string coder_url = 2 ;
201+ string api_token = 3 ;
202+ // Additional HTTP headers added to all requests
203+ message Header {
204+ string name = 1 ;
205+ string value = 2 ;
206+ }
207+ repeated Header headers = 4 ;
208208}
209209
210210message StartResponse {
211- bool success = 1 ;
212- string error_message = 2 ;
211+ bool success = 1 ;
212+ string error_message = 2 ;
213213}
214214
215215// StopRequest is a request to stop the tunnel. The tunnel replies with a
@@ -219,8 +219,8 @@ message StopRequest {}
219219// StopResponse is a response to stopping the tunnel. After sending this response, the tunnel closes
220220// its side of the bidirectional stream for writing.
221221message StopResponse {
222- bool success = 1 ;
223- string error_message = 2 ;
222+ bool success = 1 ;
223+ string error_message = 2 ;
224224}
225225
226226// StatusRequest is a request to get the status of the tunnel. The manager
@@ -230,18 +230,18 @@ message StatusRequest {}
230230// Status is sent in response to a StatusRequest or broadcasted to all clients
231231// when the status changes.
232232message Status {
233- enum Lifecycle {
234- UNKNOWN = 0 ;
235- STARTING = 1 ;
236- STARTED = 2 ;
237- STOPPING = 3 ;
238- STOPPED = 4 ;
239- }
240- Lifecycle lifecycle = 1 ;
241- string error_message = 2 ;
242-
243- // This will be a FULL update with all workspaces and agents, so clients
244- // should replace their current peer state. Only the Upserted fields will
245- // be populated.
246- PeerUpdate peer_update = 3 ;
233+ enum Lifecycle {
234+ UNKNOWN = 0 ;
235+ STARTING = 1 ;
236+ STARTED = 2 ;
237+ STOPPING = 3 ;
238+ STOPPED = 4 ;
239+ }
240+ Lifecycle lifecycle = 1 ;
241+ string error_message = 2 ;
242+
243+ // This will be a FULL update with all workspaces and agents, so clients
244+ // should replace their current peer state. Only the Upserted fields will
245+ // be populated.
246+ PeerUpdate peer_update = 3 ;
247247}
0 commit comments