Documentation
¶
Index ¶
- Constants
- Variables
- func AccountEnabled(accountTag string, percentage uint32) bool
- func ApplyPostQuantumCurvePreferences(config *tls.Config, features []string)
- func HasFeature(features []string, target string) bool
- func IsQUICBroken(err error) bool
- func IsRetryableReadError(err error) bool
- func LoadCloudflareRootCertPool() (*x509.CertPool, error)
- func NewEdgeTLSConfig(rootCAs *x509.CertPool, serverName string, nextProtos []string) *tls.Config
- func NewStreamReadWriteCloser(stream QuicStreamHandle) *streamReadWriteCloser
- func NormalizeProtocol(protocol string) (string, error)
- func QuicInitialPacketSize(ipVersion int) uint16
- func ResolveRemoteDatagramVersion(accountTag string, record []byte) (string, error)
- func ShouldFlushHTTPHeaders(headers http.Header) bool
- func WrapWebsocketError(err error) error
- type FeatureSelector
- type HTTP2Connection
- type HTTP2DataStream
- type HTTP2FlushState
- type HTTP2FlushWriter
- type HTTP2Handler
- type HTTP2ResponseWriter
- type HTTP2Stream
- type ProtocolSelector
- type QUICConnection
- func (q *QUICConnection) Close() error
- func (q *QUICConnection) DatagramVersion() string
- func (q *QUICConnection) OpenRPCStream(ctx context.Context) (io.ReadWriteCloser, error)
- func (q *QUICConnection) SendDatagram(data []byte) error
- func (q *QUICConnection) Serve(ctx context.Context, handler StreamHandler) error
- type QuicStreamHandle
- type StreamHandler
- type WebsocketConn
Constants ¶
View Source
const ( H2EdgeSNI = "h2.cftunnel.com" H2ResponseMetaCloudflared = `{"src":"cloudflared"}` )
View Source
const ( QuicEdgeSNI = "quic.cftunnel.com" QuicEdgeALPN = "argotunnel" )
View Source
const ( X25519MLKEM768PQKex = tls.CurveID(0x11ec) FeaturePostQuantum = "postquantum" )
View Source
const ( ProtocolQUIC = "quic" ProtocolHTTP2 = "http2" ProtocolH2MUX = "h2mux" DefaultProtocolRetry = 5 )
Variables ¶
View Source
var CloudflareRootCertPool = LoadCloudflareRootCertPool
View Source
var DialQUIC = func(ctx context.Context, packetConn net.PacketConn, addr net.Addr, tlsConfig *tls.Config, quicConfig *quic.Config) (*quic.Conn, error) { return quic.Dial(ctx, packetConn, addr, tlsConfig, quicConfig) }
View Source
var FlushableContentTypes = []string{sseContentType, grpcContentType, ndjsonContentType}
View Source
var LookupCloudflaredFeatures = func(ctx context.Context) ([]byte, error) { lookupCtx, cancel := context.WithTimeout(ctx, featureLookupTimeout) defer cancel() records, err := net.DefaultResolver.LookupTXT(lookupCtx, featureSelectorHostname) if err != nil || len(records) == 0 { return nil, err } return []byte(records[0]), nil }
Functions ¶
func AccountEnabled ¶
func HasFeature ¶
func IsQUICBroken ¶
func IsRetryableReadError ¶
func NewEdgeTLSConfig ¶
func NewStreamReadWriteCloser ¶
func NewStreamReadWriteCloser(stream QuicStreamHandle) *streamReadWriteCloser
func NormalizeProtocol ¶
func QuicInitialPacketSize ¶
func ShouldFlushHTTPHeaders ¶
func WrapWebsocketError ¶
Types ¶
type FeatureSelector ¶
type FeatureSelector struct {
// contains filtered or unexported fields
}
func NewFeatureSelector ¶
func NewFeatureSelector(ctx context.Context, accountTag string, configured string) *FeatureSelector
func (*FeatureSelector) Snapshot ¶
func (s *FeatureSelector) Snapshot() (string, []string)
type HTTP2Connection ¶
type HTTP2Connection struct {
// contains filtered or unexported fields
}
func NewHTTP2Connection ¶
func NewHTTP2Connection( ctx context.Context, edgeAddr *discovery.EdgeAddr, connIndex uint8, credentials protocol.Credentials, connectorID uuid.UUID, features []string, numPreviousAttempts uint8, gracePeriod time.Duration, tunnelDialer N.Dialer, handler HTTP2Handler, log logger.ContextLogger, ) (*HTTP2Connection, error)
func (*HTTP2Connection) Close ¶
func (c *HTTP2Connection) Close() error
func (*HTTP2Connection) ServeHTTP ¶
func (c *HTTP2Connection) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HTTP2DataStream ¶
type HTTP2DataStream struct {
// contains filtered or unexported fields
}
func (*HTTP2DataStream) Close ¶
func (s *HTTP2DataStream) Close() error
type HTTP2FlushState ¶
type HTTP2FlushState struct {
// contains filtered or unexported fields
}
type HTTP2FlushWriter ¶
type HTTP2FlushWriter struct {
// contains filtered or unexported fields
}
type HTTP2Handler ¶
type HTTP2Handler interface {
DispatchRequest(ctx context.Context, stream io.ReadWriteCloser, writer protocol.ConnectResponseWriter, request *protocol.ConnectRequest)
ApplyConfig(version int32, config []byte) config.UpdateResult
NotifyConnected(connIndex uint8, protocol string)
}
type HTTP2ResponseWriter ¶
type HTTP2ResponseWriter struct {
// contains filtered or unexported fields
}
func (*HTTP2ResponseWriter) AddTrailer ¶
func (w *HTTP2ResponseWriter) AddTrailer(name, value string)
func (*HTTP2ResponseWriter) WriteResponse ¶
func (w *HTTP2ResponseWriter) WriteResponse(responseError error, metadata []protocol.Metadata) error
type HTTP2Stream ¶
type HTTP2Stream struct {
// contains filtered or unexported fields
}
func NewHTTP2Stream ¶
func NewHTTP2Stream(reader io.ReadCloser, writer io.Writer) *HTTP2Stream
func (*HTTP2Stream) Close ¶
func (s *HTTP2Stream) Close() error
type ProtocolSelector ¶
func NewProtocolSelector ¶
func NewProtocolSelector(protocol string, postQuantum bool) (ProtocolSelector, error)
type QUICConnection ¶
type QUICConnection struct {
// contains filtered or unexported fields
}
func NewQUICConnection ¶
func NewQUICConnection( ctx context.Context, edgeAddr *discovery.EdgeAddr, connIndex uint8, credentials protocol.Credentials, connectorID uuid.UUID, datagramVersion string, features []string, numPreviousAttempts uint8, gracePeriod time.Duration, tunnelDialer N.Dialer, onConnected func(), log logger.ContextLogger, ) (*QUICConnection, error)
func (*QUICConnection) Close ¶
func (q *QUICConnection) Close() error
func (*QUICConnection) DatagramVersion ¶
func (q *QUICConnection) DatagramVersion() string
func (*QUICConnection) OpenRPCStream ¶
func (q *QUICConnection) OpenRPCStream(ctx context.Context) (io.ReadWriteCloser, error)
func (*QUICConnection) SendDatagram ¶
func (q *QUICConnection) SendDatagram(data []byte) error
func (*QUICConnection) Serve ¶
func (q *QUICConnection) Serve(ctx context.Context, handler StreamHandler) error
type QuicStreamHandle ¶
type StreamHandler ¶
type StreamHandler interface {
HandleDataStream(ctx context.Context, stream io.ReadWriteCloser, request *protocol.ConnectRequest, connIndex uint8)
HandleRPCStream(ctx context.Context, stream io.ReadWriteCloser, connIndex uint8)
HandleRPCStreamWithSender(ctx context.Context, stream io.ReadWriteCloser, connIndex uint8, sender protocol.DatagramSender)
HandleDatagram(ctx context.Context, datagram []byte, sender protocol.DatagramSender)
}
type WebsocketConn ¶
func NewWebsocketConn ¶
func NewWebsocketConn(conn net.Conn, state ws.State) *WebsocketConn
func (*WebsocketConn) Close ¶
func (c *WebsocketConn) Close() error
Click to show internal directories.
Click to hide internal directories.