Secure
class Secure(val session: SessionId, val epoch: Int, val via: Endpoint, val identity: PeerIdentity) : Endpoint(source)
A peer reached through a DTLS session.
RFC 7252 §9.1.1 and §9.1.2: a response, ACK or RST matches a request only if the DTLS session and the epoch are the same. Equality is therefore (session, epoch) and nothing else:
a plaintext message never matches a DTLS one, because a plain endpoint is never equal to this;
via is excluded, because with a Connection ID (RFC 9146) the peer's address can change while the session stays the same. via is the last address seen and may be stale; the DTLS layer sends to the session's current address.
identity is excluded, because it is fixed for a session.
When a session ends or a new handshake replaces it, the DTLS layer emits DatagramEvent.SessionEnded and this endpoint never delivers or accepts messages again.