MCPcopy Create free account
hub / github.com/XTLS/REALITY / SessionState

Struct SessionState

ticket.go:21–103  ·  view source on GitHub ↗

A SessionState is a resumable session.

Source from the content-addressed store, hash-verified

19
20// A SessionState is a resumable session.
21type SessionState struct {
22 // Encoded as a SessionState (in the language of RFC 8446, Section 3).
23 //
24 // enum { server(1), client(2) } SessionStateType;
25 //
26 // opaque Certificate<1..2^24-1>;
27 //
28 // Certificate CertificateChain<0..2^24-1>;
29 //
30 // opaque Extra<0..2^24-1>;
31 //
32 // struct {
33 // uint16 version;
34 // SessionStateType type;
35 // uint16 cipher_suite;
36 // uint64 created_at;
37 // opaque secret<1..2^8-1>;
38 // Extra extra<0..2^24-1>;
39 // uint8 ext_master_secret = { 0, 1 };
40 // uint8 early_data = { 0, 1 };
41 // CertificateEntry certificate_list<0..2^24-1>;
42 // CertificateChain verified_chains<0..2^24-1>; /* excluding leaf */
43 // select (SessionState.early_data) {
44 // case 0: Empty;
45 // case 1: opaque alpn<1..2^8-1>;
46 // };
47 // select (SessionState.version) {
48 // case VersionTLS10..VersionTLS12: uint16 curve_id;
49 // case VersionTLS13: select (SessionState.type) {
50 // case server: Empty;
51 // case client: struct {
52 // uint64 use_by;
53 // uint32 age_add;
54 // };
55 // };
56 // };
57 // } SessionState;
58 //
59 // The format can be extended backwards-compatibly by adding new fields at
60 // the end. Otherwise, a new SessionStateType must be used, as different Go
61 // versions may share the same session ticket encryption key.
62
63 // Extra is ignored by crypto/tls, but is encoded by [SessionState.Bytes]
64 // and parsed by [ParseSessionState].
65 //
66 // This allows [Config.UnwrapSession]/[Config.WrapSession] and
67 // [ClientSessionCache] implementations to store and retrieve additional
68 // data alongside this session.
69 //
70 // To allow different layers in a protocol stack to share this field,
71 // applications must only append to it, not replace it, and must use entries
72 // that can be recognized even if out of order (for example, by starting
73 // with an id and version prefix).
74 Extra [][]byte
75
76 // EarlyData indicates whether the ticket can be used for 0-RTT in a QUIC
77 // connection. The application may set this to false if it is true to
78 // decline to offer 0-RTT even if supported.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected