mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-02-22 15:39:54 -05:00
capnp ids
This commit is contained in:
parent
94d1598ce1
commit
662ed03d19
@ -3,14 +3,14 @@
|
|||||||
# IDs And Hashes
|
# IDs And Hashes
|
||||||
##############################
|
##############################
|
||||||
|
|
||||||
struct Curve25519PublicKey {
|
struct Key256 @0xdde44e3286f6a90d {
|
||||||
u0 @0 :UInt64;
|
u0 @0 :UInt64;
|
||||||
u1 @1 :UInt64;
|
u1 @1 :UInt64;
|
||||||
u2 @2 :UInt64;
|
u2 @2 :UInt64;
|
||||||
u3 @3 :UInt64;
|
u3 @3 :UInt64;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Ed25519Signature {
|
struct Signature512 @0x806749043a129c12 {
|
||||||
u0 @0 :UInt64;
|
u0 @0 :UInt64;
|
||||||
u1 @1 :UInt64;
|
u1 @1 :UInt64;
|
||||||
u2 @2 :UInt64;
|
u2 @2 :UInt64;
|
||||||
@ -21,79 +21,72 @@ struct Ed25519Signature {
|
|||||||
u7 @7 :UInt64;
|
u7 @7 :UInt64;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct XChaCha20Poly1305Nonce {
|
struct Nonce24 @0xb6260db25d8d7dfc {
|
||||||
u0 @0 :UInt64;
|
u0 @0 :UInt64;
|
||||||
u1 @1 :UInt64;
|
u1 @1 :UInt64;
|
||||||
u2 @2 :UInt64;
|
u2 @2 :UInt64;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct BLAKE3Hash {
|
using NodeID = Key256;
|
||||||
u0 @0 :UInt64;
|
using RoutePublicKey = Key256;
|
||||||
u1 @1 :UInt64;
|
using ValueID = Key256;
|
||||||
u2 @2 :UInt64;
|
using Nonce = Nonce24;
|
||||||
u3 @3 :UInt64;
|
using Signature = Signature512;
|
||||||
}
|
using BlockID = Key256;
|
||||||
|
|
||||||
using NodeID = Curve25519PublicKey;
|
|
||||||
using RoutePublicKey = Curve25519PublicKey;
|
|
||||||
using ValueID = Curve25519PublicKey;
|
|
||||||
using Nonce = XChaCha20Poly1305Nonce;
|
|
||||||
using Signature = Ed25519Signature;
|
|
||||||
using BlockID = BLAKE3Hash;
|
|
||||||
using TunnelID = UInt64;
|
using TunnelID = UInt64;
|
||||||
|
|
||||||
# Node Dial Info
|
# Node Dial Info
|
||||||
################################################################
|
################################################################
|
||||||
|
|
||||||
struct AddressIPV4 {
|
struct AddressIPV4 @0xdb8769881266a6a0 {
|
||||||
addr @0 :UInt32; # Address in big endian format
|
addr @0 :UInt32; # Address in big endian format
|
||||||
}
|
}
|
||||||
|
|
||||||
struct AddressIPV6 {
|
struct AddressIPV6 @0xb35d6e6011dc5c20 {
|
||||||
addr0 @0 :UInt32; # \
|
addr0 @0 :UInt32; # \
|
||||||
addr1 @1 :UInt32; # \ Address in big
|
addr1 @1 :UInt32; # \ Address in big
|
||||||
addr2 @2 :UInt32; # / endian format
|
addr2 @2 :UInt32; # / endian format
|
||||||
addr3 @3 :UInt32; # /
|
addr3 @3 :UInt32; # /
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Address {
|
struct Address @0x812706e9e57d108b {
|
||||||
union {
|
union {
|
||||||
ipv4 @0 :AddressIPV4;
|
ipv4 @0 :AddressIPV4;
|
||||||
ipv6 @1 :AddressIPV6;
|
ipv6 @1 :AddressIPV6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SocketAddress {
|
struct SocketAddress @0x82df4272f4dd3a62 {
|
||||||
address @0 :Address;
|
address @0 :Address;
|
||||||
port @1 :UInt16;
|
port @1 :UInt16;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ProtocolKind {
|
enum ProtocolKind @0xde0bf5787c067d5a {
|
||||||
udp @0;
|
udp @0;
|
||||||
ws @1;
|
ws @1;
|
||||||
wss @2;
|
wss @2;
|
||||||
tcp @3;
|
tcp @3;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DialInfoUDP {
|
struct DialInfoUDP @0xbb38a8b8b7024a7c {
|
||||||
socketAddress @0 :SocketAddress;
|
socketAddress @0 :SocketAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DialInfoTCP {
|
struct DialInfoTCP @0x9e0a9371b9a9f7fc {
|
||||||
socketAddress @0 :SocketAddress;
|
socketAddress @0 :SocketAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DialInfoWS {
|
struct DialInfoWS @0xd7795f7a92ab15b0 {
|
||||||
socketAddress @0 :SocketAddress;
|
socketAddress @0 :SocketAddress;
|
||||||
request @1 :Text;
|
request @1 :Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DialInfoWSS {
|
struct DialInfoWSS @0xe639faa41b7d7b04 {
|
||||||
socketAddress @0 :SocketAddress;
|
socketAddress @0 :SocketAddress;
|
||||||
request @1 :Text;
|
request @1 :Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DialInfo {
|
struct DialInfo @0xe1cd1c39fc2defdf {
|
||||||
union {
|
union {
|
||||||
udp @0 :DialInfoUDP;
|
udp @0 :DialInfoUDP;
|
||||||
tcp @1 :DialInfoTCP;
|
tcp @1 :DialInfoTCP;
|
||||||
@ -105,12 +98,12 @@ struct DialInfo {
|
|||||||
# Signals
|
# Signals
|
||||||
##############################
|
##############################
|
||||||
|
|
||||||
struct SignalInfoHolePunch {
|
struct SignalInfoHolePunch @0xeeb9ab6861890c9a {
|
||||||
receipt @0 :Data; # receipt to return with hole punch
|
receipt @0 :Data; # receipt to return with hole punch
|
||||||
peerInfo @1 :PeerInfo; # peer info of the signal sender for hole punch attempt
|
peerInfo @1 :PeerInfo; # peer info of the signal sender for hole punch attempt
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SignalInfoReverseConnect {
|
struct SignalInfoReverseConnect @0xd9ebd3bd0d46e013 {
|
||||||
receipt @0 :Data; # receipt to return with reverse connect
|
receipt @0 :Data; # receipt to return with reverse connect
|
||||||
peerInfo @1 :PeerInfo; # peer info of the signal sender for reverse connect attempt
|
peerInfo @1 :PeerInfo; # peer info of the signal sender for reverse connect attempt
|
||||||
}
|
}
|
||||||
@ -118,7 +111,7 @@ struct SignalInfoReverseConnect {
|
|||||||
# Private Routes
|
# Private Routes
|
||||||
##############################
|
##############################
|
||||||
|
|
||||||
struct RouteHopData {
|
struct RouteHopData @0x8ce231f9d1b7adf2 {
|
||||||
nonce @0 :Nonce; # nonce for encrypted blob
|
nonce @0 :Nonce; # nonce for encrypted blob
|
||||||
blob @1 :Data; # encrypted blob with ENC(nonce,DH(PK,SK))
|
blob @1 :Data; # encrypted blob with ENC(nonce,DH(PK,SK))
|
||||||
# if this is a safety route RouteHopData, there is a single byte tag appended to the end of the encrypted blob
|
# if this is a safety route RouteHopData, there is a single byte tag appended to the end of the encrypted blob
|
||||||
@ -128,7 +121,7 @@ struct RouteHopData {
|
|||||||
# if this is a private route RouteHopData, only can decode to RouteHop, no tag is appended
|
# if this is a private route RouteHopData, only can decode to RouteHop, no tag is appended
|
||||||
}
|
}
|
||||||
|
|
||||||
struct RouteHop {
|
struct RouteHop @0xf8f672d75cce0c3b {
|
||||||
node :union {
|
node :union {
|
||||||
nodeId @0 :NodeID; # node id only for established routes
|
nodeId @0 :NodeID; # node id only for established routes
|
||||||
peerInfo @1 :PeerInfo; # full peer info for this hop to establish the route
|
peerInfo @1 :PeerInfo; # full peer info for this hop to establish the route
|
||||||
@ -137,13 +130,13 @@ struct RouteHop {
|
|||||||
# if this is a safety route routehop, this field is not optional and must exist
|
# if this is a safety route routehop, this field is not optional and must exist
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PrivateRoute {
|
struct PrivateRoute @0x8a83fccb0851e776 {
|
||||||
publicKey @0 :RoutePublicKey; # private route public key (unique per private route)
|
publicKey @0 :RoutePublicKey; # private route public key (unique per private route)
|
||||||
hopCount @1 :UInt8; # Count of hops left in the private route (for timeout calculation purposes only)
|
hopCount @1 :UInt8; # Count of hops left in the private route (for timeout calculation purposes only)
|
||||||
firstHop @2 :RouteHop; # Optional: first hop in the private route, if empty, this is the last hop and payload should be decrypted and processed.
|
firstHop @2 :RouteHop; # Optional: first hop in the private route, if empty, this is the last hop and payload should be decrypted and processed.
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SafetyRoute {
|
struct SafetyRoute @0xf554734d07cb5d59 {
|
||||||
publicKey @0 :RoutePublicKey; # safety route public key (unique per safety route)
|
publicKey @0 :RoutePublicKey; # safety route public key (unique per safety route)
|
||||||
hopCount @1 :UInt8; # Count of hops left in the safety route (for timeout calculation purposes only)
|
hopCount @1 :UInt8; # Count of hops left in the safety route (for timeout calculation purposes only)
|
||||||
hops :union {
|
hops :union {
|
||||||
@ -157,7 +150,7 @@ struct SafetyRoute {
|
|||||||
|
|
||||||
using ValueSeqNum = UInt32; # sequence numbers for values
|
using ValueSeqNum = UInt32; # sequence numbers for values
|
||||||
|
|
||||||
struct ValueKey {
|
struct ValueKey @0xe64b0992c21a0736 {
|
||||||
publicKey @0 :ValueID; # the location of the value
|
publicKey @0 :ValueID; # the location of the value
|
||||||
subkey @1 :Text; # the name of the subkey (or empty if the whole key)
|
subkey @1 :Text; # the name of the subkey (or empty if the whole key)
|
||||||
}
|
}
|
||||||
@ -167,7 +160,7 @@ struct ValueKey {
|
|||||||
# seq @1 :ValueSeqNum; # the sequence number of the value subkey
|
# seq @1 :ValueSeqNum; # the sequence number of the value subkey
|
||||||
# }
|
# }
|
||||||
|
|
||||||
struct ValueData {
|
struct ValueData @0xb4b7416f169f2a3d {
|
||||||
data @0 :Data; # value or subvalue contents
|
data @0 :Data; # value or subvalue contents
|
||||||
seq @1 :ValueSeqNum; # sequence number of value
|
seq @1 :ValueSeqNum; # sequence number of value
|
||||||
}
|
}
|
||||||
@ -175,14 +168,14 @@ struct ValueData {
|
|||||||
# Operations
|
# Operations
|
||||||
##############################
|
##############################
|
||||||
|
|
||||||
enum NetworkClass {
|
enum NetworkClass @0x8cebfc2a6230717f {
|
||||||
invalid @0; # X = Invalid network class, network is not yet set up
|
invalid @0; # X = Invalid network class, network is not yet set up
|
||||||
inboundCapable @1; # I = Inbound capable without relay, may require signal
|
inboundCapable @1; # I = Inbound capable without relay, may require signal
|
||||||
outboundOnly @2; # O = Outbound only, inbound relay required except with reverse connect 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
|
webApp @3; # W = PWA, outbound relay is required in most cases
|
||||||
}
|
}
|
||||||
|
|
||||||
enum DialInfoClass {
|
enum DialInfoClass @0x880005edfdd38b1e {
|
||||||
direct @0; # D = Directly reachable with public IP and no firewall, with statically configured port
|
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
|
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
|
fullConeNAT @2; # F = Directly reachable device without portmap behind full-cone NAT
|
||||||
@ -191,12 +184,12 @@ enum DialInfoClass {
|
|||||||
portRestrictedNAT @5; # P = Device without portmap behind address-and-port restricted NAT
|
portRestrictedNAT @5; # P = Device without portmap behind address-and-port restricted NAT
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DialInfoDetail {
|
struct DialInfoDetail @0x96423aa1d67b74d8 {
|
||||||
dialInfo @0 :DialInfo;
|
dialInfo @0 :DialInfo;
|
||||||
class @1 :DialInfoClass;
|
class @1 :DialInfoClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PublicInternetNodeStatus {
|
struct PublicInternetNodeStatus @0x9c9d7f1f12eb088f {
|
||||||
willRoute @0 :Bool;
|
willRoute @0 :Bool;
|
||||||
willTunnel @1 :Bool;
|
willTunnel @1 :Bool;
|
||||||
willSignal @2 :Bool;
|
willSignal @2 :Bool;
|
||||||
@ -204,35 +197,35 @@ struct PublicInternetNodeStatus {
|
|||||||
willValidateDialInfo @4 :Bool;
|
willValidateDialInfo @4 :Bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct LocalNetworkNodeStatus {
|
struct LocalNetworkNodeStatus @0x957f5bfed2d0b5a5 {
|
||||||
willRelay @0 :Bool;
|
willRelay @0 :Bool;
|
||||||
willValidateDialInfo @1 :Bool;
|
willValidateDialInfo @1 :Bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct NodeStatus {
|
struct NodeStatus @0xd36b9e7a3bf3330d {
|
||||||
union {
|
union {
|
||||||
publicInternet @0 :PublicInternetNodeStatus;
|
publicInternet @0 :PublicInternetNodeStatus;
|
||||||
localNetwork @1 :LocalNetworkNodeStatus;
|
localNetwork @1 :LocalNetworkNodeStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ProtocolTypeSet {
|
struct ProtocolTypeSet @0x82f12f55a1b73326 {
|
||||||
udp @0 :Bool;
|
udp @0 :Bool;
|
||||||
tcp @1 :Bool;
|
tcp @1 :Bool;
|
||||||
ws @2 :Bool;
|
ws @2 :Bool;
|
||||||
wss @3 :Bool;
|
wss @3 :Bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct AddressTypeSet {
|
struct AddressTypeSet @0x9f52d5430d349e6b {
|
||||||
ipv4 @0 :Bool;
|
ipv4 @0 :Bool;
|
||||||
ipv6 @1 :Bool;
|
ipv6 @1 :Bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SenderInfo {
|
struct SenderInfo @0x8a4464fab4b1d101 {
|
||||||
socketAddress @0 :SocketAddress; # socket address that for the sending peer
|
socketAddress @0 :SocketAddress; # socket address that for the sending peer
|
||||||
}
|
}
|
||||||
|
|
||||||
struct NodeInfo {
|
struct NodeInfo @0xe125d847e3f9f419 {
|
||||||
networkClass @0 :NetworkClass; # network class of this node
|
networkClass @0 :NetworkClass; # network class of this node
|
||||||
outboundProtocols @1 :ProtocolTypeSet; # protocols that can go outbound
|
outboundProtocols @1 :ProtocolTypeSet; # protocols that can go outbound
|
||||||
addressTypes @2 :AddressTypeSet; # address types supported
|
addressTypes @2 :AddressTypeSet; # address types supported
|
||||||
@ -241,13 +234,13 @@ struct NodeInfo {
|
|||||||
dialInfoDetailList @5 :List(DialInfoDetail); # inbound dial info details for this node
|
dialInfoDetailList @5 :List(DialInfoDetail); # inbound dial info details for this node
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SignedDirectNodeInfo {
|
struct SignedDirectNodeInfo @0xe0e7ea3e893a3dd7 {
|
||||||
nodeInfo @0 :NodeInfo; # node info
|
nodeInfo @0 :NodeInfo; # node info
|
||||||
timestamp @1 :UInt64; # when signed node info was generated
|
timestamp @1 :UInt64; # when signed node info was generated
|
||||||
signature @2 :Signature; # signature
|
signature @2 :Signature; # signature
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SignedRelayedNodeInfo {
|
struct SignedRelayedNodeInfo @0xb39e8428ccd87cbb {
|
||||||
nodeInfo @0 :NodeInfo; # node info
|
nodeInfo @0 :NodeInfo; # node info
|
||||||
relayId @1 :NodeID; # node id for relay
|
relayId @1 :NodeID; # node id for relay
|
||||||
relayInfo @2 :SignedDirectNodeInfo; # signed node info for relay
|
relayInfo @2 :SignedDirectNodeInfo; # signed node info for relay
|
||||||
@ -255,202 +248,202 @@ struct SignedRelayedNodeInfo {
|
|||||||
signature @4 :Signature; # signature
|
signature @4 :Signature; # signature
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SignedNodeInfo {
|
struct SignedNodeInfo @0xd2478ce5f593406a {
|
||||||
union {
|
union {
|
||||||
direct @0 :SignedDirectNodeInfo; # node info for nodes reachable without a relay
|
direct @0 :SignedDirectNodeInfo; # node info for nodes reachable without a relay
|
||||||
relayed @1 :SignedRelayedNodeInfo; # node info for nodes requiring a relay
|
relayed @1 :SignedRelayedNodeInfo; # node info for nodes requiring a relay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PeerInfo {
|
struct PeerInfo @0xfe2d722d5d3c4bcb {
|
||||||
nodeId @0 :NodeID; # node id for 'closer peer'
|
nodeId @0 :NodeID; # node id for 'closer peer'
|
||||||
signedNodeInfo @1 :SignedNodeInfo; # signed node info for 'closer peer'
|
signedNodeInfo @1 :SignedNodeInfo; # signed node info for 'closer peer'
|
||||||
}
|
}
|
||||||
|
|
||||||
struct RoutedOperation {
|
struct RoutedOperation @0xcbcb8535b839e9dd {
|
||||||
version @0 :UInt8; # crypto version in use for the data
|
version @0 :UInt8; # crypto version in use for the data
|
||||||
signatures @1 :List(Signature); # signatures from nodes that have handled the private route
|
signatures @1 :List(Signature); # signatures from nodes that have handled the private route
|
||||||
nonce @2 :Nonce; # nonce Xmsg
|
nonce @2 :Nonce; # nonce Xmsg
|
||||||
data @3 :Data; # operation encrypted with ENC(Xmsg,DH(PKapr,SKbsr))
|
data @3 :Data; # operation encrypted with ENC(Xmsg,DH(PKapr,SKbsr))
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationStatusQ {
|
struct OperationStatusQ @0x865d80cea70d884a {
|
||||||
nodeStatus @0 :NodeStatus; # Optional: node status update about the statusq sender
|
nodeStatus @0 :NodeStatus; # Optional: node status update about the statusq sender
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationStatusA {
|
struct OperationStatusA @0xb306f407fa812a55 {
|
||||||
nodeStatus @0 :NodeStatus; # Optional: returned node status
|
nodeStatus @0 :NodeStatus; # Optional: returned node status
|
||||||
senderInfo @1 :SenderInfo; # Optional: info about StatusQ sender from the perspective of the replier
|
senderInfo @1 :SenderInfo; # Optional: info about StatusQ sender from the perspective of the replier
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationValidateDialInfo {
|
struct OperationValidateDialInfo @0xbc716ad7d5d060c8 {
|
||||||
dialInfo @0 :DialInfo; # dial info to use for the receipt
|
dialInfo @0 :DialInfo; # dial info to use for the receipt
|
||||||
receipt @1 :Data; # receipt to return to dial info to prove it is reachable
|
receipt @1 :Data; # receipt to return to dial info to prove it is reachable
|
||||||
redirect @2 :Bool; # request a different node do the validate
|
redirect @2 :Bool; # request a different node do the validate
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationReturnReceipt {
|
struct OperationReturnReceipt @0xeb0fb5b5a9160eeb {
|
||||||
receipt @0 :Data; # receipt being returned to its origin
|
receipt @0 :Data; # receipt being returned to its origin
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationFindNodeQ {
|
struct OperationFindNodeQ @0xfdef788fe9623bcd {
|
||||||
nodeId @0 :NodeID; # node id to locate
|
nodeId @0 :NodeID; # node id to locate
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationFindNodeA {
|
struct OperationFindNodeA @0xa84cf2fb40c77089 {
|
||||||
peers @0 :List(PeerInfo); # returned 'closer peer' information
|
peers @0 :List(PeerInfo); # returned 'closer peer' information
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationRoute {
|
struct OperationRoute @0x96741859ce6ac7dd {
|
||||||
safetyRoute @0 :SafetyRoute; # Where this should go
|
safetyRoute @0 :SafetyRoute; # Where this should go
|
||||||
operation @1 :RoutedOperation; # The operation to be routed
|
operation @1 :RoutedOperation; # The operation to be routed
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationNodeInfoUpdate {
|
struct OperationNodeInfoUpdate @0xc9647b32a48b66ce {
|
||||||
signedNodeInfo @0 :SignedNodeInfo; # Our signed node info
|
signedNodeInfo @0 :SignedNodeInfo; # Our signed node info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct OperationAppCallQ {
|
struct OperationAppCallQ @0xade67b9f09784507 {
|
||||||
message @0 :Data; # Opaque request to application
|
message @0 :Data; # Opaque request to application
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationAppCallA {
|
struct OperationAppCallA @0xf7c797ac85f214b8 {
|
||||||
message @0 :Data; # Opaque response from application
|
message @0 :Data; # Opaque response from application
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationAppMessage {
|
struct OperationAppMessage @0x9baf542d81b411f5 {
|
||||||
message @0 :Data; # Opaque message to application
|
message @0 :Data; # Opaque message to application
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationGetValueQ {
|
struct OperationGetValueQ @0xf88a5b6da5eda5d0 {
|
||||||
key @0 :ValueKey; # key for value to get
|
key @0 :ValueKey; # key for value to get
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationGetValueA {
|
struct OperationGetValueA @0xd896bb46f2e0249f {
|
||||||
union {
|
union {
|
||||||
data @0 :ValueData; # the value if successful
|
data @0 :ValueData; # the value if successful
|
||||||
peers @1 :List(PeerInfo); # returned 'closer peer' information if not successful
|
peers @1 :List(PeerInfo); # returned 'closer peer' information if not successful
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationSetValueQ {
|
struct OperationSetValueQ @0xbac06191ff8bdbc5 {
|
||||||
key @0 :ValueKey; # key for value to update
|
key @0 :ValueKey; # key for value to update
|
||||||
value @1 :ValueData; # value or subvalue contents (older or equal seq number gets dropped)
|
value @1 :ValueData; # value or subvalue contents (older or equal seq number gets dropped)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationSetValueA {
|
struct OperationSetValueA @0x9378d0732dc95be2 {
|
||||||
union {
|
union {
|
||||||
data @0 :ValueData; # the new value if successful, may be a different value than what was set if the seq number was lower or equal
|
data @0 :ValueData; # the new value if successful, may be a different value than what was set if the seq number was lower or equal
|
||||||
peers @1 :List(PeerInfo); # returned 'closer peer' information if not successful
|
peers @1 :List(PeerInfo); # returned 'closer peer' information if not successful
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationWatchValueQ {
|
struct OperationWatchValueQ @0xf9a5a6c547b9b228 {
|
||||||
key @0 :ValueKey; # key for value to watch
|
key @0 :ValueKey; # key for value to watch
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationWatchValueA {
|
struct OperationWatchValueA @0xa726cab7064ba893 {
|
||||||
expiration @0 :UInt64; # timestamp when this watch will expire in usec since epoch (0 if watch failed)
|
expiration @0 :UInt64; # timestamp when this watch will expire in usec since epoch (0 if watch failed)
|
||||||
peers @1 :List(PeerInfo); # returned list of other nodes to ask that could propagate watches
|
peers @1 :List(PeerInfo); # returned list of other nodes to ask that could propagate watches
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationValueChanged {
|
struct OperationValueChanged @0xd1c59ebdd8cc1bf6 {
|
||||||
key @0 :ValueKey; # key for value that changed
|
key @0 :ValueKey; # key for value that changed
|
||||||
value @1 :ValueData; # value or subvalue contents with sequence number
|
value @1 :ValueData; # value or subvalue contents with sequence number
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationSupplyBlockQ {
|
struct OperationSupplyBlockQ @0xadbf4c542d749971 {
|
||||||
blockId @0 :BlockID; # hash of the block we can supply
|
blockId @0 :BlockID; # hash of the block we can supply
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationSupplyBlockA {
|
struct OperationSupplyBlockA @0xf003822e83b5c0d7 {
|
||||||
union {
|
union {
|
||||||
expiration @0 :UInt64; # when the block supplier entry will need to be refreshed
|
expiration @0 :UInt64; # when the block supplier entry will need to be refreshed
|
||||||
peers @1 :List(PeerInfo); # returned 'closer peer' information if not successful
|
peers @1 :List(PeerInfo); # returned 'closer peer' information if not successful
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationFindBlockQ {
|
struct OperationFindBlockQ @0xaf4353ff004c7156 {
|
||||||
blockId @0 :BlockID; # hash of the block to locate
|
blockId @0 :BlockID; # hash of the block to locate
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationFindBlockA {
|
struct OperationFindBlockA @0xc51455bc4915465d {
|
||||||
data @0 :Data; # Optional: the actual block data if we have that block ourselves
|
data @0 :Data; # Optional: the actual block data if we have that block ourselves
|
||||||
# null if we don't have a block to return
|
# null if we don't have a block to return
|
||||||
suppliers @1 :List(PeerInfo); # returned list of suppliers if we have them
|
suppliers @1 :List(PeerInfo); # returned list of suppliers if we have them
|
||||||
peers @2 :List(PeerInfo); # returned 'closer peer' information
|
peers @2 :List(PeerInfo); # returned 'closer peer' information
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationSignal {
|
struct OperationSignal @0xd4f94f2a5d207e49 {
|
||||||
union {
|
union {
|
||||||
holePunch @0 :SignalInfoHolePunch;
|
holePunch @0 :SignalInfoHolePunch;
|
||||||
reverseConnect @1 :SignalInfoReverseConnect;
|
reverseConnect @1 :SignalInfoReverseConnect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TunnelEndpointMode {
|
enum TunnelEndpointMode @0xef06f4c29beb7458 {
|
||||||
raw @0; # raw tunnel
|
raw @0; # raw tunnel
|
||||||
turn @1; # turn tunnel
|
turn @1; # turn tunnel
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TunnelError {
|
enum TunnelError @0xb82c6bfb1ec38c7c {
|
||||||
badId @0; # Tunnel ID was rejected
|
badId @0; # Tunnel ID was rejected
|
||||||
noEndpoint @1; # Endpoint was unreachable
|
noEndpoint @1; # Endpoint was unreachable
|
||||||
rejectedMode @2; # Endpoint couldn't provide mode
|
rejectedMode @2; # Endpoint couldn't provide mode
|
||||||
noCapacity @3; # Endpoint is full
|
noCapacity @3; # Endpoint is full
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TunnelEndpoint {
|
struct TunnelEndpoint @0xc2602aa983cc337d {
|
||||||
mode @0 :TunnelEndpointMode; # what kind of endpoint this is
|
mode @0 :TunnelEndpointMode; # what kind of endpoint this is
|
||||||
description @1 :Text; # endpoint description (TODO)
|
description @1 :Text; # endpoint description (TODO)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FullTunnel {
|
struct FullTunnel @0x9821c3dc75373f63 {
|
||||||
id @0 :TunnelID; # tunnel id to use everywhere
|
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
|
timeout @1 :UInt64; # duration from last data when this expires if no data is sent or received
|
||||||
local @2 :TunnelEndpoint; # local endpoint
|
local @2 :TunnelEndpoint; # local endpoint
|
||||||
remote @3 :TunnelEndpoint; # remote endpoint
|
remote @3 :TunnelEndpoint; # remote endpoint
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PartialTunnel {
|
struct PartialTunnel @0x827a7ebc02be2fc8 {
|
||||||
id @0 :TunnelID; # tunnel id to use everywhere
|
id @0 :TunnelID; # tunnel id to use everywhere
|
||||||
timeout @1 :UInt64; # timestamp when this expires if not completed
|
timeout @1 :UInt64; # timestamp when this expires if not completed
|
||||||
local @2 :TunnelEndpoint; # local endpoint
|
local @2 :TunnelEndpoint; # local endpoint
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationStartTunnelQ {
|
struct OperationStartTunnelQ @0xa9c49afce44187af {
|
||||||
id @0 :TunnelID; # tunnel id to use everywhere
|
id @0 :TunnelID; # tunnel id to use everywhere
|
||||||
localMode @1 :TunnelEndpointMode; # what kind of local endpoint mode is being requested
|
localMode @1 :TunnelEndpointMode; # what kind of local endpoint mode is being requested
|
||||||
depth @2 :UInt8; # the number of nodes in the tunnel
|
depth @2 :UInt8; # the number of nodes in the tunnel
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationStartTunnelA {
|
struct OperationStartTunnelA @0x818162e4cc61bf1e {
|
||||||
union {
|
union {
|
||||||
partial @0 :PartialTunnel; # the first half of the tunnel
|
partial @0 :PartialTunnel; # the first half of the tunnel
|
||||||
error @1 :TunnelError; # if we didn't start the tunnel, why not
|
error @1 :TunnelError; # if we didn't start the tunnel, why not
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationCompleteTunnelQ {
|
struct OperationCompleteTunnelQ @0xe978594588eb950b {
|
||||||
id @0 :TunnelID; # tunnel id to use everywhere
|
id @0 :TunnelID; # tunnel id to use everywhere
|
||||||
localMode @1 :TunnelEndpointMode; # what kind of local endpoint mode is being requested
|
localMode @1 :TunnelEndpointMode; # what kind of local endpoint mode is being requested
|
||||||
depth @2 :UInt8; # the number of nodes in the tunnel
|
depth @2 :UInt8; # the number of nodes in the tunnel
|
||||||
endpoint @3 :TunnelEndpoint; # the remote endpoint to complete
|
endpoint @3 :TunnelEndpoint; # the remote endpoint to complete
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationCompleteTunnelA {
|
struct OperationCompleteTunnelA @0x84090791bb765f2a {
|
||||||
union {
|
union {
|
||||||
tunnel @0 :FullTunnel; # the tunnel description
|
tunnel @0 :FullTunnel; # the tunnel description
|
||||||
error @1 :TunnelError; # if we didn't complete the tunnel, why not
|
error @1 :TunnelError; # if we didn't complete the tunnel, why not
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationCancelTunnelQ {
|
struct OperationCancelTunnelQ @0xae2811ae0a003738 {
|
||||||
id @0 :TunnelID; # the tunnel id to cancel
|
id @0 :TunnelID; # the tunnel id to cancel
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperationCancelTunnelA {
|
struct OperationCancelTunnelA @0xbba23c992eff97bc {
|
||||||
union {
|
union {
|
||||||
tunnel @0 :TunnelID; # the tunnel id that was cancelled
|
tunnel @0 :TunnelID; # the tunnel id that was cancelled
|
||||||
error @1 :TunnelError; # if we couldn't cancel, why not
|
error @1 :TunnelError; # if we couldn't cancel, why not
|
||||||
@ -458,7 +451,7 @@ struct OperationCancelTunnelA {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Things that want an answer
|
# Things that want an answer
|
||||||
struct Question {
|
struct Question @0xd8510bc33492ef70 {
|
||||||
respondTo :union {
|
respondTo :union {
|
||||||
sender @0 :Void; # sender
|
sender @0 :Void; # sender
|
||||||
privateRoute @1 :PrivateRoute; # embedded private route to be used for reply
|
privateRoute @1 :PrivateRoute; # embedded private route to be used for reply
|
||||||
@ -484,7 +477,7 @@ struct Question {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Things that don't want an answer
|
# Things that don't want an answer
|
||||||
struct Statement {
|
struct Statement @0x990e20828f404ae1 {
|
||||||
detail :union {
|
detail :union {
|
||||||
# Direct operations
|
# Direct operations
|
||||||
validateDialInfo @0 :OperationValidateDialInfo;
|
validateDialInfo @0 :OperationValidateDialInfo;
|
||||||
@ -500,7 +493,7 @@ struct Statement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Things that are answers
|
# Things that are answers
|
||||||
struct Answer {
|
struct Answer @0xacacb8b6988c1058 {
|
||||||
detail :union {
|
detail :union {
|
||||||
# Direct operations
|
# Direct operations
|
||||||
statusA @0 :OperationStatusA;
|
statusA @0 :OperationStatusA;
|
||||||
@ -521,7 +514,7 @@ struct Answer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Operation {
|
struct Operation @0xbf2811c435403c3b {
|
||||||
opId @0 :UInt64; # Random RPC ID. Must be random to foil reply forgery attacks.
|
opId @0 :UInt64; # Random RPC ID. Must be random to foil reply forgery attacks.
|
||||||
senderNodeInfo @1 :SignedNodeInfo; # (optional) SignedNodeInfo for the sender to be cached by the receiver.
|
senderNodeInfo @1 :SignedNodeInfo; # (optional) SignedNodeInfo for the sender to be cached by the receiver.
|
||||||
kind :union {
|
kind :union {
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
use crate::crypto::*;
|
|
||||||
use crate::*;
|
|
||||||
use core::convert::TryInto;
|
|
||||||
use rpc_processor::*;
|
|
||||||
|
|
||||||
pub fn decode_block_id(public_key: &veilid_capnp::b_l_a_k_e3_hash::Reader) -> DHTKey {
|
|
||||||
let u0 = public_key.get_u0().to_be_bytes();
|
|
||||||
let u1 = public_key.get_u1().to_be_bytes();
|
|
||||||
let u2 = public_key.get_u2().to_be_bytes();
|
|
||||||
let u3 = public_key.get_u3().to_be_bytes();
|
|
||||||
|
|
||||||
let mut x: [u8; 32] = Default::default();
|
|
||||||
x[0..8].copy_from_slice(&u0);
|
|
||||||
x[8..16].copy_from_slice(&u1);
|
|
||||||
x[16..24].copy_from_slice(&u2);
|
|
||||||
x[24..32].copy_from_slice(&u3);
|
|
||||||
|
|
||||||
DHTKey::new(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn encode_block_id(
|
|
||||||
key: &DHTKey,
|
|
||||||
builder: &mut veilid_capnp::b_l_a_k_e3_hash::Builder,
|
|
||||||
) -> Result<(), RPCError> {
|
|
||||||
builder.set_u0(u64::from_be_bytes(
|
|
||||||
key.bytes[0..8].try_into().map_err(RPCError::internal)?,
|
|
||||||
));
|
|
||||||
builder.set_u1(u64::from_be_bytes(
|
|
||||||
key.bytes[8..16].try_into().map_err(RPCError::internal)?,
|
|
||||||
));
|
|
||||||
builder.set_u2(u64::from_be_bytes(
|
|
||||||
key.bytes[16..24].try_into().map_err(RPCError::internal)?,
|
|
||||||
));
|
|
||||||
builder.set_u3(u64::from_be_bytes(
|
|
||||||
key.bytes[24..32].try_into().map_err(RPCError::internal)?,
|
|
||||||
));
|
|
||||||
Ok(())
|
|
||||||
}
|
|
@ -3,7 +3,7 @@ use crate::*;
|
|||||||
use core::convert::TryInto;
|
use core::convert::TryInto;
|
||||||
use rpc_processor::*;
|
use rpc_processor::*;
|
||||||
|
|
||||||
pub fn decode_public_key(public_key: &veilid_capnp::curve25519_public_key::Reader) -> DHTKey {
|
pub fn decode_dht_key(public_key: &veilid_capnp::key256::Reader) -> DHTKey {
|
||||||
let u0 = public_key.get_u0().to_be_bytes();
|
let u0 = public_key.get_u0().to_be_bytes();
|
||||||
let u1 = public_key.get_u1().to_be_bytes();
|
let u1 = public_key.get_u1().to_be_bytes();
|
||||||
let u2 = public_key.get_u2().to_be_bytes();
|
let u2 = public_key.get_u2().to_be_bytes();
|
||||||
@ -18,9 +18,9 @@ pub fn decode_public_key(public_key: &veilid_capnp::curve25519_public_key::Reade
|
|||||||
DHTKey::new(x)
|
DHTKey::new(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn encode_public_key(
|
pub fn encode_dht_key(
|
||||||
key: &DHTKey,
|
key: &DHTKey,
|
||||||
builder: &mut veilid_capnp::curve25519_public_key::Builder,
|
builder: &mut veilid_capnp::key256::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
builder.set_u0(u64::from_be_bytes(
|
builder.set_u0(u64::from_be_bytes(
|
||||||
key.bytes[0..8]
|
key.bytes[0..8]
|
@ -1,10 +1,7 @@
|
|||||||
use crate::*;
|
use crate::*;
|
||||||
use rpc_processor::*;
|
use rpc_processor::*;
|
||||||
|
|
||||||
pub fn encode_signature(
|
pub fn encode_signature(sig: &DHTSignature, builder: &mut veilid_capnp::signature512::Builder) {
|
||||||
sig: &DHTSignature,
|
|
||||||
builder: &mut veilid_capnp::ed25519_signature::Builder,
|
|
||||||
) {
|
|
||||||
let sig = &sig.bytes;
|
let sig = &sig.bytes;
|
||||||
|
|
||||||
builder.set_u0(u64::from_be_bytes(
|
builder.set_u0(u64::from_be_bytes(
|
||||||
@ -33,7 +30,7 @@ pub fn encode_signature(
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn decode_signature(reader: &veilid_capnp::ed25519_signature::Reader) -> DHTSignature {
|
pub fn decode_signature(reader: &veilid_capnp::signature512::Reader) -> DHTSignature {
|
||||||
let u0 = reader.get_u0().to_be_bytes();
|
let u0 = reader.get_u0().to_be_bytes();
|
||||||
let u1 = reader.get_u1().to_be_bytes();
|
let u1 = reader.get_u1().to_be_bytes();
|
||||||
let u2 = reader.get_u2().to_be_bytes();
|
let u2 = reader.get_u2().to_be_bytes();
|
@ -1,6 +1,7 @@
|
|||||||
mod address;
|
mod address;
|
||||||
mod address_type_set;
|
mod address_type_set;
|
||||||
mod block_id;
|
mod dht_key;
|
||||||
|
mod dht_signature;
|
||||||
mod dial_info;
|
mod dial_info;
|
||||||
mod dial_info_class;
|
mod dial_info_class;
|
||||||
mod dial_info_detail;
|
mod dial_info_detail;
|
||||||
@ -12,10 +13,8 @@ mod operations;
|
|||||||
mod peer_info;
|
mod peer_info;
|
||||||
mod private_safety_route;
|
mod private_safety_route;
|
||||||
mod protocol_type_set;
|
mod protocol_type_set;
|
||||||
mod public_key;
|
|
||||||
mod sender_info;
|
mod sender_info;
|
||||||
mod signal_info;
|
mod signal_info;
|
||||||
mod signature;
|
|
||||||
mod signed_direct_node_info;
|
mod signed_direct_node_info;
|
||||||
mod signed_node_info;
|
mod signed_node_info;
|
||||||
mod signed_relayed_node_info;
|
mod signed_relayed_node_info;
|
||||||
@ -26,7 +25,8 @@ mod value_key;
|
|||||||
|
|
||||||
pub use address::*;
|
pub use address::*;
|
||||||
pub use address_type_set::*;
|
pub use address_type_set::*;
|
||||||
pub use block_id::*;
|
pub use dht_key::*;
|
||||||
|
pub use dht_signature::*;
|
||||||
pub use dial_info::*;
|
pub use dial_info::*;
|
||||||
pub use dial_info_class::*;
|
pub use dial_info_class::*;
|
||||||
pub use dial_info_detail::*;
|
pub use dial_info_detail::*;
|
||||||
@ -38,10 +38,8 @@ pub use operations::*;
|
|||||||
pub use peer_info::*;
|
pub use peer_info::*;
|
||||||
pub use private_safety_route::*;
|
pub use private_safety_route::*;
|
||||||
pub use protocol_type_set::*;
|
pub use protocol_type_set::*;
|
||||||
pub use public_key::*;
|
|
||||||
pub use sender_info::*;
|
pub use sender_info::*;
|
||||||
pub use signal_info::*;
|
pub use signal_info::*;
|
||||||
pub use signature::*;
|
|
||||||
pub use signed_direct_node_info::*;
|
pub use signed_direct_node_info::*;
|
||||||
pub use signed_node_info::*;
|
pub use signed_node_info::*;
|
||||||
pub use signed_relayed_node_info::*;
|
pub use signed_relayed_node_info::*;
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
use crate::*;
|
use crate::*;
|
||||||
use rpc_processor::*;
|
use rpc_processor::*;
|
||||||
|
|
||||||
pub fn encode_nonce(
|
pub fn encode_nonce(nonce: &Nonce, builder: &mut veilid_capnp::nonce24::Builder) {
|
||||||
nonce: &Nonce,
|
|
||||||
builder: &mut veilid_capnp::x_cha_cha20_poly1305_nonce::Builder,
|
|
||||||
) {
|
|
||||||
builder.set_u0(u64::from_be_bytes(
|
builder.set_u0(u64::from_be_bytes(
|
||||||
nonce[0..8].try_into().expect("slice with incorrect length"),
|
nonce[0..8].try_into().expect("slice with incorrect length"),
|
||||||
));
|
));
|
||||||
@ -20,7 +17,7 @@ pub fn encode_nonce(
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn decode_nonce(reader: &veilid_capnp::x_cha_cha20_poly1305_nonce::Reader) -> Nonce {
|
pub fn decode_nonce(reader: &veilid_capnp::nonce24::Reader) -> Nonce {
|
||||||
let u0 = reader.get_u0().to_be_bytes();
|
let u0 = reader.get_u0().to_be_bytes();
|
||||||
let u1 = reader.get_u1().to_be_bytes();
|
let u1 = reader.get_u1().to_be_bytes();
|
||||||
let u2 = reader.get_u2().to_be_bytes();
|
let u2 = reader.get_u2().to_be_bytes();
|
||||||
|
@ -11,7 +11,7 @@ impl RPCOperationFindBlockQ {
|
|||||||
reader: &veilid_capnp::operation_find_block_q::Reader,
|
reader: &veilid_capnp::operation_find_block_q::Reader,
|
||||||
) -> Result<RPCOperationFindBlockQ, RPCError> {
|
) -> Result<RPCOperationFindBlockQ, RPCError> {
|
||||||
let bi_reader = reader.get_block_id().map_err(RPCError::protocol)?;
|
let bi_reader = reader.get_block_id().map_err(RPCError::protocol)?;
|
||||||
let block_id = decode_block_id(&bi_reader);
|
let block_id = decode_dht_key(&bi_reader);
|
||||||
|
|
||||||
Ok(RPCOperationFindBlockQ { block_id })
|
Ok(RPCOperationFindBlockQ { block_id })
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@ impl RPCOperationFindBlockQ {
|
|||||||
builder: &mut veilid_capnp::operation_find_block_q::Builder,
|
builder: &mut veilid_capnp::operation_find_block_q::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let mut bi_builder = builder.reborrow().init_block_id();
|
let mut bi_builder = builder.reborrow().init_block_id();
|
||||||
encode_block_id(&self.block_id, &mut bi_builder)?;
|
encode_dht_key(&self.block_id, &mut bi_builder)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ impl RPCOperationFindNodeQ {
|
|||||||
reader: &veilid_capnp::operation_find_node_q::Reader,
|
reader: &veilid_capnp::operation_find_node_q::Reader,
|
||||||
) -> Result<RPCOperationFindNodeQ, RPCError> {
|
) -> Result<RPCOperationFindNodeQ, RPCError> {
|
||||||
let ni_reader = reader.get_node_id().map_err(RPCError::protocol)?;
|
let ni_reader = reader.get_node_id().map_err(RPCError::protocol)?;
|
||||||
let node_id = decode_public_key(&ni_reader);
|
let node_id = decode_dht_key(&ni_reader);
|
||||||
Ok(RPCOperationFindNodeQ { node_id })
|
Ok(RPCOperationFindNodeQ { node_id })
|
||||||
}
|
}
|
||||||
pub fn encode(
|
pub fn encode(
|
||||||
@ -19,7 +19,7 @@ impl RPCOperationFindNodeQ {
|
|||||||
builder: &mut veilid_capnp::operation_find_node_q::Builder,
|
builder: &mut veilid_capnp::operation_find_node_q::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let mut ni_builder = builder.reborrow().init_node_id();
|
let mut ni_builder = builder.reborrow().init_node_id();
|
||||||
encode_public_key(&self.node_id, &mut ni_builder)?;
|
encode_dht_key(&self.node_id, &mut ni_builder)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ impl RPCOperationSupplyBlockQ {
|
|||||||
reader: &veilid_capnp::operation_supply_block_q::Reader,
|
reader: &veilid_capnp::operation_supply_block_q::Reader,
|
||||||
) -> Result<RPCOperationSupplyBlockQ, RPCError> {
|
) -> Result<RPCOperationSupplyBlockQ, RPCError> {
|
||||||
let bi_reader = reader.get_block_id().map_err(RPCError::protocol)?;
|
let bi_reader = reader.get_block_id().map_err(RPCError::protocol)?;
|
||||||
let block_id = decode_block_id(&bi_reader);
|
let block_id = decode_dht_key(&bi_reader);
|
||||||
|
|
||||||
Ok(RPCOperationSupplyBlockQ { block_id })
|
Ok(RPCOperationSupplyBlockQ { block_id })
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@ impl RPCOperationSupplyBlockQ {
|
|||||||
builder: &mut veilid_capnp::operation_supply_block_q::Builder,
|
builder: &mut veilid_capnp::operation_supply_block_q::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let mut bi_builder = builder.reborrow().init_block_id();
|
let mut bi_builder = builder.reborrow().init_block_id();
|
||||||
encode_block_id(&self.block_id, &mut bi_builder)?;
|
encode_dht_key(&self.block_id, &mut bi_builder)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ pub fn encode_peer_info(
|
|||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
//
|
//
|
||||||
let mut nid_builder = builder.reborrow().init_node_id();
|
let mut nid_builder = builder.reborrow().init_node_id();
|
||||||
encode_public_key(&peer_info.node_id.key, &mut nid_builder)?;
|
encode_dht_key(&peer_info.node_id.key, &mut nid_builder)?;
|
||||||
let mut sni_builder = builder.reborrow().init_signed_node_info();
|
let mut sni_builder = builder.reborrow().init_signed_node_info();
|
||||||
encode_signed_node_info(&peer_info.signed_node_info, &mut sni_builder)?;
|
encode_signed_node_info(&peer_info.signed_node_info, &mut sni_builder)?;
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ pub fn decode_peer_info(reader: &veilid_capnp::peer_info::Reader) -> Result<Peer
|
|||||||
.reborrow()
|
.reborrow()
|
||||||
.get_signed_node_info()
|
.get_signed_node_info()
|
||||||
.map_err(RPCError::protocol)?;
|
.map_err(RPCError::protocol)?;
|
||||||
let node_id = NodeId::new(decode_public_key(&nid_reader));
|
let node_id = NodeId::new(decode_dht_key(&nid_reader));
|
||||||
let signed_node_info = decode_signed_node_info(&sni_reader, &node_id.key)?;
|
let signed_node_info = decode_signed_node_info(&sni_reader, &node_id.key)?;
|
||||||
|
|
||||||
Ok(PeerInfo {
|
Ok(PeerInfo {
|
||||||
|
@ -53,7 +53,7 @@ pub fn encode_route_hop(
|
|||||||
match &route_hop.node {
|
match &route_hop.node {
|
||||||
RouteNode::NodeId(ni) => {
|
RouteNode::NodeId(ni) => {
|
||||||
let mut ni_builder = node_builder.init_node_id();
|
let mut ni_builder = node_builder.init_node_id();
|
||||||
encode_public_key(&ni.key, &mut ni_builder)?;
|
encode_dht_key(&ni.key, &mut ni_builder)?;
|
||||||
}
|
}
|
||||||
RouteNode::PeerInfo(pi) => {
|
RouteNode::PeerInfo(pi) => {
|
||||||
let mut pi_builder = node_builder.init_peer_info();
|
let mut pi_builder = node_builder.init_peer_info();
|
||||||
@ -72,7 +72,7 @@ pub fn decode_route_hop(reader: &veilid_capnp::route_hop::Reader) -> Result<Rout
|
|||||||
let node = match n_reader.which().map_err(RPCError::protocol)? {
|
let node = match n_reader.which().map_err(RPCError::protocol)? {
|
||||||
veilid_capnp::route_hop::node::Which::NodeId(ni) => {
|
veilid_capnp::route_hop::node::Which::NodeId(ni) => {
|
||||||
let ni_reader = ni.map_err(RPCError::protocol)?;
|
let ni_reader = ni.map_err(RPCError::protocol)?;
|
||||||
RouteNode::NodeId(NodeId::new(decode_public_key(&ni_reader)))
|
RouteNode::NodeId(NodeId::new(decode_dht_key(&ni_reader)))
|
||||||
}
|
}
|
||||||
veilid_capnp::route_hop::node::Which::PeerInfo(pi) => {
|
veilid_capnp::route_hop::node::Which::PeerInfo(pi) => {
|
||||||
let pi_reader = pi.map_err(RPCError::protocol)?;
|
let pi_reader = pi.map_err(RPCError::protocol)?;
|
||||||
@ -101,7 +101,7 @@ pub fn encode_private_route(
|
|||||||
private_route: &PrivateRoute,
|
private_route: &PrivateRoute,
|
||||||
builder: &mut veilid_capnp::private_route::Builder,
|
builder: &mut veilid_capnp::private_route::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
encode_public_key(
|
encode_dht_key(
|
||||||
&private_route.public_key,
|
&private_route.public_key,
|
||||||
&mut builder.reborrow().init_public_key(),
|
&mut builder.reborrow().init_public_key(),
|
||||||
)?;
|
)?;
|
||||||
@ -117,9 +117,9 @@ pub fn encode_private_route(
|
|||||||
pub fn decode_private_route(
|
pub fn decode_private_route(
|
||||||
reader: &veilid_capnp::private_route::Reader,
|
reader: &veilid_capnp::private_route::Reader,
|
||||||
) -> Result<PrivateRoute, RPCError> {
|
) -> Result<PrivateRoute, RPCError> {
|
||||||
let public_key = decode_public_key(&reader.get_public_key().map_err(
|
let public_key = decode_dht_key(&reader.get_public_key().map_err(RPCError::map_protocol(
|
||||||
RPCError::map_protocol("invalid public key in private route"),
|
"invalid public key in private route",
|
||||||
)?);
|
))?);
|
||||||
let hop_count = reader.get_hop_count();
|
let hop_count = reader.get_hop_count();
|
||||||
let first_hop = if reader.has_first_hop() {
|
let first_hop = if reader.has_first_hop() {
|
||||||
let rh_reader = reader
|
let rh_reader = reader
|
||||||
@ -143,7 +143,7 @@ pub fn encode_safety_route(
|
|||||||
safety_route: &SafetyRoute,
|
safety_route: &SafetyRoute,
|
||||||
builder: &mut veilid_capnp::safety_route::Builder,
|
builder: &mut veilid_capnp::safety_route::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
encode_public_key(
|
encode_dht_key(
|
||||||
&safety_route.public_key,
|
&safety_route.public_key,
|
||||||
&mut builder.reborrow().init_public_key(),
|
&mut builder.reborrow().init_public_key(),
|
||||||
)?;
|
)?;
|
||||||
@ -166,7 +166,7 @@ pub fn encode_safety_route(
|
|||||||
pub fn decode_safety_route(
|
pub fn decode_safety_route(
|
||||||
reader: &veilid_capnp::safety_route::Reader,
|
reader: &veilid_capnp::safety_route::Reader,
|
||||||
) -> Result<SafetyRoute, RPCError> {
|
) -> Result<SafetyRoute, RPCError> {
|
||||||
let public_key = decode_public_key(
|
let public_key = decode_dht_key(
|
||||||
&reader
|
&reader
|
||||||
.get_public_key()
|
.get_public_key()
|
||||||
.map_err(RPCError::map_protocol("invalid public key in safety route"))?,
|
.map_err(RPCError::map_protocol("invalid public key in safety route"))?,
|
||||||
|
@ -10,7 +10,7 @@ pub fn encode_signed_relayed_node_info(
|
|||||||
encode_node_info(&signed_relayed_node_info.node_info, &mut ni_builder)?;
|
encode_node_info(&signed_relayed_node_info.node_info, &mut ni_builder)?;
|
||||||
|
|
||||||
let mut rid_builder = builder.reborrow().init_relay_id();
|
let mut rid_builder = builder.reborrow().init_relay_id();
|
||||||
encode_public_key(&signed_relayed_node_info.relay_id.key, &mut rid_builder)?;
|
encode_dht_key(&signed_relayed_node_info.relay_id.key, &mut rid_builder)?;
|
||||||
|
|
||||||
let mut ri_builder = builder.reborrow().init_relay_info();
|
let mut ri_builder = builder.reborrow().init_relay_info();
|
||||||
encode_signed_direct_node_info(&signed_relayed_node_info.relay_info, &mut ri_builder)?;
|
encode_signed_direct_node_info(&signed_relayed_node_info.relay_info, &mut ri_builder)?;
|
||||||
@ -39,7 +39,7 @@ pub fn decode_signed_relayed_node_info(
|
|||||||
.reborrow()
|
.reborrow()
|
||||||
.get_relay_id()
|
.get_relay_id()
|
||||||
.map_err(RPCError::protocol)?;
|
.map_err(RPCError::protocol)?;
|
||||||
let relay_id = decode_public_key(&rid_reader);
|
let relay_id = decode_dht_key(&rid_reader);
|
||||||
|
|
||||||
let ri_reader = reader
|
let ri_reader = reader
|
||||||
.reborrow()
|
.reborrow()
|
||||||
|
@ -6,7 +6,7 @@ pub fn encode_value_key(
|
|||||||
builder: &mut veilid_capnp::value_key::Builder,
|
builder: &mut veilid_capnp::value_key::Builder,
|
||||||
) -> Result<(), RPCError> {
|
) -> Result<(), RPCError> {
|
||||||
let mut pk_builder = builder.reborrow().init_public_key();
|
let mut pk_builder = builder.reborrow().init_public_key();
|
||||||
encode_public_key(&value_key.key, &mut pk_builder)?;
|
encode_dht_key(&value_key.key, &mut pk_builder)?;
|
||||||
if let Some(subkey) = &value_key.subkey {
|
if let Some(subkey) = &value_key.subkey {
|
||||||
builder.set_subkey(subkey);
|
builder.set_subkey(subkey);
|
||||||
}
|
}
|
||||||
@ -15,7 +15,7 @@ pub fn encode_value_key(
|
|||||||
|
|
||||||
pub fn decode_value_key(reader: &veilid_capnp::value_key::Reader) -> Result<ValueKey, RPCError> {
|
pub fn decode_value_key(reader: &veilid_capnp::value_key::Reader) -> Result<ValueKey, RPCError> {
|
||||||
let pk_reader = reader.get_public_key().map_err(RPCError::protocol)?;
|
let pk_reader = reader.get_public_key().map_err(RPCError::protocol)?;
|
||||||
let key = decode_public_key(&pk_reader);
|
let key = decode_dht_key(&pk_reader);
|
||||||
let subkey = if !reader.has_subkey() {
|
let subkey = if !reader.has_subkey() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
|
@ -2099,8 +2099,8 @@ impl SignedRelayedNodeInfo {
|
|||||||
|
|
||||||
// Add relay id to signature
|
// Add relay id to signature
|
||||||
let mut rid_msg = ::capnp::message::Builder::new_default();
|
let mut rid_msg = ::capnp::message::Builder::new_default();
|
||||||
let mut rid_builder = rid_msg.init_root::<veilid_capnp::curve25519_public_key::Builder>();
|
let mut rid_builder = rid_msg.init_root::<veilid_capnp::key256::Builder>();
|
||||||
encode_public_key(&relay_id.key, &mut rid_builder).map_err(VeilidAPIError::internal)?;
|
encode_dht_key(&relay_id.key, &mut rid_builder).map_err(VeilidAPIError::internal)?;
|
||||||
sig_bytes.append(&mut builder_to_vec(rid_msg).map_err(VeilidAPIError::internal)?);
|
sig_bytes.append(&mut builder_to_vec(rid_msg).map_err(VeilidAPIError::internal)?);
|
||||||
|
|
||||||
// Add relay info to signature
|
// Add relay info to signature
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
@0xd29582d26b2fb073;
|
@0xd29582d26b2fb073;
|
||||||
|
|
||||||
struct ApiResult {
|
struct ApiResult @0x8111724bdb812929 {
|
||||||
union {
|
union {
|
||||||
ok @0 :Text;
|
ok @0 :Text;
|
||||||
err @1 :Text;
|
err @1 :Text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Registration {}
|
interface Registration @0xdd45f30a7c22e391 {}
|
||||||
|
|
||||||
interface VeilidServer {
|
interface VeilidServer @0xcb2c699f14537f94 {
|
||||||
register @0 (veilidClient :VeilidClient) -> (registration :Registration, state :Text);
|
register @0 (veilidClient :VeilidClient) -> (registration :Registration, state :Text);
|
||||||
debug @1 (command :Text) -> (result :ApiResult);
|
debug @1 (command :Text) -> (result :ApiResult);
|
||||||
attach @2 () -> (result :ApiResult);
|
attach @2 () -> (result :ApiResult);
|
||||||
@ -20,6 +20,6 @@ interface VeilidServer {
|
|||||||
appCallReply @7 (id :UInt64, message :Data) -> (result :ApiResult);
|
appCallReply @7 (id :UInt64, message :Data) -> (result :ApiResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface VeilidClient {
|
interface VeilidClient @0xbfcea60fb2ba4736 {
|
||||||
update @0 (veilidUpdate :Text);
|
update @0 (veilidUpdate :Text);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user