Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Name string // Name of the GRPC Server
Address string // Address on which the server will be accessible
Port uint16 // Port on which the server will be accessible
TLSEnabled bool // Whether or not traffic should be served via HTTPS
TLSCrtPath string // Location of TLS Certificate
TLSKeyPath string // Location of TLS Key
ServerRegistration func(*grpc.Server) // Callback for registering GRPC API Servers
StreamInterceptors []grpc.StreamServerInterceptor // A list of global GRPC stream interceptor functions to be called. Order is honored left to right.
UnaryInterceptors []grpc.UnaryServerInterceptor // A list of global GRPC unary interceptor functions to be called. Order is honored left to right.
CancelSignals []os.Signal // OS Signals to be used to cancel running servers. Defaults to SIGINT/`os.Interrupt`.
}
Config contains the configuration necessary for running a GRPC Server.
func NewDefaultConfig ¶
NewDefaultConfig returns a default GRPC server config object. The caller must still supply the name of the server and a serverRegistration callback. The serverRegistration callback is a function that registers GRPC API servers with the provided GRPC server.
func (Config) NewServer ¶
NewServer creates and returns a configured Server object given a GRPC configuration object.
func (*Config) RegisterFlags ¶
RegisterFlags registers GRPC flags with pflags
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server contains the configured GRPC server and related components
func (Server) Run ¶
Run starts the GRPC server. The function returns an error if the GRPC server cannot bind to its listen address. This function is non-blocking and will return immediately. If no error is returned the server is running. The returned channel will be closed after the server shuts down.