credentials
v1.51.4
Documentation
pkg.go.dev ↗Package credentials defines APIs for parsing SPIFFE ID.
All APIs in this package are experimental.
Functions
AppendH2ToNextProtos
func AppendH2ToNextProtos(ps []string) []string
AppendH2ToNextProtos appends h2 to next protos.
ClientHandshakeInfoFromContext
func ClientHandshakeInfoFromContext(ctx context.Context) interface{}
ClientHandshakeInfoFromContext extracts the ClientHandshakeInfo from ctx.
CloneTLSConfig
func CloneTLSConfig(cfg *tls.Config) *tls.Config
CloneTLSConfig returns a shallow clone of the exported fields of cfg, ignoring the unexported sync.Once, which contains a mutex and must not be copied.
If cfg is nil, a new zero tls.Config is returned.
TODO: inline this function if possible.
NewClientHandshakeInfoContext
func NewClientHandshakeInfoContext(ctx context.Context, chi interface{}) context.Context
NewClientHandshakeInfoContext creates a context with chi.
NewRequestInfoContext
func NewRequestInfoContext(ctx context.Context, ri interface{}) context.Context
NewRequestInfoContext creates a context with ri.
RequestInfoFromContext
func RequestInfoFromContext(ctx context.Context) interface{}
RequestInfoFromContext extracts the RequestInfo from ctx.
SPIFFEIDFromCert
func SPIFFEIDFromCert(cert *x509.Certificate) *url.URL
SPIFFEIDFromCert parses the SPIFFE ID from x509.Certificate. If the SPIFFE ID format is invalid, return nil with warning.
SPIFFEIDFromState
func SPIFFEIDFromState(state tls.ConnectionState) *url.URL
SPIFFEIDFromState parses the SPIFFE ID from State. If the SPIFFE ID format is invalid, return nil with warning.
WrapSyscallConn
func WrapSyscallConn(rawConn, newConn net.Conn) net.Conn
WrapSyscallConn tries to wrap rawConn and newConn into a net.Conn that implements syscall.Conn. rawConn will be used to support syscall, and newConn will be used for read/write.
This function returns newConn if rawConn doesn't implement syscall.Conn.