Versions in this module Expand all Collapse all v0 v0.2.0 Mar 13, 2019 v0.1.0 Jul 23, 2018 Changes in this version + const DefaultExpiration + var ErrInvalidChallenge = errors.New("invalid challenge") + var ErrInvalidPeerAddr = errors.New("invalid peer address") + var ErrInvalidPeerID = errors.New("invalid peer ID") + var ErrInvalidRequestType = errors.New("invalid request type") + var ErrInvalidSignature = errors.New("invalid signature") + var ErrMissingChallenge = errors.New("missing challenge") + var ErrMissingPeerAddr = errors.New("missing peer address") + var ErrMissingPrivateKey = errors.New("missing private key") + var ErrMissingRequest = errors.New("no request for the given peer ID") + type FileSaver struct + func (s *FileSaver) AddRequest(ctx context.Context, r *Request) error + func (s *FileSaver) AddVote(ctx context.Context, v *Vote) error + func (s *FileSaver) List(ctx context.Context) ([]*Request, error) + func (s *FileSaver) Load(ctx context.Context) error + func (s *FileSaver) Remove(ctx context.Context, peerID peer.ID) error + func (s *FileSaver) Save(ctx context.Context) error + type InMemoryStore struct + func (s *InMemoryStore) AddRequest(ctx context.Context, r *Request) error + func (s *InMemoryStore) AddVote(ctx context.Context, v *Vote) error + func (s *InMemoryStore) Get(ctx context.Context, peerID peer.ID) (*Request, error) + func (s *InMemoryStore) GetVotes(ctx context.Context, peerID peer.ID) ([]*Vote, error) + func (s *InMemoryStore) List(ctx context.Context) ([]*Request, error) + func (s *InMemoryStore) MarshalJSON() ([]byte, error) + func (s *InMemoryStore) Remove(ctx context.Context, peerID peer.ID) error + func (s *InMemoryStore) UnmarshalJSON(data []byte) error + type Request struct + Challenge []byte + Expires time.Time + Info []byte + PeerAddr multiaddr.Multiaddr + PeerID peer.ID + Type Type + func NewAddRequest(nodeID *pb.NodeIdentity) (*Request, error) + func NewRemoveRequest(nodeID *pb.NodeIdentity) (*Request, error) + func (r *Request) FromUpdateProposal(p *pb.UpdateProposal) error + func (r *Request) MarshalJSON() ([]byte, error) + func (r *Request) ToUpdateProposal() *pb.UpdateProposal + func (r *Request) UnmarshalJSON(data []byte) error + type Store interface + AddRequest func(context.Context, *Request) error + AddVote func(context.Context, *Vote) error + Get func(context.Context, peer.ID) (*Request, error) + GetVotes func(context.Context, peer.ID) ([]*Vote, error) + List func(context.Context) ([]*Request, error) + Remove func(context.Context, peer.ID) error + func NewInMemoryStore() Store + func WrapWithSaver(ctx context.Context, s Store, path string) (Store, error) + type Type int + const AddNode + const RemoveNode + func (t Type) String() string + type Vote struct + Challenge []byte + PeerID peer.ID + Signature *crypto.Signature + Type Type + func NewVote(ctx context.Context, sk ic.PrivKey, r *Request) (*Vote, error) + func (v *Vote) FromProtoVote(proto *pb.Vote) error + func (v *Vote) MarshalJSON() ([]byte, error) + func (v *Vote) ToProtoVote() *pb.Vote + func (v *Vote) UnmarshalJSON(data []byte) error + func (v *Vote) Verify(ctx context.Context, r *Request) error