Versions in this module Expand all Collapse all v0 v0.0.2 Jan 23, 2025 v0.0.1 Jan 22, 2025 Changes in this version + var ErrNotFound = errors.New("路由: 未找到") + var ErrNotSupported = errors.New("路由: 不支持的操作或密钥") + var QueryEventBufferSize = 16 + func GetPublicKey(r ValueStore, ctx context.Context, p peer.ID) (ci.PubKey, error) + func KeyForPublicKey(id peer.ID) string + func PublishQueryEvent(ctx context.Context, ev *QueryEvent) + func RegisterForQueryEvents(ctx context.Context) (context.Context, <-chan *QueryEvent) + func SubscribesToQueryEvents(ctx context.Context) bool + type ContentDiscovery interface + FindProvidersAsync func(context.Context, cid.Cid, int) <-chan peer.AddrInfo + type ContentProviding interface + Provide func(context.Context, cid.Cid, bool) error + type ContentRouting interface + type Option func(opts *Options) error + var Expired Option = func(opts *Options) error { ... } + var Offline Option = func(opts *Options) error { ... } + type Options struct + Expired bool + Offline bool + Other map[interface{}]interface{} + func (opts *Options) Apply(options ...Option) error + func (opts *Options) ToOption() Option + type PeerRouting interface + FindPeer func(context.Context, peer.ID) (peer.AddrInfo, error) + type PubKeyFetcher interface + GetPublicKey func(context.Context, peer.ID) (ci.PubKey, error) + type QueryEvent struct + Extra string + ID peer.ID + Responses []*peer.AddrInfo + Type QueryEventType + func (qe *QueryEvent) MarshalJSON() ([]byte, error) + func (qe *QueryEvent) UnmarshalJSON(b []byte) error + type QueryEventType int + const AddingPeer + const DialingPeer + const FinalPeer + const PeerResponse + const Provider + const QueryError + const SendingQuery + const Value + type Routing interface + Bootstrap func(context.Context) error + type ValueStore interface + GetValue func(context.Context, string, ...Option) ([]byte, error) + PutValue func(context.Context, string, []byte, ...Option) error + SearchValue func(context.Context, string, ...Option) (<-chan []byte, error)