connector

package
v2.4.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectorConfig

type ConnectorConfig struct {
	NodeAddress               string
	DonId                     string
	Gateways                  []ConnectorGatewayConfig
	WsClientConfig            network.WebSocketClientConfig
	AuthMinChallengeLen       int
	AuthTimestampToleranceSec uint32
}

type ConnectorGatewayConfig

type ConnectorGatewayConfig struct {
	Id  string
	URL string
}

type GatewayConnector

type GatewayConnector interface {
	job.ServiceCtx
	network.ConnectionInitiator

	SendToGateway(ctx context.Context, gatewayId string, msg *api.Message) error
}

GatewayConnector is a component run by Nodes to connect to a set of Gateways.

func NewGatewayConnector

func NewGatewayConnector(config *ConnectorConfig, signer Signer, handler GatewayConnectorHandler, clock utils.Clock, lggr logger.Logger) (GatewayConnector, error)

type GatewayConnectorHandler

type GatewayConnectorHandler interface {
	job.ServiceCtx

	HandleGatewayMessage(ctx context.Context, gatewayId string, msg *api.Message)
}

GatewayConnector user (node) implements application logic in the Handler interface.

type Signer

type Signer interface {
	// Sign keccak256 hash of data.
	Sign(data ...[]byte) ([]byte, error)
}

Signer implementation needs to be provided by a GatewayConnector user (node) in order to sign handshake messages with node's private key.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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