Help us shape the future of Go! Take the 2026 Go Developer Survey

client

package
v1.14.9 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 30 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 = rpcTimeout
)

Functions

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)

Types

type Client

type Client interface {
	FetchUpdates(ctx context.Context) (*Update, error)
	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)
	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
}

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
	// 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 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