Versions in this module Expand all Collapse all v0 v0.1.1 Jun 14, 2020 v0.1.0 Jun 14, 2020 Changes in this version + const BucketSize + var ErrBucketFull = errors.New("bucket is full") + func PrefixDiff(a, b []byte, n int) int + func PrefixLen(a []byte) int + func SortByDistance(id hypergraph.PublicKey, ids []hypergraph.ID) []hypergraph.ID + func XOR(a, b []byte) []byte + type Events struct + OnPeerActivity func(id hypergraph.ID) + OnPeerAdmitted func(id hypergraph.ID) + OnPeerEvicted func(id hypergraph.ID) + type FindNodeRequest struct + Target hypergraph.PublicKey + func UnmarshalFindNodeRequest(buf []byte) (FindNodeRequest, error) + func (r FindNodeRequest) Marshal() []byte + type FindNodeResponse struct + Results []hypergraph.ID + func UnmarshalFindNodeResponse(buf []byte) (FindNodeResponse, error) + func (r FindNodeResponse) Marshal() []byte + type Iterator struct + func NewIterator(node *hypergraph.Node, table *Table, opts ...IteratorOption) *Iterator + func (it *Iterator) Find(target hypergraph.PublicKey) []hypergraph.ID + type IteratorOption func(it *Iterator) + func WithIteratorLogger(logger *zap.Logger) IteratorOption + func WithIteratorLookupTimeout(lookupTimeout time.Duration) IteratorOption + func WithIteratorMaxNumResults(maxNumResults int) IteratorOption + func WithIteratorNumParallelLookups(numParallelLookups int) IteratorOption + func WithIteratorNumParallelRequestsPerLookup(numParallelRequestsPerLookup int) IteratorOption + type Ping struct + func UnmarshalPing([]byte) (Ping, error) + func (r Ping) Marshal() []byte + type Pong struct + func UnmarshalPong([]byte) (Pong, error) + func (r Pong) Marshal() []byte + type Protocol struct + func New(opts ...ProtocolOption) *Protocol + func (p *Protocol) Ack(id hypergraph.ID) + func (p *Protocol) Bind(node *hypergraph.Node) error + func (p *Protocol) Discover(opts ...IteratorOption) []hypergraph.ID + func (p *Protocol) Find(target hypergraph.PublicKey, opts ...IteratorOption) []hypergraph.ID + func (p *Protocol) Handle(ctx hypergraph.HandlerContext) error + func (p *Protocol) OnMessageRecv(client *hypergraph.Client) + func (p *Protocol) OnMessageSent(client *hypergraph.Client) + func (p *Protocol) OnPeerConnected(client *hypergraph.Client) + func (p *Protocol) OnPingFailed(addr string, err error) + func (p *Protocol) Ping(ctx context.Context, addr string) error + func (p *Protocol) Protocol() hypergraph.Protocol + func (p *Protocol) Table() *Table + type ProtocolOption func(p *Protocol) + func WithProtocolEvents(events Events) ProtocolOption + func WithProtocolLogger(logger *zap.Logger) ProtocolOption + func WithProtocolPingTimeout(pingTimeout time.Duration) ProtocolOption + type Table struct + func NewTable(self hypergraph.ID) *Table + func (t *Table) Bucket(target hypergraph.PublicKey) []hypergraph.ID + func (t *Table) Delete(target hypergraph.PublicKey) (hypergraph.ID, bool) + func (t *Table) DeleteByAddress(target string) (hypergraph.ID, bool) + func (t *Table) Entries() []hypergraph.ID + func (t *Table) FindClosest(target hypergraph.PublicKey, k int) []hypergraph.ID + func (t *Table) Last(target hypergraph.PublicKey) hypergraph.ID + func (t *Table) NumEntries() int + func (t *Table) Peers() []hypergraph.ID + func (t *Table) Recorded(target hypergraph.PublicKey) bool + func (t *Table) Self() hypergraph.ID + func (t *Table) Update(target hypergraph.ID) (bool, error)