pkg

package
v0.5.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2014 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForceGosched

func ForceGosched()

WARNING: This is a hack. Remove this when we are able to block/check the status of the go-routines.

func SetFlagsFromEnv

func SetFlagsFromEnv(fs *flag.FlagSet)

SetFlagsFromEnv parses all registered flags in the given flagset, and if they are not already set it attempts to set their values from environment variables. Environment variables take the name of the flag but are UPPERCASE, have the prefix "ETCD_", and any dashes are replaced by underscores - for example: some-flag => ETCD_SOME_FLAG

func URLsFromFlags

func URLsFromFlags(fs *flag.FlagSet, urlsFlagName string, addrFlagName string, tlsInfo transport.TLSInfo) ([]url.URL, error)

URLsFromFlags decides what URLs should be using two different flags as datasources. The first flag's Value must be of type URLs, while the second must be of type IPAddressPort. If both of these flags are set, an error will be returned. If only the first flag is set, the underlying url.URL objects will be returned unmodified. If the second flag happens to be set, the underlying IPAddressPort will be converted to a url.URL and returned. The Scheme of the returned url.URL will be http unless the provided TLSInfo object is non-empty. If neither of the flags have been explicitly set, the default value of the first flag will be returned unmodified.

func UsageWithIgnoredFlagsFunc

func UsageWithIgnoredFlagsFunc(fs *flag.FlagSet, ignore []string) func()

Types

type CORSHandler

type CORSHandler struct {
	Handler http.Handler
	Info    *CORSInfo
}

func (*CORSHandler) ServeHTTP

func (h *CORSHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP adds the correct CORS headers based on the origin and returns immediately with a 200 OK if the method is OPTIONS.

type CORSInfo

type CORSInfo map[string]bool

func (CORSInfo) OriginAllowed

func (c CORSInfo) OriginAllowed(origin string) bool

OriginAllowed determines whether the server will allow a given CORS origin.

func (*CORSInfo) Set

func (ci *CORSInfo) Set(s string) error

CORSInfo implements the flag.Value interface to allow users to define a list of CORS origins

func (*CORSInfo) String

func (ci *CORSInfo) String() string

type DeprecatedFlag

type DeprecatedFlag struct {
	Name string
}

DeprecatedFlag encapsulates a flag that may have been previously valid but is now deprecated. If a DeprecatedFlag is set, an error occurs.

func (*DeprecatedFlag) Set

func (f *DeprecatedFlag) Set(_ string) error

func (*DeprecatedFlag) String

func (f *DeprecatedFlag) String() string

type IgnoredFlag

type IgnoredFlag struct {
	Name string
}

IgnoredFlag encapsulates a flag that may have been previously valid but is now ignored. If an IgnoredFlag is set, a warning is printed and operation continues.

func (*IgnoredFlag) IsBoolFlag

func (f *IgnoredFlag) IsBoolFlag() bool

IsBoolFlag is defined to allow the flag to be defined without an argument

func (*IgnoredFlag) Set

func (f *IgnoredFlag) Set(s string) error

func (*IgnoredFlag) String

func (f *IgnoredFlag) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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