appclient

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2018 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupUsing added in v0.13.0

func LookupUsing(dnsServer string) func(host string) (ips []net.IP, err error)

LookupUsing produces a LookupIP function for the given DNS server.

Types

type AppClient

type AppClient interface {
	Details() (xfer.Details, error)
	ControlConnection()
	PipeConnection(string, xfer.Pipe)
	PipeClose(string) error
	Publish(io.Reader, bool) error
	Target() url.URL
	ReTarget(url.URL)
	Stop()
}

AppClient is a client to an app, dealing with report publishing, controls and pipes.

func NewAppClient

func NewAppClient(pc ProbeConfig, hostname string, target url.URL, control xfer.ControlHandler) (AppClient, error)

NewAppClient makes a new appClient.

type ClientFactory

type ClientFactory func(string, url.URL) (AppClient, error)

ClientFactory is a thing thats makes AppClients

type LookupIP added in v0.13.0

type LookupIP func(host string) (ips []net.IP, err error)

LookupIP type is used for looking up IPs.

type MultiAppClient

type MultiAppClient interface {
	Set(hostname string, urls []url.URL)
	PipeConnection(appID, pipeID string, pipe xfer.Pipe) error
	PipeClose(appID, pipeID string) error
	Stop()
	Publish(io.Reader, bool) error
}

MultiAppClient maintains a set of upstream apps, and ensures we have an AppClient for each one.

func NewMultiAppClient

func NewMultiAppClient(clientFactory ClientFactory, noControls bool) MultiAppClient

NewMultiAppClient creates a new MultiAppClient.

type ProbeConfig

type ProbeConfig struct {
	Token        string
	ProbeVersion string
	ProbeID      string
	Insecure     bool
}

ProbeConfig contains all the info needed for a probe to do HTTP requests

type Publisher

type Publisher interface {
	Publish(io.Reader, bool) error
	Stop()
}

Publisher is something which can send a stream of data somewhere, probably to a remote collector.

type ReportPublisher

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

A ReportPublisher uses a buffer pool to serialise reports, which it then passes to a publisher

func NewReportPublisher

func NewReportPublisher(publisher Publisher, noControls bool) *ReportPublisher

NewReportPublisher creates a new report publisher

func (*ReportPublisher) Publish

func (p *ReportPublisher) Publish(r report.Report) error

Publish serialises and compresses a report, then passes it to a publisher

type Resolver

type Resolver interface {
	Stop()
}

Resolver is a thing that can be stopped...

func NewResolver added in v0.13.0

func NewResolver(config ResolverConfig) (Resolver, error)

NewResolver periodically resolves the targets, and calls the set function with all the resolved IPs. It explictiy supports targets which resolve to multiple IPs. It uses the supplied DNS server name.

type ResolverConfig added in v1.0.0

type ResolverConfig struct {
	Targets []Target
	Set     func(string, []url.URL)

	// Optional
	Lookup LookupIP
	Ticker func(time.Duration) <-chan time.Time
}

ResolverConfig is the config for a resolver.

type Target added in v1.0.0

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

Target is a parsed representation of the app location.

func ParseTargets added in v1.0.0

func ParseTargets(urls []string) ([]Target, error)

ParseTargets deals with missing information in the targets string, defaulting the scheme, port etc.

func (Target) String added in v1.0.0

func (t Target) String() string

Jump to

Keyboard shortcuts

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