server

package
v1.178.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 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(c *Config) bool

IsEnabled for server.

func UserAgent added in v1.145.0

func UserAgent(c *Config) string

UserAgent for server.

Types

type Config

type Config struct {
	Security  *security.Config `yaml:"security,omitempty" json:"security,omitempty" toml:"security,omitempty"`
	Port      string           `yaml:"port,omitempty" json:"port,omitempty" toml:"port,omitempty"`
	Retry     *retry.Config    `yaml:"retry,omitempty" json:"retry,omitempty" toml:"retry,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