Documentation
¶
Index ¶
- Variables
- func ConnectionStateHolderToContext(ctx context.Context, holder ConnectionStateHolder) context.Context
- func ConnectionStateToContext(ctx context.Context, state ConnectionState) context.Context
- func ConnectionStateToContextFromNetConn(ctx context.Context, conn net.Conn) context.Context
- func CreateTLSClientConn(conn net.Conn, tlsConfig *tls.Config) *tls.Conn
- func CreateTLSConn(conn net.Conn, tlsConfig *tls.Config, f func(net.Conn, *tls.Config) *tls.Conn) *tls.Conn
- func CreateTLSServerConn(conn net.Conn, tlsConfig *tls.Config) *tls.Conn
- func NewConnectionStateHolderToContext(ctx context.Context) context.Context
- func WrapConnection(conn net.Conn, opts ...ConnectionOption) net.Conn
- func WrapHTTPTransport(rt http.RoundTripper, dialer ConnectionDialer) http.RoundTripper
- func WrapTLSConfig(config *tls.Config) *tls.Config
- func WrappedConnectionListener(l net.Listener) net.Listener
- type Certificate
- type ConnWithTLSConnectionState
- type ConnectionCloseWrapper
- type ConnectionDialer
- type ConnectionOption
- type ConnectionState
- func ConnectionStateFromContext(ctx context.Context) (ConnectionState, bool)
- func ConnectionStateFromHTTPRequest(req *http.Request) (ConnectionState, bool)
- func ConnectionStateFromNetConn(conn net.Conn) (ConnectionState, bool)
- func NewConnectionState() ConnectionState
- func NewConnectionStateWithID(id string) ConnectionState
- type ConnectionStateGetter
- type ConnectionStateHolder
- type DialWrapper
- type DialerOption
- type Server
Constants ¶
This section is empty.
Variables ¶
View Source
var ConnectionStateTrackerLogger logr.Logger = logr.Discard()
View Source
var ErrInvalidCertificate = errors.New("invalid tls certificate")
Functions ¶
func ConnectionStateHolderToContext ¶
func ConnectionStateHolderToContext(ctx context.Context, holder ConnectionStateHolder) context.Context
func ConnectionStateToContext ¶
func ConnectionStateToContext(ctx context.Context, state ConnectionState) context.Context
ConnectionStateToContext creates a new context object with the provided ConnectionState object added to it as a value using the connectionStateContextKey constant as the key.
func CreateTLSConn ¶
func NewConnectionStateHolderToContext ¶
NewConnectionStateHolderToContext creates a new connectionStateHolder object with a new UUID string as the ID and adds it to the provided context using the connectionStateContextKey constant as the key.
func WrapConnection ¶
func WrapConnection(conn net.Conn, opts ...ConnectionOption) net.Conn
func WrapHTTPTransport ¶
func WrapHTTPTransport(rt http.RoundTripper, dialer ConnectionDialer) http.RoundTripper
Types ¶
type Certificate ¶
type Certificate interface {
GetCertificate() *x509.Certificate
GetSHA256Digest() string
GetSubject() string
GetFirstURI() string
GetFirstDNSName() string
GetFirstIP() string
String() string
}
func NewCertificate ¶
func NewCertificate(cert *x509.Certificate) Certificate
func ParseTLSCertificate ¶
func ParseTLSCertificate(cert *tls.Certificate) (Certificate, error)
type ConnWithTLSConnectionState ¶
type ConnWithTLSConnectionState interface {
ConnectionState() tls.ConnectionState
}
type ConnectionCloseWrapper ¶
type ConnectionDialer ¶
type ConnectionDialer interface {
DialTLSContext(ctx context.Context, network, address string) (net.Conn, error)
// contains filtered or unexported methods
}
func NewDialer ¶
func NewDialer(opts ...DialerOption) ConnectionDialer
func NewDialerWithTLS ¶
func NewDialerWithTLS(certFile, keyFile string, insecure bool, opts ...DialerOption) (ConnectionDialer, error)
func NewDialerWithTLSConfig ¶
func NewDialerWithTLSConfig(config *tls.Config, opts ...DialerOption) ConnectionDialer
type ConnectionOption ¶
type ConnectionOption func(*connection)
func ConnectionWithCloserWrapper ¶
func ConnectionWithCloserWrapper(closeWrapper ConnectionCloseWrapper) ConnectionOption
func ConnectionWithOriginalAddress ¶
func ConnectionWithOriginalAddress(address string) ConnectionOption
func ConnectionWithState ¶
func ConnectionWithState(state ConnectionState) ConnectionOption
type ConnectionState ¶
type ConnectionState interface {
GetTimeToFirstByte() time.Time
SetTimeToFirstByte(time.Time)
ResetTimeToFirstByte()
GetLocalCertificate() Certificate
SetLocalCertificate(cert tls.Certificate)
GetPeerCertificate() Certificate
GetTLSConnectionState() tls.ConnectionState
SetTLSConnectionState(tls.ConnectionState)
SetTLSConnectionStateAsync(func() tls.ConnectionState)
LocalAddr() net.Addr
SetLocalAddr(net.Addr)
RemoteAddr() net.Addr
SetRemoteAddr(net.Addr)
GetOriginalAddress() string
ID() string
}
func ConnectionStateFromContext ¶
func ConnectionStateFromContext(ctx context.Context) (ConnectionState, bool)
ConnectionStateFromContext extracts the ConnectionState object from the provided context and returns it, along with a boolean indicating whether the extraction was successful. If the ConnectionState object is not found in the context or is nil, the function returns false.
func ConnectionStateFromHTTPRequest ¶
func ConnectionStateFromHTTPRequest(req *http.Request) (ConnectionState, bool)
func ConnectionStateFromNetConn ¶
func ConnectionStateFromNetConn(conn net.Conn) (ConnectionState, bool)
func NewConnectionState ¶
func NewConnectionState() ConnectionState
func NewConnectionStateWithID ¶
func NewConnectionStateWithID(id string) ConnectionState
type ConnectionStateGetter ¶
type ConnectionStateGetter interface {
GetConnectionState() ConnectionState
}
type ConnectionStateHolder ¶
type ConnectionStateHolder interface {
Get() ConnectionState
Set(ConnectionState)
ID() string
}
func ConnectionStateHolderFromContext ¶
func ConnectionStateHolderFromContext(ctx context.Context) (ConnectionStateHolder, bool)
type DialWrapper ¶
type DialerOption ¶
type DialerOption func(*dialer)
func DialerWithConnectionOptions ¶
func DialerWithConnectionOptions(opts ...ConnectionOption) DialerOption
func DialerWithDialerWrapper ¶
func DialerWithDialerWrapper(w DialWrapper) DialerOption
Source Files
¶
Click to show internal directories.
Click to hide internal directories.