kcoap-transport
The seam between protocol code and the network. Its only dependency is kcoap-common, for the opt-in markers, which every module above it reaches through this one; no third-party library.
DatagramTransport(UDP, DTLS, multicast, non-IP links),ByteStreamConnection(TCP, TLS) andMessageConnection(WebSocket): the three shapes RFC 7252 and RFC 8323 define. The two connection shapes share the sealedConnection; aConnectoropens them for a peer and aConnectionListeneraccepts them.Endpoint: what the messaging layer matches and deduplicates by. Its variants are final classes whose equality is written out as the RFCs' matching rule, not data classes:Endpoint.Udp: an address and a port (RFC 7252 §5.3.2), the host kept and compared inIpLiteralform, so2001:DB8::1and2001:db8::1are one peer;Endpoint.TcpandEndpoint.WebSocket: the peer as RFC 8323 §8 names it, compared as RFC 7252 §6.6 compares URIs: hosts case-insensitively, a WebSocket URI without a port with its scheme's default, andcoaps+tcpapart fromcoap+tcpandwssapart fromwson the same host and port (usesTls);Endpoint.Opaque: link and address, compared exactly;Endpoint.Secure: the RFC 7252 §9.1 rule that DTLS messages match only within the same session and epoch.
EndpointMatchingTestandEndpointTestcheck each rule.PeerIdentityandSecurityMode: the channel-security identity handed to authorization.DatagramSecurity: where DTLS plugs in, as a decorator of anyDatagramTransport, with the contract an implementation must meet. It is@ExperimentalKcoapApiuntil kcoap-dtls implements it. TLS forcoaps+tcpandcoaps+wsis the job of each runtime's connector and listener (../docs/adr/0003-tls-in-connectors.md), so there is no stream counterpart.CoapScheme:coap,coaps,coap+tcp,coaps+tcp,coap+ws,coaps+ws, with the ALPN id and the WebSocket subprotocol and path of RFC 8323.Endpoint.Tcprecords TLS;Endpoint.WebSocket.ofbuilds thews/wssURI of an authority.IpLiteral: the canonical text of IP addresses inEndpoint.UdpandEndpoint.Tcp(dotted IPv4, RFC 5952 IPv6), so endpoints from transports and from URIs compare equal. It parses the IP literals of RFC 3986 §3.2.2 only:010.0.0.1and::-1are names.
Adapters live in their own modules: kcoap-transport-ktor (UDP and TCP on ktor-network), kcoap-transport-ktor-websocket and kcoap-transport-ktor-websocket-server (WebSockets on the ktor client and server) and kcoap-testkit (in-memory network and connections for tests). Netty and Network.framework adapters are planned.