Documentation ¶
Index ¶
- Constants
- func GRPCClientFromConfig(cfg config.View, prefix string) (*grpc.ClientConn, error)
- func GRPCClientFromEndpoint(cfg config.View, address string) (*grpc.ClientConn, error)
- func GRPCClientFromParams(params *ClientParams) (*grpc.ClientConn, error)
- func HTTPClientFromConfig(cfg config.View, prefix string) (*http.Client, string, error)
- func HTTPClientFromEndpoint(cfg config.View, address string) (*http.Client, string, error)
- func HTTPClientFromParams(params *ClientParams) (*http.Client, string, error)
- type ClientCache
- type ClientParams
- type GrpcHandler
- type GrpcProxyHandler
- type Server
- type ServerParams
- func (p *ServerParams) AddHandleFunc(handlerFunc GrpcHandler, grpcProxyHandler GrpcProxyHandler)
- func (p *ServerParams) AddHealthCheckFunc(handlerFunc func(context.Context) error)
- func (p *ServerParams) SetTLSConfiguration(rootCaPublicCertificateFileData []byte, publicCertificateFileData []byte, ...) *ServerParams
Constants ¶
const (
// ConfigNameEnableRPCLogging is the config name for enabling RPC logging.
ConfigNameEnableRPCLogging = "logging.rpc"
)
Variables ¶
This section is empty.
Functions ¶
func GRPCClientFromConfig ¶
GRPCClientFromConfig creates a gRPC client connection from a configuration.
func GRPCClientFromEndpoint ¶
GRPCClientFromEndpoint creates a gRPC client connection from endpoint.
func GRPCClientFromParams ¶
func GRPCClientFromParams(params *ClientParams) (*grpc.ClientConn, error)
GRPCClientFromParams creates a gRPC client connection from the parameters.
func HTTPClientFromConfig ¶
HTTPClientFromConfig creates a HTTP client from from a configuration.
func HTTPClientFromEndpoint ¶
HTTPClientFromEndpoint creates a HTTP client from from endpoint.
func HTTPClientFromParams ¶
func HTTPClientFromParams(params *ClientParams) (*http.Client, string, error)
HTTPClientFromParams creates a HTTP client from the parameters.
Types ¶
type ClientCache ¶
type ClientCache struct {
// contains filtered or unexported fields
}
ClientCache holds GRPC and HTTP clients based on an address.
func NewClientCache ¶
func NewClientCache(cfg config.View) *ClientCache
NewClientCache creates a cache with all the clients.
func (*ClientCache) GetGRPC ¶
func (cc *ClientCache) GetGRPC(address string) (*grpc.ClientConn, error)
GetGRPC gets a GRPC client with the address.
type ClientParams ¶
type ClientParams struct { Address string TrustedCertificate []byte EnableRPCLogging bool EnableRPCPayloadLogging bool EnableMetrics bool }
ClientParams contains the connection parameters to connect to an Open Match service.
type GrpcProxyHandler ¶
GrpcProxyHandler binds HTTP handler to gRPC service.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server hosts a gRPC and HTTP server. All HTTP traffic is served from a common http.ServeMux.
func (*Server) Start ¶
func (s *Server) Start(p *ServerParams) error
Start the gRPC+HTTP(s) REST server.
type ServerParams ¶
type ServerParams struct { // ServeMux is the router for the HTTP server. You can use this to serve pages in addition to the HTTP proxy. // Do NOT register "/" handler because it's reserved for the proxy. ServeMux *http.ServeMux // contains filtered or unexported fields }
ServerParams holds all the parameters required to start a gRPC server.
func NewServerParamsFromConfig ¶
func NewServerParamsFromConfig(cfg config.View, prefix string, listen func(network, address string) (net.Listener, error)) (*ServerParams, error)
NewServerParamsFromConfig returns server Params initialized from the configuration file.
func NewServerParamsFromListeners ¶
func NewServerParamsFromListeners(grpcL net.Listener, proxyL net.Listener) *ServerParams
NewServerParamsFromListeners returns server Params initialized with the ListenerHolder variables.
func (*ServerParams) AddHandleFunc ¶
func (p *ServerParams) AddHandleFunc(handlerFunc GrpcHandler, grpcProxyHandler GrpcProxyHandler)
AddHandleFunc binds gRPC service handler and an associated HTTP proxy handler.
func (*ServerParams) AddHealthCheckFunc ¶
func (p *ServerParams) AddHealthCheckFunc(handlerFunc func(context.Context) error)
AddHealthCheckFunc adds a readiness probe to tell Kubernetes the service is able to handle traffic.
func (*ServerParams) SetTLSConfiguration ¶
func (p *ServerParams) SetTLSConfiguration(rootCaPublicCertificateFileData []byte, publicCertificateFileData []byte, privateKeyFileData []byte) *ServerParams
SetTLSConfiguration configures the server to run in TLS mode.