Home Download Docs Code Community
import "perkeep/pkg/webserver/listen"
Overview
Index

Overview ▾

Index

func Listen(addr string) (net.Listener, error)
func Usage(name string) string
type Addr
    func NewFlag(flagName, defaultValue string, serverType string) *Addr
    func (a *Addr) Listen() (net.Listener, error)
    func (a *Addr) Set(v string) error
    func (a *Addr) String() string

Package files

listen.go

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>

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.

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
Website layout inspired by memcached.
Content by the authors.