network

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: BSD-2-Clause Imports: 18 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSlotDigest

func GenerateSlotDigest(gatewaySlot *mixmessages.GatewaySlot) []byte

GenerateSlotDigest serializes the gateway slot message for the client to hash

Types

type Heartbeat

type Heartbeat struct {
	HasWaitingRound bool
	IsRoundComplete bool
}

Object used to signal information about the network health

type Instance

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

The Instance struct stores a combination of comms info and round info for servers

func NewInstance

func NewInstance(c *connect.ProtoComms, partial, full *ndf.NetworkDefinition, ers ds.ExternalRoundStorage,
	validationLevel ValidationType, useElliptic bool) (*Instance, error)

Initializer for instance structs from base comms and NDF, you can put in nil for ERS if you don't want to use it useElliptic determines whether client will verify signatures using the RSA key or the elliptic curve key.

func NewInstanceTesting

func NewInstanceTesting(c *connect.ProtoComms, partial, full *ndf.NetworkDefinition,
	e2eGroup, cmixGroup *cyclic.Group, i interface{}) (*Instance, error)

Utility function to create instance FOR TESTING PURPOSES ONLY

func (*Instance) GetAddGatewayChan

func (i *Instance) GetAddGatewayChan() chan NodeGateway

Return AddGateway channel from Instance

func (*Instance) GetCmixGroup

func (i *Instance) GetCmixGroup() *cyclic.Group

GetE2EGroup gets the cmixGroup from the instance

func (*Instance) GetE2EGroup

func (i *Instance) GetE2EGroup() *cyclic.Group

GetE2EGroup gets the e2eGroup from the instance

func (*Instance) GetEllipticPublicKey

func (i *Instance) GetEllipticPublicKey() string

GetEllipticPublicKey gets the permissioning's elliptic public key from one of the NDFs It first checks the full ndf and returns if that has the key If not it checks the partial ndf and returns if it has it Otherwise it returns an empty string

func (*Instance) GetFullNdf

func (i *Instance) GetFullNdf() *SecuredNdf

Return the full NDF from this instance

func (*Instance) GetHistoricalRound

func (i *Instance) GetHistoricalRound(id id.Round) (*pb.RoundInfo, error)

Calls the underlying interface's function to get a specific round from history

func (*Instance) GetHistoricalRoundRange

func (i *Instance) GetHistoricalRoundRange(first, last id.Round) ([]*pb.RoundInfo, error)

Calls the underlying interface's function to get a range of rounds from history

func (*Instance) GetHistoricalRounds

func (i *Instance) GetHistoricalRounds(rounds []id.Round) ([]*pb.RoundInfo, error)

Calls the underlying interface's function to get specific rounds from history

func (*Instance) GetIpOverrideList

func (i *Instance) GetIpOverrideList() *ds.IpOverrideList

overrides an IP address for an ID with one from

func (*Instance) GetLastRoundID

func (i *Instance) GetLastRoundID() id.Round

get the most recent round id

func (*Instance) GetLastUpdateID

func (i *Instance) GetLastUpdateID() int

get the most recent update id

func (*Instance) GetNodeAndGateway

func (i *Instance) GetNodeAndGateway(ngid *id.ID) (NodeGateway, error)

Gets the node and gateway with the given ID

func (*Instance) GetOldestRoundID

func (i *Instance) GetOldestRoundID() id.Round

Get the oldest round id

func (*Instance) GetPartialNdf

func (i *Instance) GetPartialNdf() *SecuredNdf

Return the partial ndf from this instance

func (*Instance) GetPermissioningAddress

func (i *Instance) GetPermissioningAddress() string

GetPermissioningAddress gets the permissioning address from one of the NDF It first checks the full ndf and returns if that has the address If not it checks the partial ndf and returns if it has it Otherwise it returns an empty string

func (*Instance) GetPermissioningCert

func (i *Instance) GetPermissioningCert() string

GetPermissioningCert gets the permissioning certificate from one of the NDFs It first checks the full ndf and returns if that has the cert If not it checks the partial ndf and returns if it has it Otherwise it returns an empty string

func (*Instance) GetPermissioningId

func (i *Instance) GetPermissioningId() *id.ID

GetPermissioningId gets the permissioning ID from primitives

func (*Instance) GetRound

func (i *Instance) GetRound(id id.Round) (*pb.RoundInfo, error)

