Refactor protobuf
This commit is contained in:
parent
87d78e7605
commit
8650746d66
4 changed files with 74 additions and 64 deletions
|
|
@ -1,5 +1,5 @@
|
|||
syntax = "proto3";
|
||||
package caretta_sync.authorization_request;
|
||||
package caretta_sync;
|
||||
|
||||
import "caretta_sync.common.proto";
|
||||
import "caretta_sync.authorized_node.proto";
|
||||
|
|
@ -22,17 +22,17 @@ enum AuthorizationRequestKind {
|
|||
}
|
||||
|
||||
message AuthorizationRequestSendRequest {
|
||||
caretta_sync.remote_node.RemoteNodeIdentifier remote_node = 1;
|
||||
caretta_sync.RemoteNodeIdentifier remote_node = 1;
|
||||
}
|
||||
|
||||
message AuthorizationRequestSendResponse {
|
||||
caretta_sync.remote_node.RemoteNodeInfo remote_node_info = 1;
|
||||
caretta_sync.RemoteNodeInfo remote_node_info = 1;
|
||||
string passcode = 2;
|
||||
}
|
||||
|
||||
message AuthorizationRequestInfo {
|
||||
tripod_id.Double id = 1;
|
||||
caretta_sync.common.PublicKey public_key = 2;
|
||||
caretta_sync.PublicKey public_key = 2;
|
||||
google.protobuf.Timestamp created_at = 3;
|
||||
AuthorizationRequestKind kind = 4;
|
||||
string node_info = 5;
|
||||
|
|
@ -41,7 +41,7 @@ message AuthorizationRequestInfo {
|
|||
|
||||
message AuthorizationRequestIdentifier {
|
||||
oneof identifier {
|
||||
caretta_sync.common.Uuid uuid = 1;
|
||||
caretta_sync.Uuid uuid = 1;
|
||||
tripod_id.Double id = 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ message AuthorizationRequestAcceptRequest {
|
|||
}
|
||||
|
||||
message AuthorizationRequestAcceptResponse {
|
||||
caretta_sync.authorized_node.AuthorizedNodeInfo authorized_node_info = 1;
|
||||
caretta_sync.AuthorizedNodeInfo authorized_node_info = 1;
|
||||
}
|
||||
|
||||
message AuthorizationRequestRejectRequest {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ syntax = "proto3";
|
|||
|
||||
// The package contain service and messages about node already authorized.
|
||||
// The authorized node includes not only remote authorized peers but also local node itself.
|
||||
package caretta_sync.authorized_node;
|
||||
package caretta_sync;
|
||||
|
||||
import "tripod_id.proto";
|
||||
import "caretta_sync.remote_node.proto";
|
||||
|
|
@ -16,13 +16,13 @@ service AuthorizadNode {
|
|||
message AuthorizedNodeIdentifier {
|
||||
oneof identifier {
|
||||
tripod_id.Single id = 1;
|
||||
caretta_sync.common.PublicKey public_key = 2;
|
||||
caretta_sync.PublicKey public_key = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message AuthorizedNodeInfo {
|
||||
tripod_id.Single id = 1;
|
||||
caretta_sync.common.PublicKey public_key = 2;
|
||||
caretta_sync.PublicKey public_key = 2;
|
||||
string note = 3;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package caretta_sync.common;
|
||||
package caretta_sync;
|
||||
|
||||
message PublicKey {
|
||||
bytes key = 1;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
syntax = "proto3";
|
||||
package caretta_sync.remote_node;
|
||||
package caretta_sync;
|
||||
|
||||
import "caretta_sync.common.proto";
|
||||
import "tripod_id.proto";
|
||||
|
|
@ -15,7 +15,7 @@ service RemoteNode {
|
|||
message RemoteNodeIdentifier {
|
||||
oneof identifier {
|
||||
tripod_id.Double id = 1;
|
||||
caretta_sync.common.PublicKey public_key = 2;
|
||||
caretta_sync.PublicKey public_key = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -33,65 +33,75 @@ message RemoteNodeListResponse {
|
|||
RemoteNodeInfo remote_node_info = 1;
|
||||
}
|
||||
|
||||
message RemoteNodeInfo {
|
||||
tripod_id.Double id = 1;
|
||||
bool authorized = 2;
|
||||
caretta_sync.common.PublicKey public_key = 3;
|
||||
string relay_url = 4;
|
||||
repeated RemoteNodeDirectAddrInfo addrs = 5;
|
||||
RemoteNodeConnectionType conn_type = 6;
|
||||
google.protobuf.Duration latency = 7;
|
||||
google.protobuf.Duration last_used = 8;
|
||||
}
|
||||
|
||||
message RemoteNodeConnectionType {
|
||||
message RemoteNodeInfo {
|
||||
|
||||
// A messege of iroh::RemoteInfo.
|
||||
message RemoteInfo {
|
||||
message ConnectionType {
|
||||
message Mixed {
|
||||
caretta_sync.SocketAddr socket_addr = 1;
|
||||
caretta_sync.Url relay_url = 2;
|
||||
}
|
||||
oneof conn_type {
|
||||
caretta_sync.common.SocketAddr direct = 1;
|
||||
caretta_sync.common.Url relay = 2;
|
||||
RemoteNodeConnectionTypeMixed mixed = 3;
|
||||
caretta_sync.SocketAddr direct = 1;
|
||||
caretta_sync.Url relay = 2;
|
||||
Mixed mixed = 3;
|
||||
google.protobuf.Empty none = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message RemoteNodeConnectionTypeMixed {
|
||||
caretta_sync.common.SocketAddr socket_addr = 1;
|
||||
caretta_sync.common.Url relay_url = 2;
|
||||
}
|
||||
|
||||
message RemoteNodeRelayUrlInfo {
|
||||
caretta_sync.common.Url relay_url = 1;
|
||||
google.protobuf.Duration last_alive = 2;
|
||||
google.protobuf.Duration latency = 3;
|
||||
}
|
||||
|
||||
message RemoteNodeDirectAddrInfo {
|
||||
caretta_sync.common.SocketAddr addr = 1;
|
||||
google.protobuf.Duration latency = 2;
|
||||
RemoteNodeLastControl last_control = 3;
|
||||
google.protobuf.Duration last_payload = 4;
|
||||
google.protobuf.Duration last_alive = 5;
|
||||
repeated RemoteNodeSource sources = 6;
|
||||
}
|
||||
|
||||
message RemoteNodeLastControl {
|
||||
google.protobuf.Duration duration = 1;
|
||||
RemoteNodeControlMsg control_msg = 2;
|
||||
}
|
||||
|
||||
enum RemoteNodeControlMsg {
|
||||
}
|
||||
message DirectAddrInfo {
|
||||
message LastControl {
|
||||
enum ControlMsg {
|
||||
PING = 0;
|
||||
PONG = 1;
|
||||
CALL_ME_MAYBE = 2;
|
||||
}
|
||||
|
||||
message RemoteNodeSource {
|
||||
oneof source = {
|
||||
}
|
||||
google.protobuf.Duration duration = 1;
|
||||
ControlMsg control_msg = 2;
|
||||
}
|
||||
message Source {
|
||||
oneof source {
|
||||
google.protobuf.Empty saved = 1;
|
||||
google.protobuf.Empty udp = 2;
|
||||
google.protobuf.Empty Relay = 3;
|
||||
google.protobuf.Empty App = 4;
|
||||
string discovery = 5;
|
||||
string named_app = 6
|
||||
string named_app = 6;
|
||||
};
|
||||
google.protobuf.Duration duration = 7;
|
||||
}
|
||||
caretta_sync.SocketAddr addr = 1;
|
||||
google.protobuf.Duration latency = 2;
|
||||
LastControl last_control = 3;
|
||||
google.protobuf.Duration last_payload = 4;
|
||||
google.protobuf.Duration last_alive = 5;
|
||||
repeated Source sources = 6;
|
||||
}
|
||||
|
||||
message RelayUrlInfo {
|
||||
caretta_sync.Url relay_url = 1;
|
||||
google.protobuf.Duration last_alive = 2;
|
||||
google.protobuf.Duration latency = 3;
|
||||
}
|
||||
|
||||
bool authorized = 2;
|
||||
caretta_sync.PublicKey public_key = 3;
|
||||
RelayUrlInfo relay_url = 4;
|
||||
repeated DirectAddrInfo addrs = 5;
|
||||
ConnectionType conn_type = 6;
|
||||
google.protobuf.Duration latency = 7;
|
||||
google.protobuf.Duration last_used = 8;
|
||||
}
|
||||
tripod_id.Double public_id = 1;
|
||||
RemoteInfo remote_info = 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue