listener

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

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