Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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 ¶
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 ¶
func (s *Server) HealthCheck(_ context.Context, req *control.HealthCheckRequest) (*control.HealthCheckResponse, error)
HealthCheck returns health status of the local IR node.
If request is not signed with a key from white list, permission error returns.