Documentation
¶
Index ¶
- func SignMessage(key *ecdsa.PrivateKey, msg SignedMessage) error
- type HealthChecker
- type NotaryManager
- type Option
- type Prm
- type Server
- func (s *Server) HealthCheck(_ context.Context, req *control.HealthCheckRequest) (*control.HealthCheckResponse, error)
- func (s *Server) NotaryList(_ context.Context, req *control.NotaryListRequest) (*control.NotaryListResponse, error)
- func (s *Server) NotaryRequest(_ context.Context, req *control.NotaryRequestRequest) (*control.NotaryRequestResponse, error)
- func (s *Server) NotarySign(_ context.Context, req *control.NotarySignRequest) (*control.NotarySignResponse, error)
- type SignedMessage
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 {
// HealthStatus 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 NotaryManager ¶ added in v0.45.0
type NotaryManager interface {
// ListNotaryRequests must return a list of hashes from notary pool.
ListNotaryRequests() ([]util.Uint256, error)
// RequestNotary must send a notary request with the given method and arguments.
RequestNotary(method string, args ...[]byte) (util.Uint256, error)
// SignNotary must sign an existing notary transaction with the given hash.
SignNotary(hash util.Uint256) error
}
NotaryManager is component interface for working with the network.
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) SetNetworkManager ¶ added in v0.45.0
func (x *Prm) SetNetworkManager(nm NotaryManager)
SetNetworkManager sets NotaryManager 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;
- parameterized NotaryManager 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.
func (*Server) NotaryList ¶ added in v0.45.0
func (s *Server) NotaryList(_ context.Context, req *control.NotaryListRequest) (*control.NotaryListResponse, error)
NotaryList returns list of transactions dumbs of the IR notary requests.
If request is not signed with a key from white list, permission error returns.
func (*Server) NotaryRequest ¶ added in v0.45.0
func (s *Server) NotaryRequest(_ context.Context, req *control.NotaryRequestRequest) (*control.NotaryRequestResponse, error)
NotaryRequest create and send notary request and returns a hash of this request.
If request is not signed with a key from white list, permission error returns.
func (*Server) NotarySign ¶ added in v0.45.0
func (s *Server) NotarySign(_ context.Context, req *control.NotarySignRequest) (*control.NotarySignResponse, error)
NotarySign send notary request to forceful container removal and returns a hash of this request.
If request is not signed with a key from white list, permission error returns.