client

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: Apache-2.0 Imports: 32 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) (*node.X509SVID, error)
	NewX509SVIDs(ctx context.Context, csrs map[string][]byte) (map[string]*node.X509SVID, error)
	NewJWTSVID(ctx context.Context, jsr *node.JSR, entryID 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 url.URL
	// 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, *ecdsa.PrivateKey, []*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 is the trust domain ID for the agent/server
	TrustDomain string

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

Jump to

Keyboard shortcuts

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