Get the round of a given ID as a roundInfo (protobuff)

func (*Instance) GetRoundEvents

func (i *Instance) GetRoundEvents() *ds.RoundEvents

Return the Instance RoundEvents object

func (*Instance) GetRoundUpdate

func (i *Instance) GetRoundUpdate(updateID int) (*pb.RoundInfo, error)

Get an update ID

func (*Instance) GetRoundUpdates

func (i *Instance) GetRoundUpdates(id int) []*pb.RoundInfo

Get updates from a given round

func (*Instance) GetWaitingRounds

func (i *Instance) GetWaitingRounds() *ds.WaitingRounds

Return the Instance WaitingRounds object

func (*Instance) GetWrappedRound

func (i *Instance) GetWrappedRound(id id.Round) (*ds.Round, error)

Get the round of a given ID as a ds.Round object

func (*Instance) RoundUpdate

func (i *Instance) RoundUpdate(info *pb.RoundInfo) (*ds.Round, error)

Add a round to the round and update buffer

func (*Instance) RoundUpdates

func (i *Instance) RoundUpdates(rounds []*pb.RoundInfo) error

Pluralized version of RoundUpdate used by Client

func (*Instance) SetAddGatewayChan

func (i *Instance) SetAddGatewayChan(c chan NodeGateway)

Register AddGateway channel with Instance

func (*Instance) SetAddNodeChan

func (i *Instance) SetAddNodeChan(c chan NodeGateway)

Register AddNode channel with Instance

func (*Instance) SetGatewayAuthentication

func (i *Instance) SetGatewayAuthentication()

SetGatewayAuth will force authentication on all communications with gateways intended for use between Gateway <-> Gateway communications

func (*Instance) SetNetworkHealthChan

func (i *Instance) SetNetworkHealthChan(c chan Heartbeat)

Register NetworkHealth channel with Instance

func (*Instance) SetRemoveGatewayChan

func (i *Instance) SetRemoveGatewayChan(c chan *id.ID)

Register RemoveGateway channel with Instance

func (*Instance) SetRemoveNodeChan

func (i *Instance) SetRemoveNodeChan(c chan *id.ID)

Register RemoveNode channel with Instance

func (*Instance) UpdateFullNdf

func (i *Instance) UpdateFullNdf(m *pb.NDF) error

update the full ndf

func (*Instance) UpdateGatewayConnections

func (i *Instance) UpdateGatewayConnections() error

Update gateway hosts based on most complete ndf

func (*Instance) UpdateNodeConnections

func (i *Instance) UpdateNodeConnections() error

Update node hosts based on most complete ndf

func (*Instance) UpdatePartialNdf

func (i *Instance) UpdatePartialNdf(m *pb.NDF) error

update the partial ndf

type NodeGateway

type NodeGateway struct {
	Node    ndf.Node
	Gateway ndf.Gateway
}

Combines a node and gateway together together for return over channels

type SecuredNdf

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

wraps the ndf data structure, expoting all the functionality expect the ability to change the ndf

func NewSecuredNdf

func NewSecuredNdf(definition *ndf.NetworkDefinition) (*SecuredNdf, error)

Initialize a securedNdf from a primitives NetworkDefinition object

func (*SecuredNdf) CompareHash

func (sndf *SecuredNdf) CompareHash(h []byte) bool

Compare a hash to the stored

func (*SecuredNdf) Get

func (sndf *SecuredNdf) Get() *ndf.NetworkDefinition

Get the primitives object for an ndf

func (*SecuredNdf) GetHash

func (sndf *SecuredNdf) GetHash() []byte

get the hash of the ndf

func (*SecuredNdf) GetPb

func (sndf *SecuredNdf) GetPb() *pb.NDF

get the protobuf message NDF

type ValidationType

type ValidationType uint8

Level of validation types for pulling our round structure

Strict: Signatures are checked every time (intended for nodes)
Lazy: Only check we're involved, only verifies the first retrieval
None: no signature checks are done
const (
	Strict ValidationType = iota
	Lazy
	None
)

func (ValidationType) String

func (s ValidationType) String() string

Stringer for ValidationType

Directories

Path Synopsis
Package dataStructures stores callbacks that will be called in the process of running a round.
Package dataStructures stores callbacks that will be called in the process of running a round.

Jump to

Keyboard shortcuts

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