diff --git a/core/proto/caretta_sync.authorization_request.proto b/core/proto/caretta_sync.authorization_request.proto index dc6d85c..27b8db7 100644 --- a/core/proto/caretta_sync.authorization_request.proto +++ b/core/proto/caretta_sync.authorization_request.proto @@ -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 { diff --git a/core/proto/caretta_sync.authorized_node.proto b/core/proto/caretta_sync.authorized_node.proto index 0b01ec8..e06c5dd 100644 --- a/core/proto/caretta_sync.authorized_node.proto +++ b/core/proto/caretta_sync.authorized_node.proto @@ -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; } diff --git a/core/proto/caretta_sync.common.proto b/core/proto/caretta_sync.common.proto index bf758e8..920fe5b 100644 --- a/core/proto/caretta_sync.common.proto +++ b/core/proto/caretta_sync.common.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package caretta_sync.common; +package caretta_sync; message PublicKey { bytes key = 1; diff --git a/core/proto/caretta_sync.remote_node.proto b/core/proto/caretta_sync.remote_node.proto index 3e8c5fc..fbed5d7 100644 --- a/core/proto/caretta_sync.remote_node.proto +++ b/core/proto/caretta_sync.remote_node.proto @@ -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 { - oneof conn_type { - caretta_sync.common.SocketAddr direct = 1; - caretta_sync.common.Url relay = 2; - RemoteNodeConnectionTypeMixed mixed = 3; - google.protobuf.Empty none = 4; + // 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.SocketAddr direct = 1; + caretta_sync.Url relay = 2; + Mixed mixed = 3; + google.protobuf.Empty none = 4; + } + } + message DirectAddrInfo { + message LastControl { + enum ControlMsg { + PING = 0; + PONG = 1; + CALL_ME_MAYBE = 2; + } + 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; + }; + 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; } -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 { - PING = 0; - PONG = 1; - CALL_ME_MAYBE = 2; -} -message RemoteNodeSource { - 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 - }; - google.protobuf.Duration duration = 7; -} + + +