Interface TransportConnection
- All Superinterfaces:
AutoCloseable
A bidirectional, frame-oriented connection between two peers. Frames are opaque
byte arrays; the wire protocol (spec §9) layers CBOR envelopes on top.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the PeerID this connection's remote end proved it controls, when the transport authenticated the channel itself (spec §5.6): a TLS-backed transport that verified the peer's channel certificate reports the bound identity here, and the wire layer may then accept unsigned envelopes from exactly that peer on exactly this connection.voidclose()Closes the connection.voidRegisters the receiver for inbound frames.Returns the remote address in the transport's own format.default X509Certificate[]Returns the certificate chain the remote end presented in this connection's handshake, leaf first (SPEC §5.6, v0.1.13), whether or not it attested: a node in the enterprise-CA mode judges it again when its trust refreshes, and roots a peer revocation in the CA when the chain's leaf is revoked.voidsend(byte[] frame) Sends one frame.
-
Method Details
-
remoteAddress
String remoteAddress()Returns the remote address in the transport's own format. -
attestedPeer
Returns the PeerID this connection's remote end proved it controls, when the transport authenticated the channel itself (spec §5.6): a TLS-backed transport that verified the peer's channel certificate reports the bound identity here, and the wire layer may then accept unsigned envelopes from exactly that peer on exactly this connection. Transports without channel authentication return empty, and every frame stays fully signed.- Returns:
- the attested remote PeerID, or empty on unauthenticated channels
-
remoteChain
Returns the certificate chain the remote end presented in this connection's handshake, leaf first (SPEC §5.6, v0.1.13), whether or not it attested: a node in the enterprise-CA mode judges it again when its trust refreshes, and roots a peer revocation in the CA when the chain's leaf is revoked. Empty on transports without a handshake.- Returns:
- the presented chain, possibly empty
-
send
Sends one frame.- Parameters:
frame- the frame bytes- Throws:
IOException- if the connection has failed
-
onReceive
Registers the receiver for inbound frames. One receiver per connection; registering replaces the previous receiver.- Parameters:
receiver- invoked for each inbound frame
-
close
-