protocol

package
v0.0.0-...-d8a8f93 Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package protocol defines the interface of CA client protocol. Currently we only support gRPC protocol sent to Istio CA server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CAGrpcClient

type CAGrpcClient interface {
	// Send CSR to the CA and gets the response or error.
	SendCSR(*pb.CsrRequest, platform.Client, string) (*pb.CsrResponse, error)
}

CAGrpcClient is for implementing the GRPC client to talk to CA.

type CAProtocol

type CAProtocol interface {
	// SendCSR send CSR request to the CA server.
	SendCSR(*pb.CsrRequest) (*pb.CsrResponse, error)
}

CAProtocol is the interface for talking to CA.

type FakeProtocol

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

FakeProtocol is a fake for testing, implements CAProtocol interface.

func NewFakeProtocol

func NewFakeProtocol(response *pb.CsrResponse, err string) *FakeProtocol

NewFakeProtocol returns a FakeProtocol with configured response and expected error.

func (*FakeProtocol) InvokeTimes

func (f *FakeProtocol) InvokeTimes() int

InvokeTimes returns the times that SendCSR has been invoked.

func (*FakeProtocol) SendCSR

func (f *FakeProtocol) SendCSR(req *pb.CsrRequest) (*pb.CsrResponse, error)

SendCSR returns the result based on the predetermined config.

type GrpcConnection

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

GrpcConnection implements CAProtocol talking to CA via gRPC. TODO(incfly): investigate the overhead of maintaining gRPC connection for CA server compared with establishing new connection every time.

func NewGrpcConnection

func NewGrpcConnection(caAddr string, dialOptions []grpc.DialOption) (*GrpcConnection, error)

NewGrpcConnection creates a gRPC connection.

func (*GrpcConnection) Close

func (c *GrpcConnection) Close() error

Close closes the gRPC connection.

func (*GrpcConnection) SendCSR

func (c *GrpcConnection) SendCSR(req *pb.CsrRequest) (*pb.CsrResponse, error)

SendCSR sends a resquest to CA server and returns the response.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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