Versions in this module Expand all Collapse all v0 v0.1.0 Oct 18, 2021 Changes in this version + var ErrInsufficientWeight = errors.New("a voter's weight has to be at least 1") + var ErrInvalidProtocol = errors.New("invalid ip protocol specified") + var ErrNoIP = errors.New("no IP could be found") + var ErrNoSource = errors.New("no voter's source given") + func NewLogger(w io.Writer) *log.Logger + type Consensus struct + func DefaultConsensus(cfg *ConsensusConfig, logger *log.Logger) *Consensus + func NewConsensus(cfg *ConsensusConfig, logger *log.Logger) *Consensus + func (c *Consensus) AddVoter(source Source, weight uint) error + func (c *Consensus) ExternalIP() (net.IP, error) + func (c *Consensus) UseIPProtocol(protocol uint) error + type ConsensusConfig struct + Timeout time.Duration + func DefaultConsensusConfig() *ConsensusConfig + func (cfg *ConsensusConfig) WithTimeout(timeout time.Duration) *ConsensusConfig + type ContentParser func(string) (string, error) + type HTTPSource struct + func NewHTTPSource(url string) *HTTPSource + func (s *HTTPSource) IP(timeout time.Duration, logger *log.Logger, protocol uint) (net.IP, error) + func (s *HTTPSource) WithParser(parser ContentParser) *HTTPSource + type InvalidIPError string + func (err InvalidIPError) Error() string + type Source interface + IP func(timeout time.Duration, logger *log.Logger, protocol uint) (net.IP, error)