nodes

package
v4.7.4 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: BSD-2-Clause, BSD-2-Clause Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const InputChanLen = 1000

Variables

This section is empty.

Functions

This section is empty.

Types

type MixCypher

type MixCypher interface {
	// Encrypt encrypts the given message for cMix. Panics if the passed
	// message is not sized correctly for the group.
	Encrypt(msg format.Message, salt []byte, roundID id.Round) (
		format.Message, [][]byte, []bool, []byte)

	// MakeClientGatewayAuthMAC generates the MAC the gateway will
	// check when receiving a cMix message.
	MakeClientGatewayAuthMAC(salt, digest []byte) []byte
}

MixCypher is an interface for the cryptographic operations done in order to encrypt a cMix message to a node.

type RegisterNodeCommsInterface

type RegisterNodeCommsInterface interface {
	SendRequestClientKeyMessage(host *connect.Host,
		message *pb.SignedClientKeyRequest) (*pb.SignedKeyResponse, error)
}

RegisterNodeCommsInterface is a sub-interface of client.Comms containing the send function for registering with a cMix node.

type Registrar

type Registrar interface {
	// StartProcesses initiates numParallel amount of threads
	// to register with nodes.
	StartProcesses(numParallel uint) stoppable.Stoppable

	//PauseNodeRegistrations stops all node registrations
	//and returns a function to resume them
	PauseNodeRegistrations(timeout time.Duration) error

	// ChangeNumberOfNodeRegistrations changes the number of parallel node
	// registrations up to the initialized maximum
	ChangeNumberOfNodeRegistrations(toRun int, timeout time.Duration) error

	// GetNodeKeys returns a MixCypher for the topology and a list of nodes it did
	// not have a key for. If there are missing keys, then returns nil.
	GetNodeKeys(topology *connect.Circuit) (MixCypher, error)

	// HasNode returns whether Registrar has registered with this cMix node
	HasNode(nid *id.ID) bool

	// RemoveNode removes the node from the registrar
	RemoveNode(nid *id.ID)

	// NumRegisteredNodes returns the number of registered nodes.
	NumRegisteredNodes() int

	// GetInputChannel returns the send-only channel for registering with
	// a cMix node.
	GetInputChannel() chan<- network.NodeGateway

	// TriggerNodeRegistration initiates a registration with the given
	// cMix node by sending on the registrar's registration channel.
	TriggerNodeRegistration(nid *id.ID)

	SetNodeRegistrationDisabled(disabled bool)
	SetImmediateSendingEnabled(enabled bool)
}

Registrar is an interface for managing the registrations for cMix nodes.

func LoadRegistrar

func LoadRegistrar(session session, sender gateway.Sender,
	comms RegisterNodeCommsInterface, rngGen *fastRNG.StreamGenerator,
	c chan network.NodeGateway, numNodesGetter func() int) (Registrar, error)

LoadRegistrar loads a Registrar from disk or creates a new one if it does not exist.

Jump to

Keyboard shortcuts

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