server

package
v0.0.0-...-35a4376 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Port int    `json:"port" yaml:"port"`
	Host string `json:"host" yaml:"host"`

	Redirect redirect_config.RedirectConfig `json:"redirect" yaml:"redirect"`

	TLS *tls_config.TLSConfig `json:"tls" yaml:"tls"`
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(opts ...ConfigOption) *Config

func (*Config) APIAddress

func (c *Config) APIAddress() string

func (*Config) Listener

func (c *Config) Listener() (net.Listener, error)

func (*Config) ValidateConfigFields

func (c *Config) ValidateConfigFields() error

type ConfigOption

type ConfigOption func(*Config)

func WithAPIHost

func WithAPIHost(host string) ConfigOption

func WithAPIPort

func WithAPIPort(port int) ConfigOption

func WithRedirectConfig

func WithRedirectConfig(redirectConfig redirect_config.RedirectConfig) ConfigOption

func WithTLSConfig

func WithTLSConfig(tlsConfig *tls_config.TLSConfig) ConfigOption

type Server

type Server interface {
	Start() error
	StartAsync(fatalOnError bool) chan error
	Stop(context.Context) error
}

func NewServer

func NewServer(srv ServerCloser, config *Config, logger log.Logger) Server

type ServerCloser

type ServerCloser interface {
	Type() string
	Serve(l net.Listener) error
	Shutdown(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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