server

package
v1.298.0 Latest Latest
Warning

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

Go to latest
Published: Sep 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.

Types

type Config

type Config struct {
	Retry   *retry.Config `yaml:"retry,omitempty" json:"retry,omitempty" toml:"retry,omitempty"`
	TLS     *tls.Config   `yaml:"tls,omitempty" json:"tls,omitempty" toml:"tls,omitempty"`
	Timeout string        `yaml:"timeout,omitempty" json:"timeout,omitempty" toml:"timeout,omitempty"`
	Address string        `yaml:"address,omitempty" json:"address,omitempty" toml:"address,omitempty"`
}

Config for server.

func (*Config) GetAddress added in v1.266.0

func (c *Config) GetAddress(address string) string

GetAddress or default.

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