listener

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: MIT Imports: 7 Imported by: ? modules, 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

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