Documentation
¶
Index ¶
- Constants
- type AuthenticationService
- type AuthorizationService
- type MasterConfigurationService
- func (s MasterConfigurationService) Current() config.Config
- func (s MasterConfigurationService) Save() error
- func (s MasterConfigurationService) Stream() chan (config.Config)
- func (s MasterConfigurationService) UpdateConfigurable(nodeStatsPolling int, nodeLastSeenTimeout int, autoSavePeriod int)
- func (s MasterConfigurationService) UpdateTrustedNetwork(nodes []models.Node)
- type NetworkService
- type NetworkingService
- type NodeCommanderService
- func (s NodeCommanderService) Connections(id string) ([]models.Connection, error)
- func (s NodeCommanderService) Disconnect(id string) error
- func (s NodeCommanderService) KillProcess(id string, pid int32) error
- func (s NodeCommanderService) Packages(id string) ([]models.Package, error)
- func (s NodeCommanderService) Processes(id string) ([]models.Process, error)
- type NodeManagerService
- func (s *NodeManagerService) Authenticate(node models.Node, code string) error
- func (s *NodeManagerService) Code() models.JoinNetworkCode
- func (s *NodeManagerService) IsAuthenticated(node models.Node) bool
- func (s *NodeManagerService) Join(node models.Node) error
- func (s NodeManagerService) Network() []models.Node
- func (s NodeManagerService) Node(id string) (models.Node, bool)
- func (s *NodeManagerService) Release(stream chan ([]models.Node))
- func (s *NodeManagerService) Remove(node models.Node) error
- func (s *NodeManagerService) Stream() chan ([]models.Node)
- func (s *NodeManagerService) Update(node models.Node) error
- func (s *NodeManagerService) Valid(code string) bool
- type NodeReporterService
- func (s NodeReporterService) Connections() ([]models.Connection, error)
- func (s NodeReporterService) KillProcess(pid int32) error
- func (s NodeReporterService) Node() models.Node
- func (s NodeReporterService) Packages() ([]models.Package, error)
- func (s NodeReporterService) Processes() ([]models.Process, error)
- func (s NodeReporterService) Speedtest() (chan (models.Speedtest), error)
- func (s *NodeReporterService) Start(pollDuration time.Duration) chan (models.Stats)
- func (s *NodeReporterService) Update(d time.Duration)
- type NodeSchedulerService
- type NodeSpeedtestService
- func (s NodeSpeedtestService) History(nodeid string) ([]models.Speedtest, bool)
- func (s NodeSpeedtestService) Speedtest(id string) (models.Speedtest, bool)
- func (s NodeSpeedtestService) Start(nodeid string) (models.Speedtest, error)
- func (s NodeSpeedtestService) Updates(id string) (chan (models.Speedtest), bool)
- type Token
- type TokenBucket
Constants ¶
const (
SpeedtestHistoryLimit = 25
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationService ¶
type AuthenticationService struct {
// contains filtered or unexported fields
}
Service for managing authentication requests.
func NewAuthenticationService ¶
func NewAuthenticationService( authRepo repositories.AuthenticationRepository, userRepo repositories.UserRepository, tokenks *TokenBucket, ) *AuthenticationService
func (*AuthenticationService) Authenticate ¶
func (s *AuthenticationService) Authenticate( username string, password string, ) (Token, error)
func (*AuthenticationService) NeedsAdminRegistration ¶
func (s *AuthenticationService) NeedsAdminRegistration() bool
func (*AuthenticationService) RegisterAdmin ¶
func (s *AuthenticationService) RegisterAdmin( username string, password string, ) (Token, error)
type AuthorizationService ¶
type AuthorizationService struct {
// contains filtered or unexported fields
}
Service for managing authorization requests.
func NewAuthorizationService ¶
func NewAuthorizationService( tokens *TokenBucket, ) *AuthorizationService
func (*AuthorizationService) HasAdminRights ¶
func (s *AuthorizationService) HasAdminRights(token string) bool
type MasterConfigurationService ¶
type MasterConfigurationService struct {
// contains filtered or unexported fields
}
Service that acts as a facade for configuration requests.
func NewMasterConfigurationService ¶
func NewMasterConfigurationService( cfg *config.Config, ) *MasterConfigurationService
func (MasterConfigurationService) Current ¶
func (s MasterConfigurationService) Current() config.Config
func (MasterConfigurationService) Save ¶
func (s MasterConfigurationService) Save() error
func (MasterConfigurationService) Stream ¶
func (s MasterConfigurationService) Stream() chan (config.Config)
func (MasterConfigurationService) UpdateConfigurable ¶
func (s MasterConfigurationService) UpdateConfigurable( nodeStatsPolling int, nodeLastSeenTimeout int, autoSavePeriod int, )
Updates all configurable values present in the current configuration instance.
func (MasterConfigurationService) UpdateTrustedNetwork ¶
func (s MasterConfigurationService) UpdateTrustedNetwork( nodes []models.Node, )
Updates the trusted network present in the current configuration instance.
type NetworkService ¶
type NetworkService struct {
// contains filtered or unexported fields
}
Service for managing network nodes.
func NewNetworkService ¶
func NewNetworkService( subscriber event.EventSubscriber, ) *NetworkService
func (*NetworkService) Address ¶
func (s *NetworkService) Address() models.Address
todo: cache address
func (*NetworkService) PublicKey ¶
func (s *NetworkService) PublicKey() ([]byte, error)
todo: cache public key
type NetworkingService ¶
type NetworkingService struct { }
Service for networking operations.
func NewNetworkingService ¶
func NewNetworkingService() *NetworkingService
type NodeCommanderService ¶
type NodeCommanderService struct {
// contains filtered or unexported fields
}
Service for executing commands in nodes.
func NewNodeCommanderService ¶
func NewNodeCommanderService( publisher event.EventPublisher, subscriber event.EventSubscriber, ) *NodeCommanderService
func (NodeCommanderService) Connections ¶
func (s NodeCommanderService) Connections(id string) ([]models.Connection, error)
func (NodeCommanderService) Disconnect ¶
func (s NodeCommanderService) Disconnect(id string) error
func (NodeCommanderService) KillProcess ¶
func (s NodeCommanderService) KillProcess(id string, pid int32) error
type NodeManagerService ¶
type NodeManagerService struct {
// contains filtered or unexported fields
}
Service for managing nodes that report to master.
func NewNodeManagerService ¶
func NewNodeManagerService(nodes ...models.Node) *NodeManagerService
Creates a service for managing network nodes. Allows passing previously saved nodes as varadiac param.
func (*NodeManagerService) Authenticate ¶
func (s *NodeManagerService) Authenticate(node models.Node, code string) error
func (*NodeManagerService) Code ¶
func (s *NodeManagerService) Code() models.JoinNetworkCode
func (*NodeManagerService) IsAuthenticated ¶
func (s *NodeManagerService) IsAuthenticated(node models.Node) bool
func (*NodeManagerService) Join ¶
func (s *NodeManagerService) Join(node models.Node) error
Joins master node.
func (NodeManagerService) Network ¶
func (s NodeManagerService) Network() []models.Node
func (*NodeManagerService) Release ¶
func (s *NodeManagerService) Release(stream chan ([]models.Node))
Notifies the manager that a stream should be released.
func (*NodeManagerService) Remove ¶
func (s *NodeManagerService) Remove(node models.Node) error
Removes a node from the network.
func (*NodeManagerService) Stream ¶
func (s *NodeManagerService) Stream() chan ([]models.Node)
func (*NodeManagerService) Update ¶
func (s *NodeManagerService) Update(node models.Node) error
Updates the state of a node.
func (*NodeManagerService) Valid ¶
func (s *NodeManagerService) Valid(code string) bool
type NodeReporterService ¶
type NodeReporterService struct {
// contains filtered or unexported fields
}
Service for reporting node information to master.
func NewNodeReporterService ¶
func NewNodeReporterService( system repositories.SystemRepository, speedtest repositories.SpeedtestRepository, ) *NodeReporterService
func (NodeReporterService) Connections ¶
func (s NodeReporterService) Connections() ([]models.Connection, error)
func (NodeReporterService) KillProcess ¶
func (s NodeReporterService) KillProcess(pid int32) error
func (NodeReporterService) Node ¶
func (s NodeReporterService) Node() models.Node
func (NodeReporterService) Packages ¶
func (s NodeReporterService) Packages() ([]models.Package, error)
func (NodeReporterService) Processes ¶
func (s NodeReporterService) Processes() ([]models.Process, error)
func (NodeReporterService) Speedtest ¶
func (s NodeReporterService) Speedtest() (chan (models.Speedtest), error)
func (*NodeReporterService) Start ¶
func (s *NodeReporterService) Start(pollDuration time.Duration) chan (models.Stats)
Starts reporting node stats through a channel. The channel is unbuffered.
func (*NodeReporterService) Update ¶
func (s *NodeReporterService) Update( d time.Duration, )
type NodeSchedulerService ¶
type NodeSchedulerService struct{}
func NewNodeSchedulerService ¶
func NewNodeSchedulerService( cfg func() config.Config, cfgStream func() chan (config.Config), saveCfg func() error, updateTrustedNetwork func([]models.Node), updateNetwork func(models.Node) error, network func() []models.Node, networkStream func() chan ([]models.Node), ) *NodeSchedulerService
Creates a new service that schedules routines that interact with the nodes network. All routines are initialized when calling this function.
This is a dumb service and shouldn't interact with no injected instance. Instead instances should be retrieved by callbacks.
type NodeSpeedtestService ¶
type NodeSpeedtestService struct {
// contains filtered or unexported fields
}
Service for managing nodes speedtests.
func NewNodeSpeedtestService ¶
func NewNodeSpeedtestService( publisher event.EventPublisher, subscriber event.EventSubscriber, store repositories.SpeedtestStoreRepository, ) *NodeSpeedtestService
func (NodeSpeedtestService) History ¶
func (s NodeSpeedtestService) History(nodeid string) ([]models.Speedtest, bool)
func (NodeSpeedtestService) Speedtest ¶
func (s NodeSpeedtestService) Speedtest(id string) (models.Speedtest, bool)