server

package
v1.235.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 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"`
	Port    string        `yaml:"port,omitempty" json:"port,omitempty" toml:"port,omitempty"`
}

Config for server.

func (*Config) GetPort added in v1.203.0

func (c *Config) GetPort(port string) string

GetPort 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