github.com/sagernet/quic-go@v0.43.1-beta.1/ech/interface.go (about) 1 package quic 2 3 import ( 4 "github.com/sagernet/quic-go" 5 "github.com/sagernet/quic-go/internal/handshake_ech" 6 "github.com/sagernet/quic-go/internal/protocol" 7 ) 8 9 // The StreamID is the ID of a QUIC stream. 10 type StreamID = protocol.StreamID 11 12 // A Version is a QUIC version number. 13 type Version = protocol.Version 14 15 // A VersionNumber is a QUIC version number. 16 // Deprecated: VersionNumber was renamed to Version. 17 type VersionNumber = Version 18 19 const ( 20 // Version1 is RFC 9000 21 Version1 = protocol.Version1 22 // Version2 is RFC 9369 23 Version2 = protocol.Version2 24 ) 25 26 // A ClientToken is a token received by the client. 27 // It can be used to skip address validation on future connection attempts. 28 type ClientToken = quic.ClientToken 29 30 type TokenStore = quic.TokenStore 31 32 // Err0RTTRejected is the returned from: 33 // * Open{Uni}Stream{Sync} 34 // * Accept{Uni}Stream 35 // * Stream.Read and Stream.Write 36 // when the server rejects a 0-RTT connection attempt. 37 var Err0RTTRejected = quic.Err0RTTRejected 38 39 // ConnectionTracingKey can be used to associate a ConnectionTracer with a Connection. 40 // It is set on the Connection.Context() context, 41 // as well as on the context passed to logging.Tracer.NewConnectionTracer. 42 var ConnectionTracingKey = quic.ConnectionTracingKey 43 44 // ConnectionTracingID is the type of the context value saved under the ConnectionTracingKey. 45 type ConnectionTracingID = quic.ConnectionTracingID 46 47 // QUICVersionContextKey can be used to find out the QUIC version of a TLS handshake from the 48 // context returned by tls.Config.ClientHelloInfo.Context. 49 var QUICVersionContextKey = handshake.QUICVersionContextKey 50 51 // Stream is the interface implemented by QUIC streams 52 // In addition to the errors listed on the Connection, 53 // calls to stream functions can return a StreamError if the stream is canceled. 54 type Stream = quic.Stream 55 56 // A ReceiveStream is a unidirectional Receive Stream. 57 type ReceiveStream = quic.ReceiveStream 58 59 // A SendStream is a unidirectional Send Stream. 60 type SendStream = quic.SendStream 61 62 // A Connection is a QUIC connection between two peers. 63 // Calls to the connection (and to streams) can return the following types of errors: 64 // * ApplicationError: for errors triggered by the application running on top of QUIC 65 // * TransportError: for errors triggered by the QUIC transport (in many cases a misbehaving peer) 66 // * IdleTimeoutError: when the peer goes away unexpectedly (this is a net.Error timeout error) 67 // * HandshakeTimeoutError: when the cryptographic handshake takes too long (this is a net.Error timeout error) 68 // * StatelessResetError: when we receive a stateless reset (this is a net.Error temporary error) 69 // * VersionNegotiationError: returned by the client, when there's no version overlap between the peers 70 type Connection = quic.Connection 71 72 // An EarlyConnection is a connection that is handshaking. 73 // Data sent during the handshake is encrypted using the forward secure keys. 74 // When using client certificates, the client's identity is only verified 75 // after completion of the handshake. 76 type EarlyConnection = quic.EarlyConnection 77 78 // StatelessResetKey is a key used to derive stateless reset tokens. 79 type StatelessResetKey = quic.StatelessResetKey 80 81 // TokenGeneratorKey is a key used to encrypt session resumption tokens. 82 type TokenGeneratorKey = handshake.TokenProtectorKey 83 84 // A ConnectionID is a QUIC Connection ID, as defined in RFC 9000. 85 // It is not able to handle QUIC Connection IDs longer than 20 bytes, 86 // as they are allowed by RFC 8999. 87 type ConnectionID = quic.ConnectionID 88 89 // ConnectionIDFromBytes interprets b as a Connection ID. It panics if b is 90 // longer than 20 bytes. 91 func ConnectionIDFromBytes(b []byte) ConnectionID { 92 return protocol.ParseConnectionID(b) 93 } 94 95 // A ConnectionIDGenerator is an interface that allows clients to implement their own format 96 // for the Connection IDs that servers/clients use as SrcConnectionID in QUIC packets. 97 // 98 // Connection IDs generated by an implementation should always produce IDs of constant size. 99 type ConnectionIDGenerator = quic.ConnectionIDGenerator 100 101 // Config contains all configuration data needed for a QUIC server or client. 102 type Config = quic.Config 103 104 type ClientHelloInfo = quic.ClientHelloInfo 105 106 // ConnectionState records basic details about a QUIC connection 107 type ConnectionState = quic.ConnectionState