Documentation
¶
Index ¶
- func NewDefaultHTTP2Server() *http2.Server
- type Client
- type ClientOption
- func WithAddr(x string) ClientOption
- func WithAllowedOrigins(x []string) ClientOption
- func WithH2(x *H2Conf) ClientOption
- func WithIdleTimeout(x time.Duration) ClientOption
- func WithNotFoundHandler(x contract.HandlerFunc) ClientOption
- func WithReadTimeout(x time.Duration) ClientOption
- func WithShutdownTimeout(x time.Duration) ClientOption
- func WithWriteTimeout(x time.Duration) ClientOption
- type ClientOptions
- type DefaultTool
- func (d *DefaultTool) GetBoundOn(ctx context.Context) (string, error)
- func (d *DefaultTool) GetIdleTimeout(ctx context.Context) (time.Duration, error)
- func (d *DefaultTool) GetReadTimeout(ctx context.Context) (time.Duration, error)
- func (d *DefaultTool) GetUseH2C(ctx context.Context) (bool, error)
- func (d *DefaultTool) GetUseHTTP2(ctx context.Context) (bool, error)
- func (d *DefaultTool) GetWriteTimeout(ctx context.Context) (time.Duration, error)
- func (d *DefaultTool) Run(ctx context.Context) error
- func (d *DefaultTool) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (d *DefaultTool) Shutdown(ctx context.Context) error
- func (d *DefaultTool) WithNotFoundHandler(ctx context.Context, x contract.HandlerFunc) error
- type Dependencies
- type H2Conf
- type KeyFn
- type ParsePathFn
- type ParseQueryFn
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDefaultHTTP2Server ¶ added in v0.1.559
NewDefaultHTTP2Server returns a properly tuned *http2.Server for Cloud Run or any long-lived, streaming-compatible HTTP/2 use.
Types ¶
type Client ¶
type Client interface { contract.ServerOperator }
func NewClient ¶
func NewClient(ctx context.Context, d Dependencies, opts ClientOptions) (Client, error)
type ClientOption ¶
type ClientOption func(*ClientOptions)
func WithAddr ¶
func WithAddr(x string) ClientOption
func WithAllowedOrigins ¶
func WithAllowedOrigins(x []string) ClientOption
func WithH2 ¶
func WithH2(x *H2Conf) ClientOption
func WithIdleTimeout ¶
func WithIdleTimeout(x time.Duration) ClientOption
func WithNotFoundHandler ¶
func WithNotFoundHandler(x contract.HandlerFunc) ClientOption
func WithReadTimeout ¶
func WithReadTimeout(x time.Duration) ClientOption
func WithShutdownTimeout ¶
func WithShutdownTimeout(x time.Duration) ClientOption
func WithWriteTimeout ¶
func WithWriteTimeout(x time.Duration) ClientOption
type ClientOptions ¶
type ClientOptions struct { Addr string AllowedOrigins []string H2 *H2Conf IdleTimeout time.Duration ReadTimeout time.Duration WriteTimeout time.Duration ShutdownTimeout time.Duration NotFoundHandler contract.HandlerFunc }
func ApplyClientOptions ¶
func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions
type DefaultTool ¶ added in v0.1.24
func NewTool ¶
func NewTool(c Client, opts contract.ToolOptions[Client]) *DefaultTool
func (*DefaultTool) GetBoundOn ¶ added in v0.1.246
func (d *DefaultTool) GetBoundOn(ctx context.Context) (string, error)
GetBoundOn returns the address the server is bound to.
func (*DefaultTool) GetIdleTimeout ¶ added in v0.1.246
GetIdleTimeout returns the server's idle timeout.
func (*DefaultTool) GetReadTimeout ¶ added in v0.1.246
GetReadTimeout returns the server's read timeout.
func (*DefaultTool) GetUseH2C ¶ added in v0.1.246
func (d *DefaultTool) GetUseH2C(ctx context.Context) (bool, error)
GetUseH2C reports whether H2C (HTTP/2 without TLS) is enabled.
func (*DefaultTool) GetUseHTTP2 ¶ added in v0.1.246
func (d *DefaultTool) GetUseHTTP2(ctx context.Context) (bool, error)
GetUseHTTP2 reports whether HTTP/2 is enabled.
func (*DefaultTool) GetWriteTimeout ¶ added in v0.1.246
GetWriteTimeout returns the server's write timeout.
func (*DefaultTool) Run ¶ added in v0.1.24
func (d *DefaultTool) Run(ctx context.Context) error
Run starts the server and blocks until shutdown or error.
func (*DefaultTool) ServeHTTP ¶ added in v0.1.24
func (d *DefaultTool) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP is the entrypoint for all HTTP traffic.
func (*DefaultTool) Shutdown ¶ added in v0.1.24
func (d *DefaultTool) Shutdown(ctx context.Context) error
Shutdown gracefully shuts down the server.
func (*DefaultTool) WithNotFoundHandler ¶ added in v0.1.283
func (d *DefaultTool) WithNotFoundHandler(ctx context.Context, x contract.HandlerFunc) error
WithNotFoundHandler sets the not found handler.
type Dependencies ¶
type Dependencies struct { RM *contract.RegistryMutex R contract.Registry SO contract.SemaphoreOperator RS contract.HTTPResponder F contract.FSysFileReader C contract.CertGenerator LOG contract.LogOperator ParsePathFn ParsePathFn ParseQueryFn ParseQueryFn RKeyFn KeyFn SvcKeyFn KeyFn }
type H2Conf ¶
type H2Conf struct { H2c bool FS fs.ReadFileFS Cert string Key string }
H2Conf holds optional TLS or H2C configuration.