Skip to main content

SessionStore

Trait SessionStore 

Source
pub trait SessionStore: Send + Sync {
    // Required methods
    fn put(&self, server_name: &str, session: Tls13Session);
    fn take(&self, server_name: &str) -> Option<Tls13Session>;

    // Provided methods
    fn put_dtls12(&self, _server_name: &str, _session: Dtls12Session) { ... }
    fn take_dtls12(&self, _server_name: &str) -> Option<Dtls12Session> { ... }
    fn forget_dtls12(&self, _server_name: &str, _session_id: &[u8]) { ... }
}
Expand description

Where a client keeps the tickets servers give it, keyed by server name.

take removes what it returns: a ticket is offered once (RFC 8446 appendix C.4), so that two handshakes cannot be linked by it.

The DTLS 1.2 methods have defaults that keep nothing, so a store written for DTLS 1.3 only resumes no DTLS 1.2 session. A store that keeps DTLS 1.2 sessions must implement forget_dtls12: RFC 5246 section 7.2.2 forbids resuming a session whose connection ended with a fatal alert.

Required Methods§

Source

fn put(&self, server_name: &str, session: Tls13Session)

Keeps session, received from the server configured as server_name.

Source

fn take(&self, server_name: &str) -> Option<Tls13Session>

Takes the most recent session for server_name, if there is one.

Provided Methods§

Source

fn put_dtls12(&self, _server_name: &str, _session: Dtls12Session)

Keeps a DTLS 1.2 session made with the server configured as server_name.

Source

fn take_dtls12(&self, _server_name: &str) -> Option<Dtls12Session>

Takes the most recent DTLS 1.2 session for server_name. A session id session that is resumed is put back; a ticket is offered once.

Source

fn forget_dtls12(&self, _server_name: &str, _session_id: &[u8])

Forgets the DTLS 1.2 session session_id of server_name: its connection failed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§