server

package
v1.202.3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEnabled added in v1.143.2

func IsEnabled(cfg *Config) bool

IsEnabled for server.

func UserAgent added in v1.145.0

func UserAgent(cfg *Config) string

UserAgent for server.

Types

type Config

type Config struct {
	Timeout   string        `yaml:"timeout,omitempty" json:"timeout,omitempty" toml:"timeout,omitempty"`
	Port      string        `yaml:"port,omitempty" json:"port,omitempty" toml:"port,omitempty"`
	Retry     *retry.Config `yaml:"retry,omitempty" json:"retry,omitempty" toml:"retry,omitempty"`
	TLS       *tls.Config   `yaml:"tls,omitempty" json:"tls,omitempty" toml:"tls,omitempty"`
	UserAgent string        `yaml:"user_agent,omitempty" json:"user_agent,omitempty" toml:"user_agent,omitempty"`
}

Config for server.

type Server added in v1.169.0

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

Server is a generic server.

func NewServer added in v1.169.0

func NewServer(svc string, srv Serverer, logger *zap.Logger, sh fx.Shutdowner) *Server

NewServer that can start and stop an underlying server.

func (*Server) Start added in v1.169.0

func (s *Server) Start()

Start the server.

func (*Server) Stop added in v1.169.0

func (s *Server) Stop(ctx context.Context)

Stop the server.

type Serverer added in v1.169.0

type Serverer interface {
	fmt.Stringer

	// IsEnabled the underlying server.
	IsEnabled() bool

	// Serve the underlying server.
	Serve() error

	// Shutdown the underlying server.
	Shutdown(ctx context.Context) error
}

Serverer allows transports to create their own.

Jump to

Keyboard shortcuts

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