app

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2016 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UIEnd = iota
	ProbeEnd
)

Valid values of type End

View Source
const (
	DefaultHostname       = "scope.weave.local."
	DefaultWeaveURL       = "http://127.0.0.1:6784"
	DefaultContainerName  = "weavescope"
	DefaultDockerEndpoint = "unix:///var/run/docker.sock"
)

Default values for weave app integration

View Source
const RequestCtxKey = "request"

RequestCtxKey is key used for request entry in context

Variables

View Source
var (
	// Version - set at buildtime.
	Version = "dev"

	// UniqueID - set at runtime.
	UniqueID = "0"
)

Functions

func RegisterControlRoutes

func RegisterControlRoutes(router *mux.Router, cr ControlRouter)

RegisterControlRoutes registers the various control routes with a http mux.

func RegisterPipeRoutes

func RegisterPipeRoutes(router *mux.Router, pr PipeRouter)

RegisterPipeRoutes registers the pipe routes

func RegisterReportPostHandler

func RegisterReportPostHandler(a Adder, router *mux.Router)

RegisterReportPostHandler registers the handler for report submission

func TopologyHandler added in v0.12.0

func TopologyHandler(c Reporter, preRoutes *mux.Router, postRoutes http.Handler) http.Handler

TopologyHandler registers the various topology routes with a http mux.

The returned http.Handler has to be passed directly to http.ListenAndServe, and cannot be nested inside another gorrilla.mux.

Routes which should be matched before the topology routes should be added to a router and passed in preRoutes. Routes to be matches after topology routes should be added to a router and passed to postRoutes.

func URLMatcher

func URLMatcher(pattern string) mux.MatcherFunc

URLMatcher uses request.RequestURI (the raw, unparsed request) to attempt to match pattern. It does this as go's URL.Parse method is broken, and mistakenly unescapes the Path before parsing it. This breaks %2F (encoded forward slashes) in the paths.

Types

type APINode

type APINode struct {
	Node detailed.Node `json:"node"`
}

APINode is returned by the /api/topology/{name}/{id} handler.

type APITopology

type APITopology struct {
	Nodes render.RenderableNodes `json:"nodes"`
}

APITopology is returned by the /api/topology/{name} handler.

type APITopologyDesc

type APITopologyDesc struct {
	Name    string                         `json:"name"`
	Rank    int                            `json:"rank"`
	Options map[string][]APITopologyOption `json:"options"`

	URL           string            `json:"url"`
	SubTopologies []APITopologyDesc `json:"sub_topologies,omitempty"`
	Stats         topologyStats     `json:"stats,omitempty"`
	// contains filtered or unexported fields
}

APITopologyDesc is returned in a list by the /api/topology handler.

type APITopologyOption

type APITopologyOption struct {
	Value   string `json:"value"`
	Display string `json:"display"`
	Default bool   `json:"default,omitempty"`
	// contains filtered or unexported fields
}

APITopologyOption describes a &param=value to a given topology.

type Adder

type Adder interface {
	Add(context.Context, report.Report)
}

Adder is something that can accept reports. It's a convenient interface for parts of the app, and several experimental components.

type Collector

type Collector interface {
	Reporter
	Adder
}

A Collector is a Reporter and an Adder

func NewCollector

func NewCollector(window time.Duration) Collector

NewCollector returns a collector ready for use.

type ControlRouter added in v0.13.0

type ControlRouter interface {
	Handle(ctx context.Context, probeID string, req xfer.Request) (xfer.Response, error)
	Register(ctx context.Context, probeID string, handler xfer.ControlHandlerFunc) (int64, error)
	Deregister(ctx context.Context, probeID string, id int64) error
}

ControlRouter is a thing that can route control requests and responses between the UI and a probe.

func NewLocalControlRouter added in v0.13.0

func NewLocalControlRouter() ControlRouter

NewLocalControlRouter creates a new ControlRouter that does everything locally, in memory.

type CtxHandlerFunc added in v0.13.0

type CtxHandlerFunc func(context.Context, http.ResponseWriter, *http.Request)

CtxHandlerFunc is a http.HandlerFunc, with added contexts

type DockerClient added in v0.13.0

type DockerClient interface {
	ListContainers(fsouza.ListContainersOptions) ([]fsouza.APIContainers, error)
}

DockerClient is the little bit of the docker client we need.

type End added in v0.13.0

type End int

End is an enum for either end of the pipe.

type Interface added in v0.13.0

type Interface struct {
	Name  string
	Addrs []net.Addr
}

Interface is because net.Interface isn't mockable.

func Interfaces added in v0.13.0

func Interfaces() ([]Interface, error)

Interfaces returns the list of Interfaces on the machine.

type InterfaceFunc added in v0.13.0

type InterfaceFunc func() ([]Interface, error)

InterfaceFunc is the type of Interfaces()

type PipeRouter

type PipeRouter interface {
	Get(context.Context, string, End) (xfer.Pipe, io.ReadWriter, bool)
	Release(context.Context, string, End)
	Delete(context.Context, string)
	Stop()
}

PipeRouter stores pipes and allows you to connect to either end of them.

func NewLocalPipeRouter added in v0.13.0

func NewLocalPipeRouter() PipeRouter

NewLocalPipeRouter returns a new local (in-memory) pipe router.

type Reporter

type Reporter interface {
	Report(context.Context) report.Report
	WaitOn(context.Context, chan struct{})
	UnWait(context.Context, chan struct{})
}

Reporter is something that can produce reports on demand. It's a convenient interface for parts of the app, and several experimental components.

type WeaveClient added in v0.13.0

type WeaveClient interface {
	AddDNSEntry(hostname, containerid string, ip net.IP) error
	Expose() error
}

WeaveClient is the little bit of the weave clent we need.

type WeavePublisher added in v0.13.0

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

WeavePublisher is a thing which periodically registers this app with WeaveDNS.

func NewWeavePublisher added in v0.13.0

func NewWeavePublisher(weaveClient WeaveClient, dockerClient DockerClient, interfaces InterfaceFunc, hostname, containerName string) *WeavePublisher

NewWeavePublisher makes a new Weave.

func (*WeavePublisher) Stop added in v0.13.0

func (w *WeavePublisher) Stop()

Stop the Weave.

Jump to

Keyboard shortcuts

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