listener

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr string    `yaml:"address" json:"address"`
	TLS  TLSConfig `yaml:"tls" json:"tls"`
}

func (*Config) Validate

func (c *Config) Validate() error

type Listener

type Listener interface {
	AddCloseFunc(f func())
	Close() error
	Accept() (net.Conn, error)
	Addr() net.Addr
}

func New

func New(config Config, fileWatcher *fsnotify.Watcher, logger log.Logger) (Listener, error)

NewServer instantiates a listen server. When passing addr with an unspecified port or ":", use Addr().

type Server

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

Server handles gRPC requests to the service.

func (*Server) Accept

func (s *Server) Accept() (net.Conn, error)

func (*Server) AddCloseFunc

func (s *Server) AddCloseFunc(f func())

AddCloseFunc adds a function to be called by the Close method. This eliminates the need for wrapping the Server.

func (*Server) Addr

func (s *Server) Addr() net.Addr

func (*Server) Close

func (s *Server) Close() error

type TLSConfig

type TLSConfig struct {
	Enabled       bool `yaml:"enabled" json:"enabled"`
	server.Config `yaml:",inline"`
}

func (*TLSConfig) Validate

func (c *TLSConfig) Validate() error

Jump to

Keyboard shortcuts

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