client

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package client contains the components and utilities that every Fleetspeak client should include.

Index

Constants

View Source
const (
	// SuicideExitCode is used as a distinctive exit code to signify a client committing suicide.
	SuicideExitCode = 7
)

Variables

View Source
var (
	// StatsSamplePeriod is the frequency with which resource-usage data for the Fleetspeak
	// process will be fetched from the OS.
	StatsSamplePeriod = 30 * time.Second

	// StatsSampleSize is the number of resource-usage query results that get aggregated into
	// a single resource-usage report sent to Fleetspeak servers.
	StatsSampleSize = 20
)

Functions

This section is empty.

Types

type Client

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

A Client is an active fleetspeak client instance.

func New

func New(cfg config.Configuration, cmps Components) (*Client, error)

New creates a new Client object based on the provided components.

clientLabels becomes a list of hardcoded labels of the form "client:<label>", which is reported to the server as an initial set of labels for this client. In addition to those provided to NewClient, the client will also include labels indicating the CPU architecture and OS that the client was build for (based on runtime.GOARCH and runtime.GOOS).

TODO: Add support for multiple Communicators.

func (*Client) ProcessMessage

func (c *Client) ProcessMessage(ctx context.Context, am service.AckMessage) (err error)

ProcessMessage accepts a message into the Fleetspeak system.

If m is for a service on the local client it will ask the service to process it. If m for the a server component, it will queue up the message to be delivered to the server. Fleetspeak does not support direct messages from one client to another.

func (*Client) Stop

func (c *Client) Stop()

Stop shuts the client down gracefully. This includes stopping all communicators and services.

type Components

type Components struct {
	Communicator     comms.Communicator         // Required to communicate with a Fleetspeak server.
	ServiceFactories map[string]service.Factory // Required to instantiate any local services.
	Signers          []signer.Signer            // If set, will be given a chance to sign data before sending it to the server.
	Filter           *flow.Filter               // If set, will be used to filter messages to the server.
	Stats            stats.Collector
}

Components gathers the plug-ins used to instantiate a Fleetspeak Client.

Directories

Path Synopsis
Package channel provides fleetspeak.Message passing over interprocess pipes.
Package channel provides fleetspeak.Message passing over interprocess pipes.
Package clienttestutils contains utility functions for the client test, in part platform-specific.
Package clienttestutils contains utility functions for the client test, in part platform-specific.
Package clitesting contains utilities useful for testing clients and client components.
Package clitesting contains utilities useful for testing clients and client components.
Package comms defines the interface between the Fleetspeak client base library and the Communicator component used to talk to the server.
Package comms defines the interface between the Fleetspeak client base library and the Communicator component used to talk to the server.
Package config defines structures and definitions relating to the client's configuration.
Package config defines structures and definitions relating to the client's configuration.
Package daemonservice implements a service which runs and communicates with a separate daemon subprocess.
Package daemonservice implements a service which runs and communicates with a separate daemon subprocess.
client
Package client is a go client library for daemonservice.
Package client is a go client library for daemonservice.
command
Package command provides a relatively thin wrapper around exec.Cmd, adding support for communicating with the dependent process using a channel.Channel.
Package command provides a relatively thin wrapper around exec.Cmd, adding support for communicating with the dependent process using a channel.Channel.
execution
Package execution provides an abstraction for a single execution of a command with the context of daemonservice.
Package execution provides an abstraction for a single execution of a command with the context of daemonservice.
testclient
Package testclient implements a daemonservice client meant for testing.
Package testclient implements a daemonservice client meant for testing.
Package flow contains structures and utility method relating to client-server flow control configuration.
Package flow contains structures and utility method relating to client-server flow control configuration.
Package generic provides support methods to build a generic client, not bound to a particular installation.
Package generic provides support methods to build a generic client, not bound to a particular installation.
Package https provides comms.Communicator implementations which connect to the Fleetspeak server using HTTPS.
Package https provides comms.Communicator implementations which connect to the Fleetspeak server using HTTPS.
internal
config
Package config contains internal structures and methods relating to managing a client's configuration.
Package config contains internal structures and methods relating to managing a client's configuration.
message
Package message implements utility structures and methods used by the FS client to manage messages.
Package message implements utility structures and methods used by the FS client to manage messages.
monitoring
Package monitoring contains utilities for gathering data about resource usage in order to monitor client-side resource usage.
Package monitoring contains utilities for gathering data about resource usage in order to monitor client-side resource usage.
process
Package process encapsulates OS-independent process management helpers.
Package process encapsulates OS-independent process management helpers.
proto
Package service defines the interface that fleetspeak client side services must implement, along with some related types.
Package service defines the interface that fleetspeak client side services must implement, along with some related types.
Package signer defines an interface to add additional signatures to communications with the Fleetspeak server.
Package signer defines an interface to add additional signatures to communications with the Fleetspeak server.
Package socketservice implements a service which runs and communicates with a separate independent process over a local unix socket (or similar).
Package socketservice implements a service which runs and communicates with a separate independent process over a local unix socket (or similar).
checks
Package checks implements code which checks permissions of socket files to mitigate the possibility of a non-root attacker messing with socketservice communications channel.
Package checks implements code which checks permissions of socket files to mitigate the possibility of a non-root attacker messing with socketservice communications channel.
client
Package client is a go client library for socketservice.Service.
Package client is a go client library for socketservice.Service.
testclient
Package testclient implements a socketservice client meant for testing.
Package testclient implements a socketservice client meant for testing.
Package stats contains interfaces and utilities relating to the collection of statistics from a fleetspeak client.
Package stats contains interfaces and utilities relating to the collection of statistics from a fleetspeak client.
Package stdinservice implements a service which, on request, executes a command on the client, passes data to its stdin and returns the result.
Package stdinservice implements a service which, on request, executes a command on the client, passes data to its stdin and returns the result.
Package watchdog implements a simple watchdog timer which dumps a trace of all goroutines to a file, and then ends the program, if the timer reaches its limit.
Package watchdog implements a simple watchdog timer which dumps a trace of all goroutines to a file, and then ends the program, if the timer reaches its limit.

Jump to

Keyboard shortcuts

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