Add authorization_request.proto
This commit is contained in:
parent
7a77ec87d3
commit
6e13cef237
7 changed files with 147 additions and 254 deletions
|
|
@ -2,7 +2,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
tonic_prost_build::configure()
|
tonic_prost_build::configure()
|
||||||
.extern_path(".tripod_id", "::tripod_id::prost")
|
.extern_path(".tripod_id", "::tripod_id::prost")
|
||||||
.compile_protos(
|
.compile_protos(
|
||||||
&["proto/caretta_sync.proto", "proto/caretta_sync.common.proto"],
|
&[
|
||||||
|
"proto/caretta_sync.authorization_request.proto",
|
||||||
|
"proto/caretta_sync.peer_info.proto",
|
||||||
|
"proto/caretta_sync.common.proto"
|
||||||
|
],
|
||||||
&["proto", "../tripod-id/proto"]
|
&["proto", "../tripod-id/proto"]
|
||||||
)?;
|
)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
74
core/proto/caretta_sync.authorization_request.proto
Normal file
74
core/proto/caretta_sync.authorization_request.proto
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package caretta_sync;
|
||||||
|
|
||||||
|
import "caretta_sync.common.proto";
|
||||||
|
import "tripod_id.proto";
|
||||||
|
import "google/protobuf/timestamp.proto";
|
||||||
|
import "google/protobuf/duration.proto";
|
||||||
|
|
||||||
|
service AuthorizationRequest {
|
||||||
|
rpc Send(AuthorizationRequestSendRequest) returns (AuthorizationRequestSendResponse);
|
||||||
|
rpc Accept(AuthorizationRequestAcceptRequest) returns (AuthorizationRequestAcceptResponse);
|
||||||
|
rpc Reject(AuthorizationRequestRejectRequest) returns (AuthorizationRequestRejectResponse);
|
||||||
|
rpc Info(AuthorizationRequestInfoRequest) returns (AuthorizationRequestInfoResponse);
|
||||||
|
rpc InfoStream(stream AuthorizationRequestInfoStreamRequest) returns (stream AuthorizationRequestInfoStreamResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum AuthorizationRequestKind {
|
||||||
|
SENT = 0;
|
||||||
|
RECEIVED = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AuthorizationRequestSendRequest {
|
||||||
|
caretta_sync.common.PeerIdentifier peer = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AuthorizationRequestSendResponse {
|
||||||
|
string passcode = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AuthorizationRequestInfo {
|
||||||
|
tripod_id.Double id = 1;
|
||||||
|
caretta_sync.common.PublicKey public_key = 2;
|
||||||
|
google.protobuf.Timestamp created_at = 3;
|
||||||
|
AuthorizationRequestKind kind = 4;
|
||||||
|
string node_info = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message AuthorizationRequestIdentifier {
|
||||||
|
oneof identifier {
|
||||||
|
caretta_sync.common.Uuid uuid = 1;
|
||||||
|
tripod_id.Double id = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message AuthorizationRequestAcceptRequest {
|
||||||
|
AuthorizationRequestIdentifier authorization_request = 1;
|
||||||
|
string passcode = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AuthorizationRequestAcceptResponse {
|
||||||
|
caretta_sync.common.AuthorizedNodeInfo authorized_node_info = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AuthorizationRequestRejectRequest {
|
||||||
|
AuthorizationRequestIdentifier authorization_request = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AuthorizationRequestRejectResponse {
|
||||||
|
AuthorizationRequestInfo request_info = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AuthorizationRequestInfoRequest {
|
||||||
|
AuthorizationRequestIdentifier request = 1;
|
||||||
|
}
|
||||||
|
message AuthorizationRequestInfoResponse{
|
||||||
|
AuthorizationRequestInfo info = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AuthorizationRequestInfoStreamRequest {}
|
||||||
|
|
||||||
|
message AuthorizationRequestInfoStreamResponse {
|
||||||
|
AuthorizationRequestInfo request_info = 1;
|
||||||
|
}
|
||||||
|
|
@ -8,21 +8,27 @@ message PublicKey {
|
||||||
bytes key = 1;
|
bytes key = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message UuidMessage {
|
message Uuid {
|
||||||
uint64 first_half = 1;
|
uint64 first_half = 1;
|
||||||
uint64 second_half = 2;
|
uint64 second_half = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message PeerIdentifierMessage {
|
message PeerIdentifier {
|
||||||
oneof peer_identifier {
|
oneof peer_identifier {
|
||||||
tripod_id.Double id = 1;
|
tripod_id.Double id = 1;
|
||||||
PublicKey public_key = 2;
|
PublicKey public_key = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
message PeerIdentifierErrorMessage {
|
message AuthorizedNodeIdentifier {
|
||||||
oneof error {
|
oneof identifier {
|
||||||
string peer_id_not_found = 1;
|
tripod_id.Single id = 1;
|
||||||
string public_key_not_found = 2;
|
PublicKey public_key = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message AuthorizedNodeInfo {
|
||||||
|
tripod_id.Single id = 1;
|
||||||
|
PublicKey public_key = 2;
|
||||||
|
string note = 3;
|
||||||
|
}
|
||||||
56
core/proto/caretta_sync.peer_info.proto
Normal file
56
core/proto/caretta_sync.peer_info.proto
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
package caretta_sync;
|
||||||
|
|
||||||
|
import "caretta_sync.common.proto";
|
||||||
|
import "tripod_id.proto";
|
||||||
|
import "google/protobuf/timestamp.proto";
|
||||||
|
import "google/protobuf/duration.proto";
|
||||||
|
import "google/protobuf/empty.proto";
|
||||||
|
|
||||||
|
service Peer {
|
||||||
|
rpc Info(PeerInfoRequest) returns (PeerInfoResponse);
|
||||||
|
rpc InfoStream(stream PeerInfoStreamRequest) returns (stream PeerInfoStreamResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
message PeerInfoRequest {
|
||||||
|
caretta_sync.common.PeerIdentifier peer = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PeerInfoStreamRequest {}
|
||||||
|
|
||||||
|
message PeerInfoResponse {
|
||||||
|
PeerInfo peer_info = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PeerInfoStreamResponse {
|
||||||
|
PeerInfo peer_info = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PeerInfo {
|
||||||
|
tripod_id.Double id = 1;
|
||||||
|
caretta_sync.common.PublicKey public_key = 2;
|
||||||
|
string relay_url = 3;
|
||||||
|
repeated DirectAddrInfo addrs = 4;
|
||||||
|
string conn_type = 5;
|
||||||
|
google.protobuf.Duration latency = 6;
|
||||||
|
google.protobuf.Duration last_used = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DirectAddrInfo {
|
||||||
|
string 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 LastControl {
|
||||||
|
google.protobuf.Duration duration = 1;
|
||||||
|
string control_msg = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Source {
|
||||||
|
string source = 1;
|
||||||
|
google.protobuf.Duration duration = 2;
|
||||||
|
}
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
syntax = "proto3";
|
|
||||||
package caretta_sync;
|
|
||||||
import "google/protobuf/timestamp.proto";
|
|
||||||
import "google/protobuf/duration.proto";
|
|
||||||
|
|
||||||
service CarettaSync {
|
|
||||||
rpc RemoteInfo(RemoteInfoRequest) returns (RemoteInfoResponse);
|
|
||||||
rpc RemoteInfoIter(RemoteInfoIterRequest) returns (stream RemoteInfoResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
message NodeIdMessage {
|
|
||||||
bytes node_id = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message RemoteInfoRequest {
|
|
||||||
NodeIdMessage node_id = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message RemoteInfoIterRequest {}
|
|
||||||
|
|
||||||
message RemoteInfoResponse {
|
|
||||||
RemoteInfoMessage remote_info = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message RemoteInfoMessage {
|
|
||||||
NodeIdMessage node_id = 1;
|
|
||||||
string relay_url = 2;
|
|
||||||
repeated DirectAddrInfoMessage addrs = 3;
|
|
||||||
string conn_type = 4;
|
|
||||||
google.protobuf.Duration latency = 5;
|
|
||||||
google.protobuf.Duration last_used = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DirectAddrInfoMessage {
|
|
||||||
string addr = 1;
|
|
||||||
google.protobuf.Duration latency = 2;
|
|
||||||
LastControlMessage last_control = 3;
|
|
||||||
google.protobuf.Duration last_payload = 4;
|
|
||||||
google.protobuf.Duration last_alive = 5;
|
|
||||||
repeated SourceMessage sources = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
message LastControlMessage {
|
|
||||||
google.protobuf.Duration duration = 1;
|
|
||||||
string control_msg = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SourceMessage {
|
|
||||||
string source = 1;
|
|
||||||
google.protobuf.Duration duration = 2;
|
|
||||||
}
|
|
||||||
|
|
@ -1,97 +0,0 @@
|
||||||
syntax = "proto3";
|
|
||||||
package caretta_sync;
|
|
||||||
|
|
||||||
import "common.proto";
|
|
||||||
import "google/protobuf/timestamp.proto";
|
|
||||||
import "google/protobuf/duration.proto";
|
|
||||||
import "google/protobuf/empty.proto";
|
|
||||||
|
|
||||||
service PeerInfo {
|
|
||||||
rpc PeerInfo(PeerInfoRequest) returns (PeerInfoResponse);
|
|
||||||
rpc PeerInfoIter(PeerInfoIterRequest) returns (stream PeerInfoResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
message PeerInfoRequest {
|
|
||||||
caretta_sync.common.PeerIdentifierMessage peer = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message PeerInfoIterRequest {}
|
|
||||||
|
|
||||||
message PeerInfoResponse {
|
|
||||||
oneof result {
|
|
||||||
PeerInfoMessage remote_info = 1;
|
|
||||||
Error error = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message PeerInfoMessage {
|
|
||||||
DoubleIdMessage id = 1;
|
|
||||||
PublicKeyMessage public_key = 2;
|
|
||||||
string relay_url = 3;
|
|
||||||
repeated DirectAddrInfoMessage addrs = 4;
|
|
||||||
string conn_type = 5;
|
|
||||||
google.protobuf.Duration latency = 6;
|
|
||||||
google.protobuf.Duration last_used = 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DirectAddrInfoMessage {
|
|
||||||
string addr = 1;
|
|
||||||
google.protobuf.Duration latency = 2;
|
|
||||||
LastControlMessage last_control = 3;
|
|
||||||
google.protobuf.Duration last_payload = 4;
|
|
||||||
google.protobuf.Duration last_alive = 5;
|
|
||||||
repeated SourceMessage sources = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
message LastControlMessage {
|
|
||||||
google.protobuf.Duration duration = 1;
|
|
||||||
string control_msg = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SourceMessage {
|
|
||||||
string source = 1;
|
|
||||||
google.protobuf.Duration duration = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SendAuthorizationRequestRequest {
|
|
||||||
PeerMessage peer = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SendAuthorizationRequestResponse {
|
|
||||||
oneof result {
|
|
||||||
string passcode = 1;
|
|
||||||
Error error = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message AuthorizationRequestMessage {
|
|
||||||
oneof authorization_request {
|
|
||||||
UuidMessage uuid = 1;
|
|
||||||
DoubleIdMessage id = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message AcceptAuthorizationRequestRequest {
|
|
||||||
AuthorizationRequestMessage authorization_request = 1;
|
|
||||||
string passcode = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message AcceptAuthorizationRequestResponse {
|
|
||||||
oneof result {
|
|
||||||
google.protobuf.Empty ok = 1;
|
|
||||||
Error error = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message RejectAuthorizationRequestRequest {
|
|
||||||
AuthorizationRequestMessage authorization_request = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message RejectAuthorizationRequestResponse {
|
|
||||||
oneof result {
|
|
||||||
google.protobuf.Empty ok = 1;
|
|
||||||
Error error = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
||||||
syntax = "proto3";
|
|
||||||
package caretta_sync;
|
|
||||||
|
|
||||||
import "google/protobuf/timestamp.proto";
|
|
||||||
import "google/protobuf/duration.proto";
|
|
||||||
import "google/protobuf/empty.proto";
|
|
||||||
|
|
||||||
service CarettaSync {
|
|
||||||
rpc SendAuthorizationRequest(SendAuthorizationRequestRequest) returns (SendAuthorizationRequestResponse);
|
|
||||||
rpc AcceptAuthorizationRequest(AcceptAuthorizationRequestRequest) returns (AcceptAuthorizationRequestResponse);
|
|
||||||
rpc RejectAuthorizationRequest(RejectAuthorizationRequestRequest) returns (RejectAuthorizationRequestResponse);
|
|
||||||
rpc RemoteInfo(RemoteInfoRequest) returns (RemoteInfoResponse);
|
|
||||||
rpc RemoteInfoIter(RemoteInfoIterRequest) returns (stream RemoteInfoResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
message RemoteInfoRequest {
|
|
||||||
PeerMessage peer = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message RemoteInfoIterRequest {}
|
|
||||||
|
|
||||||
message RemoteInfoResponse {
|
|
||||||
oneof result {
|
|
||||||
RemoteInfoMessage remote_info = 1;
|
|
||||||
Error error = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message RemoteInfoMessage {
|
|
||||||
DoubleIdMessage id = 1;
|
|
||||||
PublicKeyMessage public_key = 2;
|
|
||||||
string relay_url = 3;
|
|
||||||
repeated DirectAddrInfoMessage addrs = 4;
|
|
||||||
string conn_type = 5;
|
|
||||||
google.protobuf.Duration latency = 6;
|
|
||||||
google.protobuf.Duration last_used = 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DirectAddrInfoMessage {
|
|
||||||
string addr = 1;
|
|
||||||
google.protobuf.Duration latency = 2;
|
|
||||||
LastControlMessage last_control = 3;
|
|
||||||
google.protobuf.Duration last_payload = 4;
|
|
||||||
google.protobuf.Duration last_alive = 5;
|
|
||||||
repeated SourceMessage sources = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
message LastControlMessage {
|
|
||||||
google.protobuf.Duration duration = 1;
|
|
||||||
string control_msg = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SourceMessage {
|
|
||||||
string source = 1;
|
|
||||||
google.protobuf.Duration duration = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SendAuthorizationRequestRequest {
|
|
||||||
PeerMessage peer = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SendAuthorizationRequestResponse {
|
|
||||||
oneof result {
|
|
||||||
string passcode = 1;
|
|
||||||
Error error = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message AuthorizationRequestMessage {
|
|
||||||
oneof authorization_request {
|
|
||||||
UuidMessage uuid = 1;
|
|
||||||
DoubleIdMessage id = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message AcceptAuthorizationRequestRequest {
|
|
||||||
AuthorizationRequestMessage authorization_request = 1;
|
|
||||||
string passcode = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message AcceptAuthorizationRequestResponse {
|
|
||||||
oneof result {
|
|
||||||
google.protobuf.Empty ok = 1;
|
|
||||||
Error error = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message RejectAuthorizationRequestRequest {
|
|
||||||
AuthorizationRequestMessage authorization_request = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message RejectAuthorizationRequestResponse {
|
|
||||||
oneof result {
|
|
||||||
google.protobuf.Empty ok = 1;
|
|
||||||
Error error = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Reference in a new issue