mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-15 18:35:47 +00:00
a78b759741
This patch implement a restful server without any auth.
usage:
```bash
# run easytier-web, which acts as an gateway and registry for all easytier-core
$> easytier-web
# run easytier-core and connect to easytier-web with a token
$> easytier-core --config-server udp://127.0.0.1:22020/fdsafdsa
# use restful api to list session
$> curl -H "Content-Type: application/json" -X GET 127.0.0.1:11211/api/v1/sessions
[{"token":"fdsafdsa","client_url":"udp://127.0.0.1:48915","machine_id":"de3f5b8f-0f2f-d9d0-fb30-a2ac8951d92f"}]%
# use restful api to run a network instance
$> curl -H "Content-Type: application/json" -X POST 127.0.0.1:11211/api/v1/network/de3f5b8f-0f2f-d9d0-fb30-a2ac8951d92f -d '{"config": "listeners = [\"udp://0.0.0.0:12344\"]"}'
# use restful api to get network instance info
$> curl -H "Content-Type: application/json" -X GET 127.0.0.1:11211/api/v1/network/de3f5b8f-0f2f-d9d0-fb30-a2ac8951d92f/65437e50-b286-4098-a624-74429f2cb839
```
35 lines
803 B
Protocol Buffer
35 lines
803 B
Protocol Buffer
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;
|
|
}
|
|
}
|