discovery

package
v0.0.0-...-7e24c04 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAccAlreadyExists = errors.New("Accusation already exists")
)

Functions

func NewAccusation

func NewAccusation(epoch uint64, accused, accuser string, ringNum uint32, priv *ecdsa.PrivateKey) *pb.Accusation

ONLY for testing

func NewNote

func NewNote(id string, epoch uint64, mask uint32, priv *ecdsa.PrivateKey) *pb.Note

ONLY FOR TESTING

func NewUnsignedAccusation

func NewUnsignedAccusation(epoch uint64, accused, accuser string, ringNum uint32) *pb.Accusation

ONLY for testing

func NewUnsignedNote

func NewUnsignedNote(id string, epoch uint64, mask uint32) *pb.Note

ONLY FOR TESTING

Types

type Accusation

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

func (Accusation) Equal

func (a Accusation) Equal(accused, accuser string, ringNum uint32, epoch uint64) bool

func (Accusation) IsAccuser

func (a Accusation) IsAccuser(id string) bool

func (Accusation) IsMoreRecent

func (a Accusation) IsMoreRecent(other uint64) bool

func (Accusation) ToPbMsg

func (a Accusation) ToPbMsg() *pb.Accusation

type Note

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

func (*Note) Equal

func (n *Note) Equal(epoch uint64) bool

func (*Note) IsMoreRecent

func (n *Note) IsMoreRecent(other uint64) bool

func (Note) IsRingDisabled

func (n Note) IsRingDisabled(ringNum, numRings uint32) bool

func (*Note) ToPbMsg

func (n *Note) ToPbMsg() *pb.Note

type Peer

type Peer struct {
	Addr     string
	PingAddr string

	// Debuging and experiments only.
	HttpAddr string

	Id string
	// contains filtered or unexported fields
}

func (*Peer) AddAccusation

func (p *Peer) AddAccusation(accused, accuser string, epoch uint64, ringNum uint32, r, s []byte) error

func (*Peer) AddNote

func (p *Peer) AddNote(mask uint32, epoch uint64, r, s []byte)

func (*Peer) AddTestAccusation

func (p *Peer) AddTestAccusation(a *pb.Accusation)

ONLY for testing

func (*Peer) AllAccusations

func (p *Peer) AllAccusations() []*Accusation

func (*Peer) AnyAccusation

func (p *Peer) AnyAccusation() *Accusation

func (*Peer) Certificate

func (p *Peer) Certificate() []byte

func (*Peer) ClearAccusations

func (p *Peer) ClearAccusations()

func (*Peer) ClearNote

func (p *Peer) ClearNote()

ONLY for testing

func (*Peer) CreateAccusation

func (p *Peer) CreateAccusation(accused *Note, self *Peer, ringNum uint32, sign signer) error

func (*Peer) IncrementPing

func (p *Peer) IncrementPing()

func (*Peer) Info

func (p *Peer) Info() (*pb.Certificate, *pb.Note, []*pb.Accusation)

func (*Peer) IsAccused

func (p *Peer) IsAccused() bool

func (*Peer) NewNote

func (p *Peer) NewNote(priv *ecdsa.PrivateKey, epoch uint64)

ONLY for testing

func (*Peer) Note

func (p *Peer) Note() *Note

func (*Peer) NumPing

func (p *Peer) NumPing() uint32

func (*Peer) PublicKey

func (p *Peer) PublicKey() *ecdsa.PublicKey

func (*Peer) RemoveAccusation

func (p *Peer) RemoveAccusation(a *Accusation)

func (*Peer) RemoveRingAccusation

func (p *Peer) RemoveRingAccusation(ringNum uint32)

func (*Peer) ResetPing

func (p *Peer) ResetPing()

func (*Peer) RingAccusation

func (p *Peer) RingAccusation(ringNum uint32) *Accusation

type View

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

func NewView

func NewView(numRings uint32, cert *x509.Certificate, cm connectionManager, s signer) (*View, error)

func (*View) AddFull

func (v *View) AddFull(id string, cert *x509.Certificate) error

func (*View) AddLive

func (v *View) AddLive(p *Peer)

func (*View) Compare

func (v *View) Compare(other *View) error

ONLY for testing

func (*View) DeleteTimeout

func (v *View) DeleteTimeout(id string)

func (*View) Exists

func (v *View) Exists(id string) bool

func (*View) FindNeighbours

func (v *View) FindNeighbours(id string) []*Peer

func (*View) Full

func (v *View) Full() []*Peer

func (*View) GossipPartners

func (v *View) GossipPartners() []*Peer

func (*View) HasTimer

func (v *View) HasTimer(id string) bool

func (*View) IsAlive

func (v *View) IsAlive(id string) bool

func (*View) Live

func (v *View) Live() []*Peer

func (*View) LivePeer

func (v *View) LivePeer(id string) *Peer

func (*View) MonitorTarget

func (v *View) MonitorTarget() (*Peer, uint32)

func (*View) MyNeighbours

func (v *View) MyNeighbours() []*Peer

func (*View) MyRingNeighbours

func (v *View) MyRingNeighbours(ringNum uint32) (*Peer, *Peer)

func (*View) NumRings

func (v *View) NumRings() uint32

func (*View) Peer

func (v *View) Peer(id string) *Peer

func (*View) RemoveLive

func (v *View) RemoveLive(id string)

func (*View) RemoveTestFull

func (v *View) RemoveTestFull(id string)

ONLY for testing

func (*View) Self

func (v *View) Self() *Peer

func (*View) ShouldBeNeighbour

func (v *View) ShouldBeNeighbour(id string) bool

func (*View) ShouldRebuttal

func (v *View) ShouldRebuttal(epoch uint64, ringNum uint32) bool

func (*View) Start

func (v *View) Start()

func (*View) StartTimer

func (v *View) StartTimer(accused *Peer, n *Note, observer *Peer) error

func (*View) State

func (v *View) State() *proto.State

func (*View) Stop

func (v *View) Stop()

func (*View) ValidAccuser

func (v *View) ValidAccuser(accused, accuser *Peer, ringNum uint32) bool

func (*View) ValidMask

func (v *View) ValidMask(mask uint32) bool

Jump to

Keyboard shortcuts

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