Documentation ¶
Index ¶
- Constants
- Variables
- type AppClient
- type ClientFactory
- type ControlHandler
- type ControlHandlerFunc
- type Details
- type JSONWebsocketCodec
- func (j *JSONWebsocketCodec) Close() error
- func (j *JSONWebsocketCodec) ReadRequestBody(v interface{}) error
- func (j *JSONWebsocketCodec) ReadRequestHeader(r *rpc.Request) error
- func (j *JSONWebsocketCodec) ReadResponseBody(v interface{}) error
- func (j *JSONWebsocketCodec) ReadResponseHeader(r *rpc.Response) error
- func (j *JSONWebsocketCodec) WaitForReadError()
- func (j *JSONWebsocketCodec) WriteRequest(r *rpc.Request, v interface{}) error
- func (j *JSONWebsocketCodec) WriteResponse(r *rpc.Response, v interface{}) error
- type Message
- type MultiAppClient
- type Pipe
- type ProbeConfig
- type Publisher
- type ReportPublisher
- type Request
- type Resolver
- type Response
Constants ¶
const ScopeProbeIDHeader = "X-Scope-Probe-ID"
ScopeProbeIDHeader is the header we use to carry the probe's unique ID. The ID is currently set to the a random string on probe startup.
Variables ¶
var ( // AppPort is the default port that the app will use for its HTTP server. // The app publishes the API and user interface, and receives reports from // probes, on this port. AppPort = 4040 )
Functions ¶
This section is empty.
Types ¶
type AppClient ¶ added in v0.10.0
type AppClient interface { Details() (Details, error) ControlConnection() PipeConnection(string, Pipe) PipeClose(string) error Publish(r io.Reader) error Stop() }
AppClient is a client to an app for dealing with controls.
func NewAppClient ¶ added in v0.10.0
func NewAppClient(pc ProbeConfig, hostname, target string, control ControlHandler) (AppClient, error)
NewAppClient makes a new appClient.
type ClientFactory ¶ added in v0.10.0
ClientFactory is a thing thats makes AppClients
type ControlHandler ¶ added in v0.10.0
ControlHandler is interface used in the app and the probe to represent a control RPC.
type ControlHandlerFunc ¶ added in v0.10.0
ControlHandlerFunc is a adapter (ala golang's http RequestHandlerFunc) for ControlHandler
type Details ¶ added in v0.10.0
type Details struct { ID string `json:"id"` Version string `json:"version"` Hostname string `json:"hostname"` }
Details are some generic details that can be fetched from /api
type JSONWebsocketCodec ¶ added in v0.10.0
JSONWebsocketCodec is golang rpc compatible Server and Client Codec that transmits and receives RPC messages over a websocker, as JSON.
func NewJSONWebsocketCodec ¶ added in v0.10.0
func NewJSONWebsocketCodec(conn *websocket.Conn) *JSONWebsocketCodec
NewJSONWebsocketCodec makes a new JSONWebsocketCodec
func (*JSONWebsocketCodec) Close ¶ added in v0.10.0
func (j *JSONWebsocketCodec) Close() error
Close implements rpc.ClientCodec and rpc.ServerCodec
func (*JSONWebsocketCodec) ReadRequestBody ¶ added in v0.10.0
func (j *JSONWebsocketCodec) ReadRequestBody(v interface{}) error
ReadRequestBody implements rpc.ServerCodec
func (*JSONWebsocketCodec) ReadRequestHeader ¶ added in v0.10.0
func (j *JSONWebsocketCodec) ReadRequestHeader(r *rpc.Request) error
ReadRequestHeader implements rpc.ServerCodec
func (*JSONWebsocketCodec) ReadResponseBody ¶ added in v0.10.0
func (j *JSONWebsocketCodec) ReadResponseBody(v interface{}) error
ReadResponseBody implements rpc.ClientCodec
func (*JSONWebsocketCodec) ReadResponseHeader ¶ added in v0.10.0
func (j *JSONWebsocketCodec) ReadResponseHeader(r *rpc.Response) error
ReadResponseHeader implements rpc.ClientCodec
func (*JSONWebsocketCodec) WaitForReadError ¶ added in v0.10.0
func (j *JSONWebsocketCodec) WaitForReadError()
WaitForReadError blocks until any read on this codec returns an error. This is useful to know when the server has disconnected from the client.
func (*JSONWebsocketCodec) WriteRequest ¶ added in v0.10.0
func (j *JSONWebsocketCodec) WriteRequest(r *rpc.Request, v interface{}) error
WriteRequest implements rpc.ClientCodec
func (*JSONWebsocketCodec) WriteResponse ¶ added in v0.10.0
func (j *JSONWebsocketCodec) WriteResponse(r *rpc.Response, v interface{}) error
WriteResponse implements rpc.ServerCodec
type MultiAppClient ¶ added in v0.10.0
type MultiAppClient interface { Set(hostname string, endpoints []string) PipeConnection(appID, pipeID string, pipe Pipe) error PipeClose(appID, pipeID string) error Stop() Publish(io.Reader) error }
MultiAppClient maintains a set of upstream apps, and ensures we have an AppClient for each one.
func NewMultiAppClient ¶ added in v0.10.0
func NewMultiAppClient(clientFactory ClientFactory) MultiAppClient
NewMultiAppClient creates a new MultiAppClient.
type Pipe ¶ added in v0.11.0
type Pipe interface { Ends() (io.ReadWriter, io.ReadWriter) CopyToWebsocket(io.ReadWriter, *websocket.Conn) error Close() error Closed() bool OnClose(func()) }
Pipe is a bi-directional channel from someone thing in the probe to the UI.
type ProbeConfig ¶ added in v0.10.0
ProbeConfig contains all the info needed for a probe to do HTTP requests
type Publisher ¶
Publisher is something which can send a stream of data somewhere, probably to a remote collector.
type ReportPublisher ¶ added in v0.7.0
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 ¶ added in v0.7.0
func NewReportPublisher(publisher Publisher) *ReportPublisher
NewReportPublisher creates a new report publisher
type Resolver ¶ added in v0.10.0
type Resolver interface {
Stop()
}
Resolver is a thing that can be stopped...
func NewStaticResolver ¶ added in v0.10.0
NewStaticResolver periodically resolves the targets, and calls the set function with all the resolved IPs. It explictiy supports targets which resolve to multiple IPs.
type Response ¶ added in v0.10.0
type Response struct { Value interface{} `json:"value,omitempty"` Error string `json:"error,omitempty"` Pipe string `json:"pipe,omitempty"` RawTTY bool `json:"raw_tty,omitempty"` }
Response is the Probe -> App -> UI message type for the control RPCs.
func ResponseError ¶ added in v0.10.0
ResponseError creates a new Response with the given error.
func ResponseErrorf ¶ added in v0.10.0
ResponseErrorf creates a new Response with the given formatted error string.