veilid/veilid-core/proto/veilid.capnp

556 lines
25 KiB
Cap'n Proto
Raw Normal View History

2021-11-22 16:28:30 +00:00
@0x8ffce8033734ab02;
# IDs And Hashes
##############################
2022-11-13 03:20:31 +00:00
struct Key256 @0xdde44e3286f6a90d {
2021-11-22 16:28:30 +00:00
u0 @0 :UInt64;
u1 @1 :UInt64;
u2 @2 :UInt64;
u3 @3 :UInt64;
}
2022-11-13 03:20:31 +00:00
struct Signature512 @0x806749043a129c12 {
2021-11-22 16:28:30 +00:00
u0 @0 :UInt64;
u1 @1 :UInt64;
u2 @2 :UInt64;
u3 @3 :UInt64;
u4 @4 :UInt64;
u5 @5 :UInt64;
u6 @6 :UInt64;
u7 @7 :UInt64;
}
2022-11-13 03:20:31 +00:00
struct Nonce24 @0xb6260db25d8d7dfc {
2021-11-22 16:28:30 +00:00
u0 @0 :UInt64;
u1 @1 :UInt64;
u2 @2 :UInt64;
}
2023-05-29 19:24:57 +00:00
using PublicKey = Key256; # Node id / Hash / DHT key / Route id, etc
2023-02-08 02:44:50 +00:00
using Nonce = Nonce24; # One-time encryption nonce
using Signature = Signature512; # Signature block
using TunnelID = UInt64; # Id for tunnels
using CryptoKind = UInt32; # FOURCC code for cryptography type
using ValueSeqNum = UInt32; # sequence numbers for values
using Subkey = UInt32; # subkey index for dht
2023-02-08 21:50:07 +00:00
struct TypedKey @0xe2d567a9f1e61b29 {
2023-02-08 02:44:50 +00:00
kind @0 :CryptoKind;
key @1 :PublicKey;
}
2023-02-08 21:50:07 +00:00
struct TypedSignature @0x963170c7298e3884 {
2023-02-08 02:44:50 +00:00
kind @0 :CryptoKind;
signature @1 :Signature;
}
2021-11-22 16:28:30 +00:00
# Node Dial Info
################################################################
2022-11-13 03:20:31 +00:00
struct AddressIPV4 @0xdb8769881266a6a0 {
2021-11-22 16:28:30 +00:00
addr @0 :UInt32; # Address in big endian format
}
2022-11-13 03:20:31 +00:00
struct AddressIPV6 @0xb35d6e6011dc5c20 {
2021-11-22 16:28:30 +00:00
addr0 @0 :UInt32; # \
addr1 @1 :UInt32; # \ Address in big
addr2 @2 :UInt32; # / endian format
addr3 @3 :UInt32; # /
}
2022-11-13 03:20:31 +00:00
struct Address @0x812706e9e57d108b {
2021-11-22 16:28:30 +00:00
union {
ipv4 @0 :AddressIPV4;
ipv6 @1 :AddressIPV6;
}
}
2022-11-13 03:20:31 +00:00
struct SocketAddress @0x82df4272f4dd3a62 {
2021-12-21 00:12:30 +00:00
address @0 :Address;
port @1 :UInt16;
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
enum ProtocolKind @0xde0bf5787c067d5a {
2021-11-22 16:28:30 +00:00
udp @0;
ws @1;
wss @2;
tcp @3;
}
2022-11-13 03:20:31 +00:00
struct DialInfoUDP @0xbb38a8b8b7024a7c {
2021-12-21 00:12:30 +00:00
socketAddress @0 :SocketAddress;
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct DialInfoTCP @0x9e0a9371b9a9f7fc {
2021-12-21 00:12:30 +00:00
socketAddress @0 :SocketAddress;
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct DialInfoWS @0xd7795f7a92ab15b0 {
2021-12-21 00:12:30 +00:00
socketAddress @0 :SocketAddress;
request @1 :Text;
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct DialInfoWSS @0xe639faa41b7d7b04 {
2021-12-21 00:12:30 +00:00
socketAddress @0 :SocketAddress;
request @1 :Text;
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct DialInfo @0xe1cd1c39fc2defdf {
2021-11-22 16:28:30 +00:00
union {
udp @0 :DialInfoUDP;
tcp @1 :DialInfoTCP;
ws @2 :DialInfoWS;
wss @3 :DialInfoWSS;
}
}
2022-04-16 15:18:54 +00:00
# Signals
##############################
2022-11-13 03:20:31 +00:00
struct SignalInfoHolePunch @0xeeb9ab6861890c9a {
2022-05-28 20:11:50 +00:00
receipt @0 :Data; # receipt to return with hole punch
2022-04-17 17:28:39 +00:00
peerInfo @1 :PeerInfo; # peer info of the signal sender for hole punch attempt
2022-04-16 15:18:54 +00:00
}
2022-11-13 03:20:31 +00:00
struct SignalInfoReverseConnect @0xd9ebd3bd0d46e013 {
2022-05-28 20:11:50 +00:00
receipt @0 :Data; # receipt to return with reverse connect
2022-04-17 17:28:39 +00:00
peerInfo @1 :PeerInfo; # peer info of the signal sender for reverse connect attempt
2022-04-16 15:18:54 +00:00
}
2021-11-22 16:28:30 +00:00
# Private Routes
##############################
2022-11-13 03:20:31 +00:00
struct RouteHopData @0x8ce231f9d1b7adf2 {
2021-11-22 16:28:30 +00:00
nonce @0 :Nonce; # nonce for encrypted blob
blob @1 :Data; # encrypted blob with ENC(nonce,DH(PK,SK))
2022-10-30 02:15:50 +00:00
# if this is a safety route RouteHopData, there is a single byte tag appended to the end of the encrypted blob
# it can be one of:
# if more hops remain in this route: RouteHop (0 byte appended as tag)
# if end of safety route and starting private route: PrivateRoute (1 byte appended as tag)
# if this is a private route RouteHopData, only can decode to RouteHop, no tag is appended
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct RouteHop @0xf8f672d75cce0c3b {
2022-10-10 02:07:15 +00:00
node :union {
2023-02-15 23:18:08 +00:00
nodeId @0 :PublicKey; # node id key only for established routes (kind is the same as the pr or sr it is part of)
2022-10-10 02:07:15 +00:00
peerInfo @1 :PeerInfo; # full peer info for this hop to establish the route
}
2022-11-14 18:09:33 +00:00
nextHop @2 :RouteHopData; # optional: If this the end of a private route, this field will not exist
2022-10-30 02:15:50 +00:00
# if this is a safety route routehop, this field is not optional and must exist
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct PrivateRoute @0x8a83fccb0851e776 {
2023-02-08 02:44:50 +00:00
publicKey @0 :TypedKey; # private route public key (unique per private route)
2022-10-29 02:26:21 +00:00
hopCount @1 :UInt8; # Count of hops left in the private route (for timeout calculation purposes only)
2022-11-14 18:09:33 +00:00
hops :union {
firstHop @2 :RouteHop; # first hop of a private route is unencrypted (hopcount > 0)
data @3 :RouteHopData; # private route has more hops (hopcount > 0 && hopcount < total_hopcount)
empty @4 :Void; # private route has ended (hopcount = 0)
}
2022-10-30 02:15:50 +00:00
}
2021-11-22 16:28:30 +00:00
2022-11-13 03:20:31 +00:00
struct SafetyRoute @0xf554734d07cb5d59 {
2023-02-08 02:44:50 +00:00
publicKey @0 :TypedKey; # safety route public key (unique per safety route)
2022-10-29 02:26:21 +00:00
hopCount @1 :UInt8; # Count of hops left in the safety route (for timeout calculation purposes only)
2021-11-22 16:28:30 +00:00
hops :union {
data @2 :RouteHopData; # safety route has more hops
private @3 :PrivateRoute; # safety route has ended and private route follows
}
}
# Operations
##############################
2022-11-13 03:20:31 +00:00
enum NetworkClass @0x8cebfc2a6230717f {
2022-11-09 22:11:35 +00:00
invalid @0; # X = Invalid network class, network is not yet set up
inboundCapable @1; # I = Inbound capable without relay, may require signal
outboundOnly @2; # O = Outbound only, inbound relay required except with reverse connect signal
webApp @3; # W = PWA, outbound relay is required in most cases
}
2022-11-13 03:20:31 +00:00
enum DialInfoClass @0x880005edfdd38b1e {
direct @0; # D = Directly reachable with public IP and no firewall, with statically configured port
mapped @1; # M = Directly reachable with via portmap behind any NAT or firewalled with dynamically negotiated port
fullConeNAT @2; # F = Directly reachable device without portmap behind full-cone NAT
blocked @3; # B = Inbound blocked at firewall but may hole punch with public address
addressRestrictedNAT @4; # A = Device without portmap behind address-only restricted NAT
portRestrictedNAT @5; # P = Device without portmap behind address-and-port restricted NAT
}
2022-12-19 22:35:46 +00:00
enum Sequencing @0xb6735890f7818a1c {
2022-12-19 20:40:41 +00:00
noPreference @0;
preferOrdered @1;
ensureOrdered @2;
}
2022-11-13 03:20:31 +00:00
struct DialInfoDetail @0x96423aa1d67b74d8 {
2022-04-25 00:16:13 +00:00
dialInfo @0 :DialInfo;
class @1 :DialInfoClass;
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct PublicInternetNodeStatus @0x9c9d7f1f12eb088f {
2022-04-08 14:17:09 +00:00
willRoute @0 :Bool;
willTunnel @1 :Bool;
willSignal @2 :Bool;
willRelay @3 :Bool;
willValidateDialInfo @4 :Bool;
}
2022-11-13 03:20:31 +00:00
struct LocalNetworkNodeStatus @0x957f5bfed2d0b5a5 {
2022-09-03 17:57:25 +00:00
willRelay @0 :Bool;
willValidateDialInfo @1 :Bool;
}
2022-11-13 03:20:31 +00:00
struct NodeStatus @0xd36b9e7a3bf3330d {
2022-09-03 17:57:25 +00:00
union {
publicInternet @0 :PublicInternetNodeStatus;
localNetwork @1 :LocalNetworkNodeStatus;
}
}
2022-11-13 03:20:31 +00:00
struct ProtocolTypeSet @0x82f12f55a1b73326 {
2022-04-16 15:18:54 +00:00
udp @0 :Bool;
tcp @1 :Bool;
ws @2 :Bool;
wss @3 :Bool;
}
2022-11-13 03:20:31 +00:00
struct AddressTypeSet @0x9f52d5430d349e6b {
2022-08-02 01:06:31 +00:00
ipv4 @0 :Bool;
ipv6 @1 :Bool;
}
2022-11-13 03:20:31 +00:00
struct SenderInfo @0x8a4464fab4b1d101 {
2022-11-09 22:11:35 +00:00
socketAddress @0 :SocketAddress; # socket address that for the sending peer
}
2022-11-13 03:20:31 +00:00
struct NodeInfo @0xe125d847e3f9f419 {
2022-04-08 14:17:09 +00:00
networkClass @0 :NetworkClass; # network class of this node
2022-09-01 01:41:48 +00:00
outboundProtocols @1 :ProtocolTypeSet; # protocols that can go outbound
2022-08-02 01:06:31 +00:00
addressTypes @2 :AddressTypeSet; # address types supported
2023-02-11 20:54:55 +00:00
envelopeSupport @3 :List(UInt8); # supported rpc envelope/receipt versions
cryptoSupport @4 :List(CryptoKind); # cryptography systems supported
2022-08-02 01:06:31 +00:00
dialInfoDetailList @5 :List(DialInfoDetail); # inbound dial info details for this node
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct SignedDirectNodeInfo @0xe0e7ea3e893a3dd7 {
2022-05-11 01:49:42 +00:00
nodeInfo @0 :NodeInfo; # node info
2022-11-09 22:11:35 +00:00
timestamp @1 :UInt64; # when signed node info was generated
2023-02-08 02:44:50 +00:00
signatures @2 :List(TypedSignature); # signatures
2022-05-11 01:49:42 +00:00
}
2022-11-13 03:20:31 +00:00
struct SignedRelayedNodeInfo @0xb39e8428ccd87cbb {
2022-11-09 22:11:35 +00:00
nodeInfo @0 :NodeInfo; # node info
2023-02-08 21:50:07 +00:00
relayIds @1 :List(TypedKey); # node ids for relay
2022-11-09 22:11:35 +00:00
relayInfo @2 :SignedDirectNodeInfo; # signed node info for relay
timestamp @3 :UInt64; # when signed node info was generated
2023-02-08 02:44:50 +00:00
signatures @4 :List(TypedSignature); # signatures
2022-11-09 22:11:35 +00:00
}
2022-11-13 03:20:31 +00:00
struct SignedNodeInfo @0xd2478ce5f593406a {
2022-11-09 22:11:35 +00:00
union {
direct @0 :SignedDirectNodeInfo; # node info for nodes reachable without a relay
relayed @1 :SignedRelayedNodeInfo; # node info for nodes requiring a relay
}
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct PeerInfo @0xfe2d722d5d3c4bcb {
2023-02-08 02:44:50 +00:00
nodeIds @0 :List(TypedKey); # node ids for 'closer peer'
2022-09-03 17:57:25 +00:00
signedNodeInfo @1 :SignedNodeInfo; # signed node info for 'closer peer'
}
2022-11-13 03:20:31 +00:00
struct RoutedOperation @0xcbcb8535b839e9dd {
2023-02-08 02:44:50 +00:00
sequencing @0 :Sequencing; # sequencing preference to use to pass the message along
2023-02-26 23:11:10 +00:00
signatures @1 :List(Signature); # signatures from nodes that have handled the private route
2023-02-08 02:44:50 +00:00
nonce @2 :Nonce; # nonce Xmsg
data @3 :Data; # operation encrypted with ENC(Xmsg,DH(PKapr,SKbsr))
2022-09-03 17:57:25 +00:00
}
2022-11-13 03:20:31 +00:00
struct OperationStatusQ @0x865d80cea70d884a {
2022-11-02 19:36:01 +00:00
nodeStatus @0 :NodeStatus; # Optional: node status update about the statusq sender
2022-09-03 17:57:25 +00:00
}
2022-11-13 03:20:31 +00:00
struct OperationStatusA @0xb306f407fa812a55 {
2022-11-02 19:36:01 +00:00
nodeStatus @0 :NodeStatus; # Optional: returned node status
senderInfo @1 :SenderInfo; # Optional: info about StatusQ sender from the perspective of the replier
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct OperationValidateDialInfo @0xbc716ad7d5d060c8 {
2021-11-22 16:28:30 +00:00
dialInfo @0 :DialInfo; # dial info to use for the receipt
2022-05-28 20:11:50 +00:00
receipt @1 :Data; # receipt to return to dial info to prove it is reachable
redirect @2 :Bool; # request a different node do the validate
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct OperationReturnReceipt @0xeb0fb5b5a9160eeb {
2022-05-28 20:11:50 +00:00
receipt @0 :Data; # receipt being returned to its origin
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct OperationFindNodeQ @0xfdef788fe9623bcd {
2023-02-21 01:37:52 +00:00
nodeId @0 :TypedKey; # node id to locate
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct OperationFindNodeA @0xa84cf2fb40c77089 {
2021-11-22 16:28:30 +00:00
peers @0 :List(PeerInfo); # returned 'closer peer' information
}
2022-11-13 03:20:31 +00:00
struct OperationRoute @0x96741859ce6ac7dd {
2023-02-08 02:44:50 +00:00
safetyRoute @0 :SafetyRoute; # where this should go
operation @1 :RoutedOperation; # the operation to be routed
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct OperationAppCallQ @0xade67b9f09784507 {
2023-02-08 02:44:50 +00:00
message @0 :Data; # opaque request to application
}
2022-11-13 03:20:31 +00:00
struct OperationAppCallA @0xf7c797ac85f214b8 {
2023-02-08 02:44:50 +00:00
message @0 :Data; # opaque response from application
}
2022-11-13 03:20:31 +00:00
struct OperationAppMessage @0x9baf542d81b411f5 {
2023-02-08 02:44:50 +00:00
message @0 :Data; # opaque message to application
}
2023-05-29 19:24:57 +00:00
struct SubkeyRange @0xf592dac0a4d0171c {
2023-02-08 21:50:07 +00:00
start @0 :Subkey; # the start of a subkey range
end @1 :Subkey; # the end of a subkey range
}
2023-05-29 19:24:57 +00:00
struct SignedValueData @0xb4b7416f169f2a3d {
2023-02-08 21:50:07 +00:00
seq @0 :ValueSeqNum; # sequence number of value
2023-05-29 19:24:57 +00:00
data @1 :Data; # value or subvalue contents
writer @2 :PublicKey; # the public key of the writer
signature @3 :Signature; # signature of data at this subkey, using the writer key (which may be the same as the owner key)
# signature covers:
# * ownerKey
# * subkey
# * sequence number
# * data
# signature does not need to cover schema because schema is validated upon every set
# so the data either fits, or it doesn't.
}
struct SignedValueDescriptor @0xe7911cd3f9e1b0e7 {
owner @0 :PublicKey; # the public key of the owner
schemaData @1 :Data; # the schema data
# Changing this after key creation is not supported as it would change the dht key
signature @2 :Signature; # Schema data is signed by ownerKey and is verified both by set and get operations
2023-02-08 21:50:07 +00:00
}
2023-05-29 19:24:57 +00:00
2022-11-13 03:20:31 +00:00
struct OperationGetValueQ @0xf88a5b6da5eda5d0 {
2023-05-29 19:24:57 +00:00
key @0 :TypedKey; # DHT Key = Hash(ownerKeyKind) of: [ ownerKeyValue, schema ]
subkey @1 :Subkey; # the index of the subkey
wantDescriptor @2 :Bool; # whether or not to include the descriptor for the key
2021-11-22 16:28:30 +00:00
}
2023-05-29 19:24:57 +00:00
2022-11-13 03:20:31 +00:00
struct OperationGetValueA @0xd896bb46f2e0249f {
2023-05-29 19:24:57 +00:00
value @0 :SignedValueData; # optional: the value if successful, or if unset, no value returned
peers @1 :List(PeerInfo); # returned 'closer peer' information on either success or failure
descriptor @2 :SignedValueDescriptor; # optional: the descriptor if requested if the value is also returned
2021-11-22 16:28:30 +00:00
}
2023-05-29 19:24:57 +00:00
struct OperationSetValueQ @0xbac06191ff8bdbc5 {
key @0 :TypedKey; # DHT Key = Hash(ownerKeyKind) of: [ ownerKeyValue, schema ]
subkey @1 :Subkey; # the index of the subkey
value @2 :SignedValueData; # value or subvalue contents (older or equal seq number gets dropped)
descriptor @3 :SignedValueDescriptor; # optional: the descriptor if needed
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct OperationSetValueA @0x9378d0732dc95be2 {
2023-05-29 19:24:57 +00:00
set @0 :Bool; # true if the set was close enough to be set
value @1 :SignedValueData; # optional: the current value at the key if the set seq number was lower or equal to what was there before
peers @2 :List(PeerInfo); # returned 'closer peer' information on either success or failure
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct OperationWatchValueQ @0xf9a5a6c547b9b228 {
2023-02-26 03:02:13 +00:00
key @0 :TypedKey; # key for value to watch
2023-05-29 19:24:57 +00:00
subkeys @1 :List(SubkeyRange); # subkey range to watch (up to 512 subranges), if empty, watch everything
2023-02-08 02:44:50 +00:00
expiration @2 :UInt64; # requested timestamp when this watch will expire in usec since epoch (can be return less, 0 for max)
2023-02-26 03:02:13 +00:00
count @3 :UInt32; # requested number of changes to watch for (0 = cancel, 1 = single shot, 2+ = counter, UINT32_MAX = continuous)
2023-05-29 19:24:57 +00:00
watcher @4 :PublicKey; # the watcher performing the watch, can be the owner or a schema member
signature @5 :Signature; # signature of the watcher, must be one of the schema members or the key owner. signature covers: key, subkeys, expiration, count
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct OperationWatchValueA @0xa726cab7064ba893 {
2021-11-22 16:28:30 +00:00
expiration @0 :UInt64; # timestamp when this watch will expire in usec since epoch (0 if watch failed)
2023-02-08 21:50:07 +00:00
peers @1 :List(PeerInfo); # returned list of other nodes to ask that could propagate watches
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct OperationValueChanged @0xd1c59ebdd8cc1bf6 {
2023-02-26 03:02:13 +00:00
key @0 :TypedKey; # key for value that changed
2023-02-08 21:50:07 +00:00
subkeys @1 :List(SubkeyRange); # subkey range that changed (up to 512 ranges at a time)
2023-02-08 02:44:50 +00:00
count @2 :UInt32; # remaining changes left (0 means watch has expired)
2023-05-29 19:24:57 +00:00
value @3 :SignedValueData; # first value that changed (the rest can be gotten with getvalue)
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct OperationSupplyBlockQ @0xadbf4c542d749971 {
2023-02-08 02:44:50 +00:00
blockId @0 :TypedKey; # hash of the block we can supply
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct OperationSupplyBlockA @0xf003822e83b5c0d7 {
2023-05-29 19:24:57 +00:00
expiration @0 :UInt64; # when the block supplier entry will need to be refreshed, or 0 if not successful
peers @1 :List(PeerInfo); # returned 'closer peer' information if not successful
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct OperationFindBlockQ @0xaf4353ff004c7156 {
2023-02-08 02:44:50 +00:00
blockId @0 :TypedKey; # hash of the block to locate
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct OperationFindBlockA @0xc51455bc4915465d {
2021-11-22 16:28:30 +00:00
data @0 :Data; # Optional: the actual block data if we have that block ourselves
# null if we don't have a block to return
suppliers @1 :List(PeerInfo); # returned list of suppliers if we have them
peers @2 :List(PeerInfo); # returned 'closer peer' information
}
2022-11-13 03:20:31 +00:00
struct OperationSignal @0xd4f94f2a5d207e49 {
2022-04-16 15:18:54 +00:00
union {
holePunch @0 :SignalInfoHolePunch;
reverseConnect @1 :SignalInfoReverseConnect;
}
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
enum TunnelEndpointMode @0xef06f4c29beb7458 {
2021-11-22 16:28:30 +00:00
raw @0; # raw tunnel
turn @1; # turn tunnel
}
2022-11-13 03:20:31 +00:00
enum TunnelError @0xb82c6bfb1ec38c7c {
2021-11-22 16:28:30 +00:00
badId @0; # Tunnel ID was rejected
noEndpoint @1; # Endpoint was unreachable
rejectedMode @2; # Endpoint couldn't provide mode
noCapacity @3; # Endpoint is full
}
2022-11-13 03:20:31 +00:00
struct TunnelEndpoint @0xc2602aa983cc337d {
2022-04-16 15:18:54 +00:00
mode @0 :TunnelEndpointMode; # what kind of endpoint this is
2022-07-04 03:20:30 +00:00
description @1 :Text; # endpoint description (TODO)
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct FullTunnel @0x9821c3dc75373f63 {
2021-11-22 16:28:30 +00:00
id @0 :TunnelID; # tunnel id to use everywhere
timeout @1 :UInt64; # duration from last data when this expires if no data is sent or received
local @2 :TunnelEndpoint; # local endpoint
remote @3 :TunnelEndpoint; # remote endpoint
}
2022-11-13 03:20:31 +00:00
struct PartialTunnel @0x827a7ebc02be2fc8 {
2021-11-22 16:28:30 +00:00
id @0 :TunnelID; # tunnel id to use everywhere
timeout @1 :UInt64; # timestamp when this expires if not completed
local @2 :TunnelEndpoint; # local endpoint
}
2022-11-13 03:20:31 +00:00
struct OperationStartTunnelQ @0xa9c49afce44187af {
2021-11-22 16:28:30 +00:00
id @0 :TunnelID; # tunnel id to use everywhere
localMode @1 :TunnelEndpointMode; # what kind of local endpoint mode is being requested
depth @2 :UInt8; # the number of nodes in the tunnel
}
2022-11-13 03:20:31 +00:00
struct OperationStartTunnelA @0x818162e4cc61bf1e {
2021-11-22 16:28:30 +00:00
union {
partial @0 :PartialTunnel; # the first half of the tunnel
error @1 :TunnelError; # if we didn't start the tunnel, why not
}
}
2022-11-13 03:20:31 +00:00
struct OperationCompleteTunnelQ @0xe978594588eb950b {
2021-11-22 16:28:30 +00:00
id @0 :TunnelID; # tunnel id to use everywhere
localMode @1 :TunnelEndpointMode; # what kind of local endpoint mode is being requested
depth @2 :UInt8; # the number of nodes in the tunnel
endpoint @3 :TunnelEndpoint; # the remote endpoint to complete
}
2022-11-13 03:20:31 +00:00
struct OperationCompleteTunnelA @0x84090791bb765f2a {
2021-11-22 16:28:30 +00:00
union {
tunnel @0 :FullTunnel; # the tunnel description
error @1 :TunnelError; # if we didn't complete the tunnel, why not
}
}
2022-11-13 03:20:31 +00:00
struct OperationCancelTunnelQ @0xae2811ae0a003738 {
2022-07-04 03:20:30 +00:00
id @0 :TunnelID; # the tunnel id to cancel
2021-11-22 16:28:30 +00:00
}
2022-11-13 03:20:31 +00:00
struct OperationCancelTunnelA @0xbba23c992eff97bc {
2021-11-22 16:28:30 +00:00
union {
tunnel @0 :TunnelID; # the tunnel id that was cancelled
error @1 :TunnelError; # if we couldn't cancel, why not
}
}
2022-07-04 03:20:30 +00:00
# Things that want an answer
2022-11-13 03:20:31 +00:00
struct Question @0xd8510bc33492ef70 {
2021-11-22 16:28:30 +00:00
respondTo :union {
2022-09-03 17:57:25 +00:00
sender @0 :Void; # sender
privateRoute @1 :PrivateRoute; # embedded private route to be used for reply
2022-07-04 03:20:30 +00:00
}
detail :union {
# Direct operations
2022-09-03 17:57:25 +00:00
statusQ @2 :OperationStatusQ;
findNodeQ @3 :OperationFindNodeQ;
2022-07-04 03:20:30 +00:00
# Routable operations
2022-12-08 17:48:01 +00:00
appCallQ @4 :OperationAppCallQ;
getValueQ @5 :OperationGetValueQ;
setValueQ @6 :OperationSetValueQ;
watchValueQ @7 :OperationWatchValueQ;
supplyBlockQ @8 :OperationSupplyBlockQ;
findBlockQ @9 :OperationFindBlockQ;
2022-07-04 03:20:30 +00:00
# Tunnel operations
startTunnelQ @10 :OperationStartTunnelQ;
completeTunnelQ @11 :OperationCompleteTunnelQ;
cancelTunnelQ @12 :OperationCancelTunnelQ;
2022-07-04 03:20:30 +00:00
}
}
2021-11-22 16:28:30 +00:00
2022-07-04 03:20:30 +00:00
# Things that don't want an answer
2022-11-13 03:20:31 +00:00
struct Statement @0x990e20828f404ae1 {
2021-11-22 16:28:30 +00:00
detail :union {
# Direct operations
2022-07-04 03:20:30 +00:00
validateDialInfo @0 :OperationValidateDialInfo;
route @1 :OperationRoute;
2021-11-22 16:28:30 +00:00
# Routable operations
2022-12-08 17:48:01 +00:00
signal @2 :OperationSignal;
returnReceipt @3 :OperationReturnReceipt;
appMessage @4 :OperationAppMessage;
valueChanged @5 :OperationValueChanged;
2022-07-04 03:20:30 +00:00
}
}
# Things that are answers
2022-11-13 03:20:31 +00:00
struct Answer @0xacacb8b6988c1058 {
2022-07-04 03:20:30 +00:00
detail :union {
# Direct operations
statusA @0 :OperationStatusA;
findNodeA @1 :OperationFindNodeA;
2021-11-22 16:28:30 +00:00
2022-07-04 03:20:30 +00:00
# Routable operations
2022-12-08 17:48:01 +00:00
appCallA @2 :OperationAppCallA;
getValueA @3 :OperationGetValueA;
setValueA @4 :OperationSetValueA;
watchValueA @5 :OperationWatchValueA;
supplyBlockA @6 :OperationSupplyBlockA;
findBlockA @7 :OperationFindBlockA;
2021-11-22 16:28:30 +00:00
# Tunnel operations
startTunnelA @8 :OperationStartTunnelA;
completeTunnelA @9 :OperationCompleteTunnelA;
cancelTunnelA @10 :OperationCancelTunnelA;
2022-07-04 03:20:30 +00:00
}
}
2022-11-13 03:20:31 +00:00
struct Operation @0xbf2811c435403c3b {
2022-07-04 03:20:30 +00:00
opId @0 :UInt64; # Random RPC ID. Must be random to foil reply forgery attacks.
2023-02-17 22:47:21 +00:00
senderPeerInfo @1 :PeerInfo; # (optional) PeerInfo for the sender to be cached by the receiver.
2022-12-08 15:24:33 +00:00
targetNodeInfoTs @2 :UInt64; # Timestamp the sender believes the target's node info to be at or zero if not sent
2022-07-04 03:20:30 +00:00
kind :union {
2022-12-08 15:24:33 +00:00
question @3 :Question;
statement @4 :Statement;
answer @5 :Answer;
2021-11-22 16:28:30 +00:00
}
}