Documentation ¶
Index ¶
- Variables
- func ReadHostsJson(file string) (*config.HostsConfig, error)
- func Run(app *config.AppConfig, depl *deploy.Config)
- func RunClient(conf *deploy.Config)
- func RunServer(hosts *config.HostsConfig, app *config.AppConfig, depl *deploy.Config)
- type Ack
- type Finish
- type Peer
- func (p *Peer) BroadcastSignature(s *poly.SchnorrSig) []*poly.SchnorrSig
- func (p *Peer) ComputeSharedSecret() *poly.SharedSecret
- func (p *Peer) ConnectTo(host string) error
- func (p *Peer) ForRemotePeers(fn func(RemotePeer))
- func (p *Peer) IsRoot() bool
- func (p *Peer) Listen()
- func (p *Peer) SchnorrSigPeer(msg []byte)
- func (p *Peer) SchnorrSigRoot(msg []byte) *poly.SchnorrSig
- func (p *Peer) SendACKs()
- func (p *Peer) SendAcks(rp RemotePeer)
- func (p *Peer) SendToAll(data interface{}) error
- func (p *Peer) SendToPeer(i int, data interface{}) error
- func (p *Peer) SendToRoot(data interface{}) error
- func (p *Peer) SetupDistributedSchnorr()
- func (p *Peer) String() string
- func (p *Peer) VerifySchnorrSig(ps *poly.SchnorrSig, msg []byte) error
- func (p *Peer) WaitACKs()
- func (p *Peer) WaitFins()
- func (p *Peer) WaitSYNs()
- type RemotePeer
- type Syn
Constants ¶
This section is empty.
Variables ¶
var ConnRetry = 5
How many times a peer tries to connect to another until it works
var ConnWaitRetry = time.Second * 2
How many time do you wait before trying to connect again
Functions ¶
func ReadHostsJson ¶
func ReadHostsJson(file string) (*config.HostsConfig, error)
Read the tree json file and return the configFileold containing every hosts name
Types ¶
type Peer ¶
type Peer struct { // simple int representing its index in the matrix of peers Id int // its own IP addr : Port Name string // contains filtered or unexported fields }
func NewPeer ¶
NewPeer returns a new peer with its id and the number of peers in the schnorr signature algo TODO verification of string addr:port
func (*Peer) BroadcastSignature ¶
func (p *Peer) BroadcastSignature(s *poly.SchnorrSig) []*poly.SchnorrSig
BroadcastSIgnature will broadcast the given signature to every other peer AND will retrieve the signature of every other peer also !
func (*Peer) ComputeSharedSecret ¶
func (p *Peer) ComputeSharedSecret() *poly.SharedSecret
ComputeSharedSecret will make the exchange of dealers between the peers and will compute the sharedsecret at the end
func (*Peer) ConnectTo ¶
ConnectTo will connect to the given host and start the SYN exchange (public key + id)
func (*Peer) ForRemotePeers ¶
func (p *Peer) ForRemotePeers(fn func(RemotePeer))
ForRemotePeers will launch the given function over a go routine for each remotepeer this peer has
func (*Peer) SchnorrSigPeer ¶
func (*Peer) SchnorrSigRoot ¶
func (p *Peer) SchnorrSigRoot(msg []byte) *poly.SchnorrSig
SchnorrSigRoot will first generate a random shared secret, then start a new round It will wait for the partial sig of the peers to finally render a SchnorrSig struct
func (*Peer) SendAcks ¶
func (p *Peer) SendAcks(rp RemotePeer)
Peer logic after it has syn'd with another peer
func (*Peer) SendToPeer ¶
Helpers to send any aribtrary data to the n-peer
func (*Peer) SendToRoot ¶
func (*Peer) SetupDistributedSchnorr ¶
func (p *Peer) SetupDistributedSchnorr()
SetupDistributedSchnorr will compute a shared secret in order to be able to use the schnorr t-n distributed algo
func (*Peer) VerifySchnorrSig ¶
func (p *Peer) VerifySchnorrSig(ps *poly.SchnorrSig, msg []byte) error
VerifySchnorrSig will basically verify the validity of the issued signature
func (*Peer) WaitACKs ¶
func (p *Peer) WaitACKs()
WaitAcks will make a peer waits for all others peers to send an ACK to it
type RemotePeer ¶
type RemotePeer struct { // its connection Conn net.Conn // its name Hostname string // its id Id int }
func (*RemotePeer) IsRoot ¶
func (r *RemotePeer) IsRoot() bool
func (*RemotePeer) String ¶
func (r *RemotePeer) String() string