client

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package client implements the official Go trusty client for v1.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RetryCAClient

func RetryCAClient(conn *grpc.ClientConn) pb.CAServiceClient

RetryCAClient implements a CAClient.

func RetryCIClient

func RetryCIClient(conn *grpc.ClientConn) pb.CIServiceClient

RetryCIClient implements a CIServiceClient.

func RetryStatusClient

func RetryStatusClient(conn *grpc.ClientConn) pb.StatusServiceClient

RetryStatusClient implements a StatusClient.

Types

type CAClient

type CAClient interface {
	// ProfileInfo returns the certificate profile info
	ProfileInfo(ctx context.Context, in *pb.CertProfileInfoRequest) (*pb.CertProfileInfo, error)
	// SignCertificate returns the certificate
	SignCertificate(ctx context.Context, in *pb.SignCertificateRequest) (*pb.CertificateResponse, error)
	// Issuers returns the issuing CAs
	Issuers(ctx context.Context) (*pb.IssuersInfoResponse, error)
	// PublishCrls returns published CRLs
	PublishCrls(ctx context.Context, req *pb.PublishCrlsRequest) (*pb.CrlsResponse, error)
	// RevokeCertificate returns the revoked certificate
	RevokeCertificate(ctx context.Context, in *pb.RevokeCertificateRequest) (*pb.RevokedCertificateResponse, error)
}

CAClient client interface

func NewCAClient

func NewCAClient(conn *grpc.ClientConn, callOpts []grpc.CallOption) CAClient

NewCAClient returns instance of CAService client

func NewCAClientFromProxy

func NewCAClientFromProxy(proxy pb.CAServiceClient) CAClient

NewCAClientFromProxy returns instance of Authority client

type CIClient

type CIClient interface {
	// GetRoots returns the root CAs
	GetRoots(ctx context.Context, in *empty.Empty) (*pb.RootsResponse, error)
	// GetCertificate returns the certificate
	GetCertificate(ctx context.Context, in *pb.GetCertificateRequest) (*pb.CertificateResponse, error)
	// GetOrgCertificates returns the Org certificates
	GetOrgCertificates(ctx context.Context, in *pb.GetOrgCertificatesRequest) (*pb.CertificatesResponse, error)
	// ListCertificates returns stream of Certificates
	ListCertificates(ctx context.Context, in *pb.ListByIssuerRequest) (*pb.CertificatesResponse, error)
	// ListRevokedCertificates returns stream of Revoked Certificates
	ListRevokedCertificates(ctx context.Context, in *pb.ListByIssuerRequest) (*pb.RevokedCertificatesResponse, error)
}

CIClient client interface

func NewCIClient

func NewCIClient(conn *grpc.ClientConn, callOpts []grpc.CallOption) CIClient

NewCIClient returns instance of CIService client

func NewCIClientFromProxy

func NewCIClientFromProxy(proxy pb.CIServiceClient) CIClient

NewCIClientFromProxy returns instance of CIService client

type Client

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

Client provides and manages an trusty v1 client session.

func New

func New(cfg *Config) (*Client, error)

New creates a new trusty client from a given configuration.

func NewFromURL

func NewFromURL(url string) (*Client, error)

NewFromURL creates a new trusty client from a URL.

func (*Client) ActiveConnection

func (c *Client) ActiveConnection() *grpc.ClientConn

ActiveConnection returns the current in-use connection

func (*Client) CAClient

func (c *Client) CAClient() CAClient

CAClient returns CAClient client from connection

func (*Client) CIClient

func (c *Client) CIClient() CIClient

CIClient returns CIClient client from connection

func (*Client) Close

func (c *Client) Close() error

Close shuts down the client's trusty connections.

func (*Client) StatusClient

func (c *Client) StatusClient() StatusClient

StatusClient returns StatusClient client from connection

type Config

type Config struct {
	// Endpoints is a list of URLs.
	Endpoints []string

	// DialTimeout is the timeout for failing to establish a connection.
	DialTimeout time.Duration

	// DialKeepAliveTime is the time after which client pings the server to see if
	// transport is alive.
	DialKeepAliveTime time.Duration

	// DialKeepAliveTimeout is the time that the client waits for a response for the
	// keep-alive probe. If the response is not received in this time, the connection is closed.
	DialKeepAliveTimeout time.Duration

	// TLS holds the client secure credentials, if any.
	TLS *tls.Config

	// DialOptions is a list of dial options for the grpc client (e.g., for interceptors).
	// For example, pass "grpc.WithBlock()" to block until the underlying connection is up.
	// Without this, Dial returns immediately and connecting the server happens in background.
	DialOptions []grpc.DialOption

	// Context is the default client context; it can be used to cancel grpc dial out and
	// other operations that do not have an explicit context.
	Context context.Context
}

Config for trusty client

type EmptyOption

type EmptyOption struct{}

EmptyOption does not alter the dial configuration. It can be embedded in another structure to build custom dial options.

type Factory

type Factory interface {
	NewClient(svc string, ops ...Option) (*Client, error)
}

Factory specifies interface to create Client

func NewFactory

func NewFactory(cfg *config.TrustyClient, ops ...Option) Factory

NewFactory returns new Factory

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option configures how we set up the client

func WithTLS

func WithTLS(tlsCfg *tls.Config) Option

WithTLS option to provide tls.Config

type StatusClient

type StatusClient interface {
	// Version returns the server version.
	Version(ctx context.Context) (*pb.ServerVersion, error)
	// Server returns the server status.
	Server(ctx context.Context) (*pb.ServerStatusResponse, error)
	// Caller returns the caller status.
	Caller(ctx context.Context) (*pb.CallerStatusResponse, error)
}

StatusClient client interface

func NewStatusClient

func NewStatusClient(conn *grpc.ClientConn, callOpts []grpc.CallOption) StatusClient

NewStatusClient returns instance of Status client

func NewStatusClientFromProxy

func NewStatusClientFromProxy(proxy pb.StatusServiceClient) StatusClient

NewStatusClientFromProxy returns instance of Status client

Directories

Path Synopsis
proxy
Package proxy provides gRPC proxy between client and server gRPC interfaces without needing to go through a gRPC connection.
Package proxy provides gRPC proxy between client and server gRPC interfaces without needing to go through a gRPC connection.

Jump to

Keyboard shortcuts

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