client

package
v1.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnableToGetStream = errors.New("unable to get a stream")

	// RPCTimeoutWithCacheHit can be more aggressive with timeouts in cases where a valid SVID
	// exists in the cache but is old enough to try for a new SVID quickly. This is configurable
	// in the Experimental Config of the Agent, and can be set as low as 5 seconds
	RPCTimeoutWithCacheHit = defaultRPCTimeout
)

Functions

func DialOptions added in v1.16.0

func DialOptions(address, loadBalancingConfig string, tlsConfig *tls.Config) []grpc.DialOption

DialOptions returns the gRPC dial options used to connect to the SPIRE server.

func MakeServiceConfigJSON added in v1.16.0

func MakeServiceConfigJSON(loadBalancingConfig string) string

func NewServerGRPCClient added in v1.11.2

func NewServerGRPCClient(config ServerClientConfig) (*grpc.ClientConn, error)

func SetJWTSVIDCacheHitTimeout added in v1.14.3

func SetJWTSVIDCacheHitTimeout(d time.Duration)

func SetMaxBundleWorkers added in v1.16.0

func SetMaxBundleWorkers(n int)

func SetRPCTimeout added in v1.16.0

func SetRPCTimeout(d time.Duration)

func ValidateLoadBalancingConfig added in v1.16.0

func ValidateLoadBalancingConfig(loadBalancingConfig string) error

func ValidateXDSBootstrap added in v1.16.0

func ValidateXDSBootstrap() error

ValidateXDSBootstrap ensures every xDS management server in the gRPC xDS bootstrap is either local (unix socket or loopback) or reached over TLS. The bootstrap is located the same way gRPC does.

func XDSTarget added in v1.16.0

func XDSTarget(listenerName string) (string, error)

XDSTarget returns the xds target for listenerName, failing if gRPC would parse it into a different listener name (e.g. text after "?" or "#").

Types

type Client

type Client interface {
	SyncUpdates(ctx context.Context, cachedEntries map[string]*common.RegistrationEntry, cachedBundles map[string]*common.Bundle) (SyncStats, error)
	RenewSVID(ctx context.Context, csr []byte) (*X509SVID, error)
	NewX509SVIDs(ctx context.Context, csrs map[string][]byte) (map[string]*X509SVID, error)
	NewJWTSVID(ctx context.Context, entryID string, audience []string, hasCacheHit bool) (*JWTSVID, spiffeid.ID, error)
	NewWITSVIDs(ctx context.Context, publicKeys map[string]crypto.PublicKey, signatureAlgorithm string) (map[string]*WITSVID, error)
	PostStatus(ctx context.Context, agentVersion string) error

	// Release releases any resources that were held by this Client, if any.
	Release()
}

func New

func New(c *Config) Client

New creates a new client struct with the configuration provided

type Config

type Config struct {
	Addr        string
	Log         logrus.FieldLogger
	TrustDomain spiffeid.TrustDomain
	// KeysAndBundle is a callback that must return the keys and bundle used by the client
	// to connect via mTLS to Addr.
	KeysAndBundle func() ([]*x509.Certificate, crypto.Signer, []*x509.Certificate)

	// RotMtx is used to prevent the creation of new connections during SVID rotations
	RotMtx *sync.RWMutex

	// TLSPolicy determines the post-quantum-safe policy to apply to all TLS connections.
	TLSPolicy tlspolicy.Policy

	// LoadBalancingConfig is an optional, opaque payload used as the
	// loadBalancingConfig field of the gRPC service config.
	LoadBalancingConfig string
}

Config holds a client configuration

type JWTSVID

type JWTSVID struct {
	Token     string
	IssuedAt  time.Time
	ExpiresAt time.Time
}

type ServerClientConfig added in v1.11.2

type ServerClientConfig struct {
	// Address is the SPIRE server address
	Address string

	TrustDomain spiffeid.TrustDomain

	// GetBundle is a required callback that returns the current trust bundle
	// for used to authenticate the server certificate.
	GetBundle func() []*x509.Certificate

	// GetAgentCertificate is an optional callback used to return the agent
	// certificate to present to the server during the TLS handshake.
	GetAgentCertificate func() *tls.Certificate

	// TLSPolicy determines the post-quantum-safe policy to apply to all TLS connections.
	TLSPolicy tlspolicy.Policy

	// LoadBalancingConfig is an optional, opaque payload used as the
	// loadBalancingConfig field of the gRPC service config. If empty, the
	// default load balancing configuration is used.
	LoadBalancingConfig string
	// contains filtered or unexported fields
}

type SyncBundlesStats added in v1.8.7

type SyncBundlesStats struct {
	Total int
}

type SyncEntriesStats added in v1.8.7

type SyncEntriesStats struct {
	Total   int
	Missing int
	Stale   int
	Dropped int
}

type SyncStats added in v1.8.7

type SyncStats struct {
	Entries SyncEntriesStats
	Bundles SyncBundlesStats
}

type Update

type Update struct {
	Entries map[string]*common.RegistrationEntry
	Bundles map[string]*common.Bundle
}

type WITSVID added in v1.15.3

type WITSVID struct {
	Token     string
	IssuedAt  time.Time
	ExpiresAt time.Time
}

type X509SVID added in v1.0.0

type X509SVID struct {
	CertChain []byte
	ExpiresAt int64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL