server

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: 35 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Components

type Components struct {
	Datastore        db.Store                   // Required, used to store all server state.
	ServiceFactories map[string]service.Factory // Required, used to configure services according to the ServerConfig.
	Communicators    []comms.Communicator       // Required to communicate with clients.
	Stats            stats.Collector            // If set, will be notified about interesting events.
	Authorizer       authorizer.Authorizer      // If set, will control and validate contacts from clients.

	// If set, these will be used by Fleetspeak servers to pass simple
	// notifications between themselves. Currently only important when using
	// streaming connections with multiple servers.
	Notifier notifications.Notifier
	Listener notifications.Listener

	HealthCheck *http.Server

	Admin *grpc.Server
}

Components gathers the external components required to instantiate a Fleetspeak Server.

type MonitoredDatastore

type MonitoredDatastore struct {
	D db.Store
	C stats.Collector
}

A MonitoredDatastore wraps a base Datastore and collects statistics about all datastore operations.

func (MonitoredDatastore) AddClient

func (d MonitoredDatastore) AddClient(ctx context.Context, id common.ClientID, data *db.ClientData) error

func (MonitoredDatastore) AddClientLabel

func (d MonitoredDatastore) AddClientLabel(ctx context.Context, id common.ClientID, l *fspb.Label) error

func (MonitoredDatastore) BlacklistClient

func (d MonitoredDatastore) BlacklistClient(ctx context.Context, id common.ClientID) error

func (MonitoredDatastore) CleanupAllocation

func (d MonitoredDatastore) CleanupAllocation(ctx context.Context, bid ids.BroadcastID, aid ids.AllocationID) error

func (MonitoredDatastore) ClientMessagesForProcessing

func (d MonitoredDatastore) ClientMessagesForProcessing(ctx context.Context, id common.ClientID, lim uint64, serviceLimits map[string]uint64) ([]*fspb.Message, error)

func (MonitoredDatastore) Close

func (d MonitoredDatastore) Close() error

func (MonitoredDatastore) CreateAllocation

func (d MonitoredDatastore) CreateAllocation(ctx context.Context, id ids.BroadcastID, frac float32, expiry time.Time) (*db.AllocationInfo, error)

func (MonitoredDatastore) CreateBroadcast

func (d MonitoredDatastore) CreateBroadcast(ctx context.Context, b *spb.Broadcast, limit uint64) error

func (MonitoredDatastore) DeletePendingMessages

func (d MonitoredDatastore) DeletePendingMessages(ctx context.Context, ids []common.ClientID) error

func (MonitoredDatastore) FetchResourceUsageRecords

func (d MonitoredDatastore) FetchResourceUsageRecords(ctx context.Context, id common.ClientID, startTimestamp, endTimestamp *tspb.Timestamp) ([]*spb.ClientResourceUsageRecord, error)

func (MonitoredDatastore) GetClientData

func (d MonitoredDatastore) GetClientData(ctx context.Context, id common.ClientID) (*db.ClientData, error)

func (MonitoredDatastore) GetMessageResult

func (d MonitoredDatastore) GetMessageResult(ctx context.Context, id common.MessageID) (*fspb.MessageResult, error)

func (MonitoredDatastore) GetMessages

func (d MonitoredDatastore) GetMessages(ctx context.Context, ids []common.MessageID, wantData bool) ([]*fspb.Message, error)

func (MonitoredDatastore) GetPendingMessageCount

func (d MonitoredDatastore) GetPendingMessageCount(ctx context.Context, ids []common.ClientID) (uint64, error)

func (MonitoredDatastore) GetPendingMessages

func (d MonitoredDatastore) GetPendingMessages(ctx context.Context, ids []common.ClientID, offset uint64, limit uint64, wantData bool) ([]*fspb.Message, error)

func (MonitoredDatastore) IsNotFound

func (d MonitoredDatastore) IsNotFound(err error) bool

func (MonitoredDatastore) LinkMessagesToContact

func (d MonitoredDatastore) LinkMessagesToContact(ctx context.Context, contact db.ContactID, msgs []common.MessageID) error

func (MonitoredDatastore) ListActiveBroadcasts

func (d MonitoredDatastore) ListActiveBroadcasts(ctx context.Context) ([]*db.BroadcastInfo, error)

func (MonitoredDatastore) ListClientContacts

func (d MonitoredDatastore) ListClientContacts(ctx context.Context, id common.ClientID) ([]*spb.ClientContact, error)

func (MonitoredDatastore) ListClients

func (d MonitoredDatastore) ListClients(ctx context.Context, ids []common.ClientID) ([]*spb.Client, error)

func (MonitoredDatastore) ListSentBroadcasts

func (d MonitoredDatastore) ListSentBroadcasts(ctx context.Context, id common.ClientID) ([]ids.BroadcastID, error)

func (MonitoredDatastore) ReadFile

func (d MonitoredDatastore) ReadFile(ctx context.Context, service, name string) (db.ReadSeekerCloser, time.Time, error)

func (MonitoredDatastore) RecordClientContact

func (d MonitoredDatastore) RecordClientContact(ctx context.Context, data db.ContactData) (db.ContactID, error)

func (MonitoredDatastore) RecordResourceUsageData

func (d MonitoredDatastore) RecordResourceUsageData(ctx context.Context, id common.ClientID, rud *mpb.ResourceUsageData) error

func (MonitoredDatastore) RegisterMessageProcessor

func (d MonitoredDatastore) RegisterMessageProcessor(mp db.MessageProcessor)

func (MonitoredDatastore) RemoveClientLabel

func (d MonitoredDatastore) RemoveClientLabel(ctx context.Context, id common.ClientID, l *fspb.Label) error

func (MonitoredDatastore) SaveBroadcastMessage

func (d MonitoredDatastore) SaveBroadcastMessage(ctx context.Context, msg *fspb.Message, bid ids.BroadcastID, cid common.ClientID, aid ids.AllocationID) error

func (MonitoredDatastore) SetBroadcastLimit

func (d MonitoredDatastore) SetBroadcastLimit(ctx context.Context, id ids.BroadcastID, limit uint64) error

func (MonitoredDatastore) SetMessageResult

func (d MonitoredDatastore) SetMessageResult(ctx context.Context, dest common.ClientID, id common.MessageID, res *fspb.MessageResult) error

func (MonitoredDatastore) StatFile

func (d MonitoredDatastore) StatFile(ctx context.Context, service, name string) (time.Time, error)

func (MonitoredDatastore) StopMessageProcessor

func (d MonitoredDatastore) StopMessageProcessor()

func (MonitoredDatastore) StoreFile

func (d MonitoredDatastore) StoreFile(ctx context.Context, service, name string, data io.Reader) error

func (MonitoredDatastore) StoreMessages

func (d MonitoredDatastore) StoreMessages(ctx context.Context, msgs []*fspb.Message, contact db.ContactID) error

func (MonitoredDatastore) StreamClientContacts

func (d MonitoredDatastore) StreamClientContacts(ctx context.Context, id common.ClientID, callback func(*spb.ClientContact) error) error

func (MonitoredDatastore) StreamClientIds

func (d MonitoredDatastore) StreamClientIds(ctx context.Context, includeBlacklisted bool, lastContactAfter *time.Time, callback func(common.ClientID) error) error

type Server

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

A Server is an active fleetspeak server instance.

func MakeServer

func MakeServer(c *spb.ServerConfig, sc Components) (*Server, error)

MakeServer builds and initializes a fleetspeak server using the provided components.

func (*Server) Stop

func (s *Server) Stop()

Stop shuts down the server.

Directories

Path Synopsis
Package admin defines an administrative interface into the fleetspeak system.
Package admin defines an administrative interface into the fleetspeak system.
Package authorizer defines interfaces and utility methods to validate and limit client communications.
Package authorizer defines interfaces and utility methods to validate and limit client communications.
Package comms defines the interface used by the Fleetspeak modules which communicate with clients.
Package comms defines the interface used by the Fleetspeak modules which communicate with clients.
Package components defines and instantiates the components needed by a generic Fleetspeak server.
Package components defines and instantiates the components needed by a generic Fleetspeak server.
authorizer
Package authorizer provide generic implementations and utility methods for Fleetspeak's authorizer component type.
Package authorizer provide generic implementations and utility methods for Fleetspeak's authorizer component type.
https
Package https provides generic implementations and utility methods for Fleetspeak https communication component type.
Package https provides generic implementations and utility methods for Fleetspeak https communication component type.
notifications
Package notifications defines basic Listener/Notification support for generic Fleetspeak servers.
Package notifications defines basic Listener/Notification support for generic Fleetspeak servers.
Package db defines the interface that fleetspeak expects from its persistence layer.
Package db defines the interface that fleetspeak expects from its persistence layer.
Package grpcservice defines a service.Service which passes all received messages to a destination host using grpc.
Package grpcservice defines a service.Service which passes all received messages to a destination host using grpc.
client/testing
Package main tests a fleetspeak server talking through a grpcserver to a python loopback process.
Package main tests a fleetspeak server talking through a grpcserver to a python loopback process.
Package https implements an https-based server Communicator.
Package https implements an https-based server Communicator.
Package ids defines identifier types and utility methods specific to the fleetspeak server and server components.
Package ids defines identifier types and utility methods specific to the fleetspeak server and server components.
internal
broadcasts
Package broadcasts contains code for a Fleetspeak server to manage broadcasts.
Package broadcasts contains code for a Fleetspeak server to manage broadcasts.
cache
Package cache contains caching structures using internally by the Fleetspeak server.
Package cache contains caching structures using internally by the Fleetspeak server.
ftime
Package ftime defines "fleetspeak time" as a global variable.
Package ftime defines "fleetspeak time" as a global variable.
notifications
Package internal contains miscellaneous small components used internally by the Fleetspeak server.
Package internal contains miscellaneous small components used internally by the Fleetspeak server.
services
Package services defines internal fleetspeak components relating to services.
Package services defines internal fleetspeak components relating to services.
signatures
Package signatures implements utility methods for checking cryptographic signatures.
Package signatures implements utility methods for checking cryptographic signatures.
Package mysql implements the fleetspeak datastore interface using a mysql database.
Package mysql implements the fleetspeak datastore interface using a mysql database.
Package notifications defines the plugin interface for components which allow the fleetspeak servers within an installation to notify each other about interesting events.
Package notifications defines the plugin interface for components which allow the fleetspeak servers within an installation to notify each other about interesting events.
proto
Package sertesting contains utilities useful for testing the fleetspeak server and server components.
Package sertesting contains utilities useful for testing the fleetspeak server and server components.
Package service defines the interface that fleetspeak expects from its service implementations.
Package service defines the interface that fleetspeak expects from its service implementations.
Package sqlite implements the fleetspeak datastore interface using an sqlite database.
Package sqlite implements the fleetspeak datastore interface using an sqlite database.
Package stats contains interfaces and utilities relating to the collection of statistics from a fleetspeak server.
Package stats contains interfaces and utilities relating to the collection of statistics from a fleetspeak server.
Package testserver configures and creates a Fleetspeak server instance suitable for unit tests.
Package testserver configures and creates a Fleetspeak server instance suitable for unit tests.

Jump to

Keyboard shortcuts

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