Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

xds

v1.85.0
google.golang.org/grpc/internal/credentials/xds

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

13 matches

Top ↑

Package xds contains non-user facing functionality of the xds credentials.

Functions

ClientSideTLSConfig

func ClientSideTLSConfig(ctx context.Context, hiPtr *atomic.Pointer[grpcsync.RefCounted[*HandshakeInfo]], hostname string) (cfg *tls.Config, useFallback bool, done func(), err error)

ClientSideTLSConfig loads the HandshakeInfo from hiPtr, marks it as in-use, and returns the tls.Config along with a done callback that MUST be invoked when the handshake completes. If no HandshakeInfo is stored in hiPtr or if fallback credentials should be used, useFallback returns true.

HandshakeInfoFromAttributes

func HandshakeInfoFromAttributes(attr *attributes.Attributes) *atomic.Pointer[grpcsync.RefCounted[*HandshakeInfo]]

HandshakeInfoFromAttributes returns the atomic pointer to the reference-counted HandshakeInfo stored in attr.

Hostname

func Hostname(attr *attributes.Attributes) string

Hostname returns the endpoint hostname stored in attr.

NewHandshakeInfo

func NewHandshakeInfo(rootProvider, identityProvider certprovider.Provider, sanMatchers []matcher.StringMatcher, sni string, requireClientCert, validateSANUsingSNI, useAutoHostSNI bool) *grpcsync.RefCounted[*HandshakeInfo]

NewHandshakeInfo returns a new reference counted HandshakeInfo configured with the provided options.

ServerSideTLSConfig

func ServerSideTLSConfig(ctx context.Context, hiRC *grpcsync.RefCounted[*HandshakeInfo]) (cfg *tls.Config, useFallback bool, done func(), err error)

ServerSideTLSConfig checks if hi is configured and marks it as in-use, returning the tls.Config along with a done callback that MUST be invoked when the handshake completes. If hi is nil or fallback credentials should be used, useFallback returns true.

SetAddressHostname

func SetAddressHostname(addr resolver.Address, hostname string) resolver.Address

SetAddressHostname returns a copy of addr in which the Attributes field is updated with the provided hostname.

SetHandshakeInfo

func SetHandshakeInfo(addr resolver.Address, hiPtr *atomic.Pointer[grpcsync.RefCounted[*HandshakeInfo]]) resolver.Address

SetHandshakeInfo returns a copy of addr in which the Attributes field is updated with hiPtr.

Types

HandshakeInfo

type HandshakeInfo struct {
	// contains filtered or unexported fields
}

HandshakeInfo wraps all the security configuration required by client and server handshake methods in xds credentials. The xDS implementation will be responsible for populating these fields.

HandshakeInfo.GetSANMatchersForTesting

func (hi *HandshakeInfo) GetSANMatchersForTesting() []matcher.StringMatcher

GetSANMatchersForTesting returns the SAN matchers stored in HandshakeInfo. To be used only for testing purposes.

HandshakeInfo.MatchingSANExists

func (hi *HandshakeInfo) MatchingSANExists(cert *x509.Certificate) bool

MatchingSANExists returns true if the SANs contained in cert match the criteria enforced by the list of SAN matchers in HandshakeInfo.

If the list of SAN matchers in the HandshakeInfo is empty, this function returns true for all input certificates.

HandshakeInfo.UseFallbackCreds

func (hi *HandshakeInfo) UseFallbackCreds() bool

UseFallbackCreds returns true when fallback credentials are to be used based on the contents of the HandshakeInfo.

Dependency graph