Documentation
¶
Index ¶
- func CacheConfiguration() (err error)
- func GetPeerTestingAddress(port string) string
- func InitTLSForPeer() credentials.TransportCredentials
- func NewClientConnectionWithAddress(peerAddress string, block bool, tslEnabled bool, ...) (*grpc.ClientConn, error)
- func TLSEnabled() bool
- type GRPCServer
- type SecureServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheConfiguration ¶
func CacheConfiguration() (err error)
CacheConfiguration computes and caches commonly-used constants and computed constants as package variables. Routines which were previously
func GetPeerTestingAddress ¶
func InitTLSForPeer ¶
func InitTLSForPeer() credentials.TransportCredentials
InitTLSForPeer returns TLS credentials for peer
func NewClientConnectionWithAddress ¶
func NewClientConnectionWithAddress(peerAddress string, block bool, tslEnabled bool, creds credentials.TransportCredentials) (*grpc.ClientConn, error)
NewClientConnectionWithAddress Returns a new grpc.ClientConn to the given address.
func TLSEnabled ¶
func TLSEnabled() bool
TLSEnabled return cached value for "peer.tls.enabled" configuration value
Types ¶
type GRPCServer ¶
type GRPCServer interface {
//Address returns the listen address for the GRPCServer
Address() string
//Start starts the underlying grpc.Server
Start() error
//Stop stops the underlying grpc.Server
Stop()
//Server returns the grpc.Server instance for the GRPCServer
Server() *grpc.Server
//Listener returns the net.Listener instance for the GRPCServer
Listener() net.Listener
//ServerCertificate returns the tls.Certificate used by the grpc.Server
ServerCertificate() tls.Certificate
//TLSEnabled is a flag indicating whether or not TLS is enabled for this
//GRPCServer instance
TLSEnabled() bool
//AppendClientRootCAs appends PEM-encoded X509 certificate authorities to
//the list of authorities used to verify client certificates
AppendClientRootCAs(clientRoots [][]byte) error
//RemoveClientRootCAs removes PEM-encoded X509 certificate authorities from
//the list of authorities used to verify client certificates
RemoveClientRootCAs(clientRoots [][]byte) error
//SetClientRootCAs sets the list of authorities used to verify client
//certificates based on a list of PEM-encoded X509 certificate authorities
SetClientRootCAs(clientRoots [][]byte) error
}
GRPCServer defines an interface representing a GRPC-based server
func NewGRPCServer ¶
func NewGRPCServer(address string, secureConfig SecureServerConfig) (GRPCServer, error)
NewGRPCServer creates a new implementation of a GRPCServer given a listen address.
func NewGRPCServerFromListener ¶
func NewGRPCServerFromListener(listener net.Listener, secureConfig SecureServerConfig) (GRPCServer, error)
NewGRPCServerFromListener creates a new implementation of a GRPCServer given an existing net.Listener instance.
type SecureServerConfig ¶
type SecureServerConfig struct {
//Whether or not to use TLS for communication
UseTLS bool
//PEM-encoded X509 public key to be used by the server for TLS communication
ServerCertificate []byte
//PEM-encoded private key to be used by the server for TLS communication
ServerKey []byte
//Set of PEM-encoded X509 certificate authorities to optionally send
//as part of the server handshake
ServerRootCAs [][]byte
//Whether or not TLS client must present certificates for authentication
RequireClientCert bool
//Set of PEM-encoded X509 certificate authorities to use when verifying
//client certificates
ClientRootCAs [][]byte
}
A SecureServerConfig structure is used to configure security (e.g. TLS) for a GRPCServer instance