control

package
v0.42.18 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuditService added in v0.42.0

func NewAuditService(next *Server, log *logger.Logger, enabled *atomic.Bool) control.ControlServiceServer

func SignMessage

func SignMessage(key *ecdsa.PrivateKey, msg SignedMessage) error

SignMessage signs Control service message with private key.

Types

type HealthChecker

type HealthChecker interface {
	// Must calculate and return current health status of the IR application.
	//
	// If status can not be calculated for any reason,
	// control.HealthStatus_HEALTH_STATUS_UNDEFINED should be returned.
	HealthStatus() control.HealthStatus
}

HealthChecker is component interface for calculating the current health status of a node.

type Option

type Option func(*options)

Option specifies Server's optional parameter.

func WithAllowedKeys

func WithAllowedKeys(keys [][]byte) Option

WithAllowedKeys returns option to add public keys to white list of the Control service.

type Prm

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

Prm groups required parameters of Server's constructor.

func (*Prm) SetHealthChecker

func (x *Prm) SetHealthChecker(hc HealthChecker)

SetHealthChecker sets HealthChecker to calculate health status.

func (*Prm) SetPrivateKey

func (x *Prm) SetPrivateKey(key keys.PrivateKey)

SetPrivateKey sets private key to sign responses.

type Server

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

Server is an entity that serves Control service on IR node.

To gain access to the service, any request must be signed with a key from the white list.

func New

func New(prm Prm, netmapClient *netmap.Client, containerClient *container.Client, opts ...Option) *Server

New creates a new instance of the Server.

Panics if:

  • parameterized private key is nil;
  • parameterized HealthChecker is nil.

Forms white list from all keys specified via WithAllowedKeys option and a public key of the parameterized private key.

func (*Server) HealthCheck

HealthCheck returns health status of the local IR node.

If request is not signed with a key from white list, permission error returns.

func (*Server) RemoveContainer added in v0.37.0

RemoveContainer forces a container removal.

func (*Server) RemoveNode added in v0.37.0

RemoveNode forces a node removal.

If request is not signed with a key from white list, permission error returns.

func (*Server) TickEpoch added in v0.37.0

TickEpoch forces a new epoch.

If request is not signed with a key from white list, permission error returns.

type SignedMessage

type SignedMessage interface {
	ReadSignedData([]byte) ([]byte, error)
	GetSignature() *control.Signature
	SetSignature(*control.Signature)
}

SignedMessage is an interface of Control service message.

Jump to

Keyboard shortcuts

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