test

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: MIT Imports: 13 Imported by: 3

Documentation

Overview

Package test offers some common functionalities that are used throughout many different tests in drand.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Addresses

func Addresses(n int) []string

Addresses returns a list of TCP localhost addresses starting from the given port= start.

func BatchIdentities

func BatchIdentities(n int) ([]*key.Pair, *key.Group)

BatchIdentities generates n insecure identities

func BatchTLSIdentities added in v0.3.7

func BatchTLSIdentities(n int) ([]*key.Pair, *key.Group)

BatchTLSIdentities generates n secure (TLS) identities

func CheckRunningBeacon added in v0.5.2

func CheckRunningBeacon(t *testing.T, group *key.Group, expected int)

CheckRunningBeacon checks for correct generation of random beacon within a group. It tries to collect randomness from every member of the group, at least twice, i.e. within two different period. The randomness of the first period should be present and different than the first one. It fails if there is less *expected* number of nodes that reply.

func FreePort

func FreePort() string

FreePort returns an free TCP port. Taken from https://github.com/phayes/freeport/blob/master/freeport.go

func GenerateIDs

func GenerateIDs(n int) []*key.Pair

GenerateIDs returns n keys with random port localhost addresses

func ListFromPrivates

func ListFromPrivates(keys []*key.Pair) []*key.Identity

ListFromPrivates returns a list of Identity from a list of Pair keys.

func NewKeyStore

func NewKeyStore() key.Store

func NewPeer added in v0.3.7

func NewPeer(addr string) net.Peer

NewPeer returns a new net.Peer

func NewTLSPeer added in v0.3.7

func NewTLSPeer(addr string) net.Peer

NewTLSPeer returns a new net.Peer with TLS enabled

func Ports added in v0.4.0

func Ports(n int) []string

Ports returns a list of ports starting from the given port= start.

func SimulateDKG added in v0.4.0

func SimulateDKG(test *testing.T, g kyber.Group, n, t int) ([]*share.PriShare, []kyber.Point)

SimulateDKG returns a list of private shares along with the list of public coefficients of the public polynomial

func StringToPoint added in v0.4.0

func StringToPoint(s string) (kyber.Point, error)

StringToPoint ...

Types

type KeyStore

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

func (*KeyStore) LoadDistPublic

func (k *KeyStore) LoadDistPublic() (*key.DistPublic, error)

func (*KeyStore) LoadGroup

func (k *KeyStore) LoadGroup() (*key.Group, error)

func (*KeyStore) LoadKeyPair added in v0.3.6

func (k *KeyStore) LoadKeyPair() (*key.Pair, error)

func (*KeyStore) LoadShare

func (k *KeyStore) LoadShare() (*key.Share, error)

func (*KeyStore) Reset added in v0.5.2

func (k *KeyStore) Reset(...key.ResetOption) error

func (*KeyStore) SaveDistPublic

func (k *KeyStore) SaveDistPublic(d *key.DistPublic) error

func (*KeyStore) SaveGroup

func (k *KeyStore) SaveGroup(g *key.Group) error

func (*KeyStore) SaveKeyPair added in v0.3.6

func (k *KeyStore) SaveKeyPair(p *key.Pair) error

func (*KeyStore) SaveShare

func (k *KeyStore) SaveShare(share *key.Share) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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