client

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: Apache-2.0 Imports: 28 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func DialServer

func DialServer(ctx context.Context, config DialServerConfig) (*grpc.ClientConn, error)

Types

type Client

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

Config holds a client configuration

type DialServerConfig

type DialServerConfig 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
	// contains filtered or unexported fields
}

type JWTSVID

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

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