Documentation
¶
Index ¶
- Variables
- func NewTool(c Client, opts contract.ToolOptions[Client]) *defaultTool
- type Client
- type ClientOption
- func WithAddr(addr string) ClientOption
- func WithAllowedOrigins(origins []string) ClientOption
- func WithH2(h *H2Conf) ClientOption
- func WithIdleTimeout(d time.Duration) ClientOption
- func WithNotFoundHandler(h http.HandlerFunc) ClientOption
- func WithReadTimeout(d time.Duration) ClientOption
- func WithShutdownTimeout(d time.Duration) ClientOption
- func WithWriteTimeout(d time.Duration) ClientOption
- type ClientOptions
- type Dependencies
- type H2Conf
- type ParsePathFn
- type ParseQueryFn
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrServerAlreadyRunning = errors.New("server already running") ErrNilServerWhileTryingToServe = errors.New("server is nil while trying to serve") ErrNilServerWhileTryingToShutdown = errors.New("server is nil while trying to shutdown") ErrMissingParsePathFn = errors.New("missing parse path function") ErrMissingParseQueryFn = errors.New("missing parse query function") ErrMissingTLSCertAndKey = errors.New("tls config requires both cert and key") ErrMissingTLSFSReader = errors.New("tls config requires file system reader") ErrMissingTLSFS = errors.New("tls config requires file system") ErrMissingCertGenerator = errors.New("tls config requires cert generator") )
Functions ¶
Types ¶
type Client ¶
func NewClient ¶
func NewClient(d Dependencies, opts ClientOptions) (Client, error)
type ClientOption ¶
type ClientOption func(*ClientOptions)
func WithAddr ¶
func WithAddr(addr string) ClientOption
func WithAllowedOrigins ¶
func WithAllowedOrigins(origins []string) ClientOption
func WithH2 ¶
func WithH2(h *H2Conf) ClientOption
func WithIdleTimeout ¶
func WithIdleTimeout(d time.Duration) ClientOption
func WithNotFoundHandler ¶
func WithNotFoundHandler(h http.HandlerFunc) ClientOption
func WithReadTimeout ¶
func WithReadTimeout(d time.Duration) ClientOption
func WithShutdownTimeout ¶
func WithShutdownTimeout(d time.Duration) ClientOption
func WithWriteTimeout ¶
func WithWriteTimeout(d 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 http.HandlerFunc
}
func ApplyClientOptions ¶
func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions
type Dependencies ¶
type Dependencies struct {
RM *contract.RegistryMutex
R contract.Registry
SO contract.SemaphoreOperator
RS contract.HTTPResponder
ParsePathFn ParsePathFn
ParseQueryFn ParseQueryFn
}
type H2Conf ¶
type H2Conf struct {
H2c bool
F contract.FSysFileReader
C contract.CertGenerator
FS fs.ReadFileFS
Cert string
Key string
}
H2Conf holds optional TLS or H2C configuration.
Click to show internal directories.
Click to hide internal directories.