test

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateConfig

func GenerateConfig(group curve.Curve, N, T int, source io.Reader, pl *pool.Pool) (map[party.ID]*config.Config, party.IDSlice)

GenerateConfig creates some random configuration for N parties with set threshold T over the group.

func HandlerLoop

func HandlerLoop(id party.ID, h protocol.Handler, network *Network)

HandlerLoop blocks until the handler has finished. The result of the execution is given by Handler.Result().

func PartyIDs

func PartyIDs(n int) party.IDSlice

PartyIDs returns a party.IDSlice (sorted) with IDs represented as simple strings.

func Rounds

func Rounds(rounds []round.Session, rule Rule) (error, bool)

Types

type Network

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

Network simulates a point-to-point network between different parties using Go channels. The same network is used by all processes, and can be reused for different protocols. When used with test.Handler, no interaction from the user is required beyond creating the network.

func NewNetwork

func NewNetwork(parties party.IDSlice) *Network

func (*Network) Done

func (n *Network) Done(id party.ID) chan struct{}

func (*Network) Next

func (n *Network) Next(id party.ID) <-chan *protocol.Message

func (*Network) Quit

func (n *Network) Quit(id party.ID)

func (*Network) Send

func (n *Network) Send(msg *protocol.Message)

type Rule

type Rule interface {
	// ModifyBefore modifies r before r.Finalize() is called.
	ModifyBefore(r round.Session)
	// ModifyAfter modifies rNext, which is the round returned by r.Finalize().
	ModifyAfter(rNext round.Session)
	// ModifyContent modifies content for the message that is delivered in rNext.
	ModifyContent(rNext round.Session, to party.ID, content round.Content)
}

Rule describes various hooks that can be applied to a protocol execution.

Jump to

Keyboard shortcuts

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