Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvUsage

func EnvUsage(f string, env string) string

    EnvUsage returns a standard usage message for the address flag -f that reads its default value from the environment variable env.

    Types

    type Address

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

      Address represents an address of the form hostname:port or a websocket URI.

      func New

      func New(s string) (*Address, error)

        New parses a hostname:port pair of the form "hostname[:port]" or "tcp://hostname[:port][/]", or a websocket URI of the form "ws://host/path". The returned address will have been validated.

        func NewTCP

        func NewTCP(hostname string, port int) (*Address, error)

          NewTCP returns a new address for the given tcp hostname and port number.

          func (*Address) EscapedPath

          func (a *Address) EscapedPath() string

            EscapedPath returns the escaped form of the path. In general there are multiple possible escaped forms of any path.

            func (*Address) HasPort

            func (a *Address) HasPort() bool

              HasPort returns true iff a port was specified.

              func (*Address) Hostname

              func (a *Address) Hostname() string

                Hostname returns the hostname.

                func (*Address) HostnameAndPort

                func (a *Address) HostnameAndPort() string

                  HostnameAndPort returns "hostname[:port]".

                  func (*Address) IsTCP

                  func (a *Address) IsTCP() bool

                    IsTCP returns true iff the address is a tcp address.

                    func (*Address) Port

                    func (a *Address) Port() int

                      Port returns the port number (this will be 0 if unspecified).

                      func (*Address) Scheme

                      func (a *Address) Scheme() string

                        Scheme returns the scheme.

                        func (*Address) String

                        func (a *Address) String() string

                          String returns a string representation of the address.

                          func (*Address) URI

                          func (a *Address) URI() string

                            URI returns the address as a URI.

                            type Flag

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

                              Flag defines an address flag. This satisfies the pcastools/flag.Flag interface.

                              func NewFlag

                              func NewFlag(name string, addr **Address, defaultAddr *Address, description string, usage string) *Flag

                                NewFlag represents an address flag with the given name, description, and usage string. It has backing variable addr, with default value defaultAddr.

                                func (*Flag) Description

                                func (f *Flag) Description() string

                                  Description returns a one-line description of this variable.

                                  func (*Flag) Name

                                  func (f *Flag) Name() string

                                    Name returns the flag name (without leading hyphen).

                                    func (*Flag) Parse

                                    func (f *Flag) Parse(in string) error

                                      Parse parses the string.

                                      func (*Flag) Usage

                                      func (f *Flag) Usage() string

                                        Usage returns long-form usage text (or the empty string if not set).

                                        Source Files