servercore

package
v0.0.384 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Listen

func Listen(ctx context.Context, opts ListenOpts, registerServices func(Server)) error

func ListenAndGracefullyShutdownGRPC added in v0.0.324

func ListenAndGracefullyShutdownGRPC(ctx context.Context, label string, srv *grpc.Server, lis net.Listener) error

func ListenAndGracefullyShutdownHTTP added in v0.0.324

func ListenAndGracefullyShutdownHTTP(ctx context.Context, label string, srv *http.Server, lis net.Listener) error

func MakeTCPListener

func MakeTCPListener(address string, port int) func(context.Context) (net.Listener, error)

func NewHTTPMux added in v0.0.259

func NewHTTPMux(middleware ...mux.MiddlewareFunc) *mux.Router

func NewHttp2CapableServer added in v0.0.324

func NewHttp2CapableServer(mux http.Handler, opts HTTPOptions) *http.Server

func OrderedServerInterceptors added in v0.0.294

func OrderedServerInterceptors() []grpc.ServerOption

func Run

func Run(ctx context.Context, opts RunOpts, listenOpts ListenOpts)

func SetGrpcListenerConfiguration added in v0.0.324

func SetGrpcListenerConfiguration(name string, conf GrpcListenerConfiguration)

func SetListenerConfiguration added in v0.0.324

func SetListenerConfiguration(name string, conf ListenerConfiguration)

Types

type DefaultConfiguration added in v0.0.324

type DefaultConfiguration struct{}

func (DefaultConfiguration) CreateListener added in v0.0.324

func (DefaultConfiguration) CreateListener(ctx context.Context, name string, opts ListenOpts) (net.Listener, error)

type GrpcListenerConfiguration added in v0.0.324

type GrpcListenerConfiguration interface {
	ListenerConfiguration
	TransportCredentials(string) credentials.TransportCredentials
	ServerOpts(string) []grpc.ServerOption
}

type HTTPOptions added in v0.0.300

type HTTPOptions struct {
	HTTP1ReadTimeout       time.Duration `json:"http_read_timeout"`
	HTTP1ReadHeaderTimeout time.Duration `json:"http_read_header_timeout"`
	HTTP1WriteTimeout      time.Duration `json:"http_write_timeout"`
	HTTP1IdleTimeout       time.Duration `json:"http_idle_timeout"`
	HTTP1MaxHeaderBytes    int           `json:"http_max_header_bytes"`

	HTTP2MaxConcurrentStreams         uint32        `json:"http2_max_concurrent_streams"`
	HTTP2MaxReadFrameSize             uint32        `json:"http2_max_read_frame_size"`
	HTTP2IdleTimeout                  time.Duration `json:"http2_idle_timeout"`
	HTTP2MaxUploadBufferPerConnection int32         `json:"http2_max_upload_buffer_per_connection"`
	HTTP2MaxUploadBufferPerStream     int32         `json:"http2_max_upload_buffer_per_stream"`
}

type ListenOpts

type ListenOpts struct {
	CreateListener      func(context.Context) (net.Listener, error)
	CreateNamedListener func(context.Context, string) (net.Listener, error)
	CreateHttpListener  func(context.Context) (net.Listener, HTTPOptions, error)

	DontHandleSigTerm bool
}

type ListenerConfiguration added in v0.0.324

type ListenerConfiguration interface {
	CreateListener(context.Context, string, ListenOpts) (net.Listener, error)
}

type Registrar

type Registrar interface {
	grpc.ServiceRegistrar

	Handle(path string, p http.Handler) *mux.Route
	PathPrefix(path string) *mux.Route
	RegisterListener(func(context.Context, net.Listener) error)
}

type RunOpts

type RunOpts struct {
	PackageName          string
	RegisterInitializers func(*core.DependencyGraph)
	WireServices         func(context.Context, Server, core.Dependencies) []error
}

type Server

type Server interface {
	Scope(*core.Package) Registrar
}

type ServerImpl

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

Implements the grpc.ServiceRegistrar interface.

func (*ServerImpl) Handle

func (s *ServerImpl) Handle(path string, p http.Handler) *mux.Route

func (*ServerImpl) HandleFunc

func (s *ServerImpl) HandleFunc(path string, f func(http.ResponseWriter, *http.Request)) *mux.Route

func (*ServerImpl) PathPrefix

func (s *ServerImpl) PathPrefix(path string) *mux.Route

func (*ServerImpl) Scope

func (s *ServerImpl) Scope(pkg *core.Package) Registrar

Jump to

Keyboard shortcuts

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