listen

package
v0.0.0-...-a5a65f0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2017 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Listen

func Listen(addr string) (net.Listener, error)

Listen is a replacement for net.Listen and supports

port, :port, ip:port, FD:<fd_num>, ADDR:<name>

Listeners are always TCP.

func Usage

func Usage(name string) string

Usage returns a descriptive usage message for a flag given the name of thing being addressed.

Types

type Addr

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

Addr is a flag variable. Use like:

var webPort listen.Addr
flag.Var(&webPort, "web_addr", listen.Usage("Web server address"))
flag.Parse()
webListener, err := webPort.Listen()

func NewFlag

func NewFlag(flagName, defaultValue string, serverType string) *Addr

NewFlag returns a flag that implements the flag.Value interface.

func (*Addr) Listen

func (a *Addr) Listen() (net.Listener, error)

Listen returns the address's TCP listener.

func (*Addr) Set

func (a *Addr) Set(v string) error

Set implements the flag.Value interface.

func (*Addr) String

func (a *Addr) String() string

Jump to

Keyboard shortcuts

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