listener

package
v0.0.0-...-50cd190 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2021 License: MIT Imports: 7 Imported by: 19

Documentation

Index

Constants

View Source
const ServerStarterEnvVarName = "SERVER_STARTER_PORT"

Variables

View Source
var (
	ErrNoListeningTarget = errors.New("no listening target")
)

Functions

func GetPortsSpecification

func GetPortsSpecification() string

GetPortsSpecification returns the value of SERVER_STARTER_PORT environment variable

func ListenAll

func ListenAll() ([]net.Listener, error)

ListenAll parses environment variable SERVER_STARTER_PORT, and creates net.Listener objects

Types

type List

type List []Listener

List holds a list of Listeners. This is here just for convenience so that you can do

list.String()

to get a string compatible with SERVER_STARTER_PORT

func (List) String

func (ll List) String() string

type Listener

type Listener interface {
	Fd() uintptr
	Listen() (net.Listener, error)
	String() string
}

Listener is the interface for things that listen on file descriptors specified by Start::Server / server_starter

func Ports

func Ports() ([]Listener, error)

Ports parses environment variable SERVER_STARTER_PORT

type TCPListener

type TCPListener struct {
	Addr string
	Port int
	// contains filtered or unexported fields
}

TCPListener is a listener for ... tcp duh.

func (TCPListener) Fd

func (l TCPListener) Fd() uintptr

Fd returns the underlying file descriptor

func (TCPListener) Listen

func (l TCPListener) Listen() (net.Listener, error)

Listen creates a new Listener

func (TCPListener) String

func (l TCPListener) String() string

type UnixListener

type UnixListener struct {
	Path string
	// contains filtered or unexported fields
}

UnixListener is a listener for unix sockets.

func (UnixListener) Fd

func (l UnixListener) Fd() uintptr

Fd returns the underlying file descriptor

func (UnixListener) Listen

func (l UnixListener) Listen() (net.Listener, error)

Listen creates a new Listener

func (UnixListener) String

func (l UnixListener) String() string

Jump to

Keyboard shortcuts

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