Index | Files

package listen

import ""


Package Files


func Listen Uses

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

Listen is a replacement for net.Listen and supports

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

Listeners are always TCP.

func Usage Uses

func Usage(name string) string

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

type Addr Uses

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"))
webListener, err := webPort.Listen()

func NewFlag Uses

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

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

func (*Addr) Listen Uses

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

Listen returns the address's TCP listener.

func (*Addr) Set Uses

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

Set implements the flag.Value interface.

func (*Addr) String Uses

func (a *Addr) String() string

Package listen imports 8 packages (graph) and is imported by 1 packages. Updated 2019-06-18. Refresh now. Tools for package owners.