syntax = "proto3"; package protocol; option optimize_for = SPEED; option go_package = "go.miragespace.co/specter/spec/protocol"; import "spec/proto/node.proto"; import "spec/proto/pow.proto"; import "google/protobuf/descriptor.proto"; service TunnelService { rpc MintDelegation(MintDelegationRequest) returns (MintDelegationResponse); rpc ListDelegations(ListDelegationsRequest) returns (ListDelegationsResponse); rpc RevokeDelegation(RevokeDelegationRequest) returns (RevokeDelegationResponse); rpc Ping(ClientPingRequest) returns (ClientPingResponse); rpc RegisterIdentity(RegisterIdentityRequest) returns (RegisterIdentityResponse); rpc GetNodes(GetNodesRequest) returns (GetNodesResponse); rpc GenerateHostname(GenerateHostnameRequest) returns (GenerateHostnameResponse); rpc RegisteredHostnames(RegisteredHostnamesRequest) returns (RegisteredHostnamesResponse); rpc PublishTunnel(PublishTunnelRequest) returns (PublishTunnelResponse); rpc UnpublishTunnel(UnpublishTunnelRequest) returns (UnpublishTunnelResponse); rpc ReleaseTunnel(ReleaseTunnelRequest) returns (ReleaseTunnelResponse); rpc AcmeInstruction(InstructionRequest) returns (InstructionResponse); rpc AcmeValidate(ValidateRequest) returns (ValidateResponse); rpc OpenEphemeralSession(OpenEphemeralSessionRequest) returns (OpenSessionResponse); rpc OpenDelegatedSession(OpenDelegatedSessionRequest) returns (OpenSessionResponse); } extend google.protobuf.EnumValueOptions { string alpn_name = 54242; } message Link { enum ALPN { UNKNOWN = 0; SPECTER_CHORD = 1 [(alpn_name) = "specter-chord/1"]; SPECTER_CLIENT = 2 [(alpn_name) = "specter-client/1"]; HTTP2 = 9 [(alpn_name) = "h2"]; HTTP = 10 [(alpn_name) = "http/1.1"]; TCP = 11 [(alpn_name) = "specter-tcp/1"]; } ALPN alpn = 1; string hostname = 2; string remote = 3; } message CustomHostname { Node client_identity = 1; ClientToken client_token = 2; } message TunnelRoute { Node client_destination = 1; Node chord_destination = 2; Node tunnel_destination = 3; string hostname = 10; } message TunnelDestination { Node chord = 1; Node tunnel = 2; } enum TunnelStatusCode { STATUS_OK = 0; UNKNOWN_ERROR = 1; NO_DIRECT = 2; } message TunnelStatus { TunnelStatusCode status = 2; string error = 3; } message ClientToken { bytes token = 1; } message ClientPingRequest {} message ClientPingResponse { Node node = 1; string apex = 2; } message RegisterIdentityRequest { } message RegisterIdentityResponse { string apex = 2; } message GetNodesRequest {} message GetNodesResponse { repeated Node nodes = 1; } message GenerateHostnameRequest {} message GenerateHostnameResponse { string hostname = 1; } message RegisteredHostnamesRequest {} message RegisteredHostnamesResponse { repeated string hostnames = 1; } message PublishTunnelRequest { string hostname = 1; // servers are tun identities repeated Node servers = 2; } message PublishTunnelResponse { repeated Node published = 1; } message UnpublishTunnelRequest { string hostname = 1; } message UnpublishTunnelResponse {} message ReleaseTunnelRequest { string hostname = 1; } message ReleaseTunnelResponse {} message InstructionRequest { ProofOfWork proof = 1; string hostname = 2; } message InstructionResponse { string name = 1; string content = 2; } message ValidateRequest { ProofOfWork proof = 1; string hostname = 2; } message ValidateResponse { string apex = 1; } message DelegationRecord { uint32 version = 1; string id = 2; ClientToken owner = 3; string hostname = 4; int64 expires_at = 5; } message DelegationGrant { string id = 1; string hostname = 2; int64 expires_at = 3; bool incomplete = 4; } message MintDelegationRequest { string hostname = 1; int64 expires_at = 2; } message MintDelegationResponse { DelegationGrant grant = 1; string token = 2; } message ListDelegationsRequest {} message ListDelegationsResponse { repeated DelegationGrant grants = 1; } message RevokeDelegationRequest { string id = 1; } message RevokeDelegationResponse { bool revoked = 1; string index_error = 2; } message OpenEphemeralSessionRequest {} message OpenDelegatedSessionRequest { string token = 1; // Each attachment publishes exactly one of the three numbered routes. uint32 route_slot = 2; } message OpenSessionResponse { string hostname = 1; string apex = 2; string grant_id = 3; int64 expires_at = 4; Node node = 5; }