Documentation ¶
Index ¶
- func NewAddMetadataStreamClientInterceptor(pairs []string) grpc.StreamClientInterceptor
- func NewAddMetadataUnaryClientInterceptor(pairs []string) grpc.UnaryClientInterceptor
- func NewAuthenticatingStreamInterceptor(a Authenticator) grpc.StreamServerInterceptor
- func NewAuthenticatingUnaryInterceptor(a Authenticator) grpc.UnaryServerInterceptor
- func NewMetadataForwardingStreamClientInterceptor(headers []string) grpc.StreamClientInterceptor
- func NewMetadataForwardingUnaryClientInterceptor(headers []string) grpc.UnaryClientInterceptor
- func NewServersFromConfigurationAndServe(configurations []*configuration.ServerConfiguration, ...) error
- type Authenticator
- func NewAnyAuthenticator(authenticators []Authenticator) Authenticator
- func NewAuthenticatorFromConfiguration(policy *configuration.AuthenticationPolicy) (Authenticator, error)
- func NewDenyAuthenticator(message string) Authenticator
- func NewTLSClientCertificateAuthenticator(clientCAs *x509.CertPool, clock clock.Clock) Authenticator
- type ClientFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAddMetadataStreamClientInterceptor ¶
func NewAddMetadataStreamClientInterceptor(pairs []string) grpc.StreamClientInterceptor
NewAddMetadataStreamClientInterceptor creates a gRPC request interceptor for streaming calls that adds a set of specified pairs into the outgoing metadata headers. This may, for example, be used to perform authentication.
func NewAddMetadataUnaryClientInterceptor ¶
func NewAddMetadataUnaryClientInterceptor(pairs []string) grpc.UnaryClientInterceptor
NewAddMetadataUnaryClientInterceptor creates a gRPC request interceptor for unary calls that adds a set of specified pairs into the outgoing metadata headers. This may, for example, be used to perform authentication.
func NewAuthenticatingStreamInterceptor ¶
func NewAuthenticatingStreamInterceptor(a Authenticator) grpc.StreamServerInterceptor
NewAuthenticatingStreamInterceptor creates a gRPC request interceptor for streaming calls that passes all requests through an Authenticator. This may be used to enable authentication support on a gRPC server.
func NewAuthenticatingUnaryInterceptor ¶
func NewAuthenticatingUnaryInterceptor(a Authenticator) grpc.UnaryServerInterceptor
NewAuthenticatingUnaryInterceptor creates a gRPC request interceptor for unary calls that passes all requests through an Authenticator. This may be used to enable authentication support on a gRPC server.
func NewMetadataForwardingStreamClientInterceptor ¶
func NewMetadataForwardingStreamClientInterceptor(headers []string) grpc.StreamClientInterceptor
NewMetadataForwardingStreamClientInterceptor creates a gRPC request interceptor for streaming calls that extracts a set of incoming metadata headers from the calling context and copies them into the outgoing metadata headers. This may, for example, be used to perform credential forwarding.
func NewMetadataForwardingUnaryClientInterceptor ¶
func NewMetadataForwardingUnaryClientInterceptor(headers []string) grpc.UnaryClientInterceptor
NewMetadataForwardingUnaryClientInterceptor creates a gRPC request interceptor for unary calls that extracts a set of incoming metadata headers from the calling context and copies them into the outgoing metadata headers. This may, for example, be used to perform credential forwarding.
func NewServersFromConfigurationAndServe ¶
func NewServersFromConfigurationAndServe(configurations []*configuration.ServerConfiguration, registrationFunc func(*grpc.Server)) error
NewServersFromConfigurationAndServe creates a series of gRPC servers based on a configuration stored in a list of Protobuf messages. It then lets all of these gRPC servers listen on the network addresses of UNIX socket paths provided.
Types ¶
type Authenticator ¶
Authenticator can be used to grant or deny access to a gRPC server. Implementations may grant access based on TLS connection state, provided headers, source IP address ranges, etc. etc. etc.
var AllowAuthenticator Authenticator = allowAuthenticator{}
AllowAuthenticator is an implementation of Authenticator that simply always returns success. This implementation can be used in case a gRPC server needs to be started that does not perform any authentication (e.g., one listening on a UNIX socket with restricted file permissions).
func NewAnyAuthenticator ¶
func NewAnyAuthenticator(authenticators []Authenticator) Authenticator
NewAnyAuthenticator wraps a series of Authenticators into a single instance. Access is granted only when one or more backing Authenticators permit access, similar to Python's any() function.
func NewAuthenticatorFromConfiguration ¶
func NewAuthenticatorFromConfiguration(policy *configuration.AuthenticationPolicy) (Authenticator, error)
NewAuthenticatorFromConfiguration creates a tree of Authenticator objects based on a configuration file.
func NewDenyAuthenticator ¶
func NewDenyAuthenticator(message string) Authenticator
NewDenyAuthenticator creates an Authenticator that always returns an UNAUTHENTICATED error with a fixed error message string. This implementation can be used in case a gRPC server needs to be administratively disabled without shutting it down entirely.
func NewTLSClientCertificateAuthenticator ¶
func NewTLSClientCertificateAuthenticator(clientCAs *x509.CertPool, clock clock.Clock) Authenticator
NewTLSClientCertificateAuthenticator creates an Authenticator that only grants access in case the client connected to the gRPC server using a TLS client certificate that can be validated against the chain of CAs used by the server.
type ClientFactory ¶
type ClientFactory interface {
NewClientFromConfiguration(configuration *configuration.ClientConfiguration) (grpc.ClientConnInterface, error)
}
ClientFactory can be used to construct gRPC clients based on options specified in a configuration message.
var BaseClientFactory ClientFactory = baseClientFactory{}
BaseClientFactory creates gRPC clients using the go-grpc library.
func NewDeduplicatingClientFactory ¶
func NewDeduplicatingClientFactory(base ClientFactory) ClientFactory
NewDeduplicatingClientFactory creates a decorator for ClientFactory that deduplicates requests for creating gRPC clients. This means that clients for identical endpoints, having identical TLS settings, etc. will not cause multiple connections to be established.