Documentation
¶
Index ¶
Constants ¶
const ( DefaultRecordsLimit = 20 DefaultStreamingRecordsLimit = 0 DefaultRoutingTimeout = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ContentRouter ¶
type ContentRouter = DelegatedRouter
ContentRouter is deprecated, use DelegatedRouter instead. Deprecated: use DelegatedRouter. ContentRouter will be removed in a future version.
type DelegatedRouter ¶ added in v0.36.0
type DelegatedRouter interface {
// FindProviders searches for peers who are able to provide the given [cid.Cid].
// Limit indicates the maximum amount of results to return; 0 means unbounded.
FindProviders(ctx context.Context, cid cid.Cid, limit int) (iter.ResultIter[types.Record], error)
// Deprecated: historic API from [IPIP-526], may be removed in a future version.
//
// [IPIP-526]: https://specs.ipfs.tech/ipips/ipip-0526/
ProvideBitswap(ctx context.Context, req *BitswapWriteProvideRequest) (time.Duration, error)
// FindPeers searches for peers who have the provided [peer.ID].
// Limit indicates the maximum amount of results to return; 0 means unbounded.
FindPeers(ctx context.Context, pid peer.ID, limit int) (iter.ResultIter[*types.PeerRecord], error)
// GetIPNS searches for an [ipns.Record] for the given [ipns.Name].
GetIPNS(ctx context.Context, name ipns.Name) (*ipns.Record, error)
// PutIPNS stores the provided [ipns.Record] for the given [ipns.Name].
// It is guaranteed that the record matches the provided name.
PutIPNS(ctx context.Context, name ipns.Name, record *ipns.Record) error
// GetClosestPeers returns the DHT closest peers to the given key (CID or Peer ID).
GetClosestPeers(ctx context.Context, key cid.Cid) (iter.ResultIter[*types.PeerRecord], error)
}
DelegatedRouter provides the Delegated Routing V1 HTTP API for offloading routing operations to another process/server.
This interface focuses on querying operations for content providers, peers, IPNS records, and DHT routing information. It also supports delegated IPNS publishing. Additional publishing methods may be added in the future via the IPIP process as the ecosystem evolves and new needs arise.
type FindProvidersAsyncResponse ¶ added in v0.9.0
type Option ¶ added in v0.9.0
type Option func(s *server)
func WithPrometheusRegistry ¶ added in v0.25.0
func WithPrometheusRegistry(reg prometheus.Registerer) Option
func WithRecordsLimit ¶ added in v0.9.0
WithRecordsLimit sets a limit that will be passed to [ContentRouter.FindProviders] and [ContentRouter.FindPeers] for non-streaming requests (application/json). Default is DefaultRecordsLimit.
func WithRoutingTimeout ¶ added in v0.25.0
func WithStreamingRecordsLimit ¶ added in v0.9.0
WithStreamingRecordsLimit sets a limit that will be passed to [ContentRouter.FindProviders] and [ContentRouter.FindPeers] for streaming requests (application/x-ndjson). Default is DefaultStreamingRecordsLimit.
func WithStreamingResultsDisabled ¶ added in v0.9.0
func WithStreamingResultsDisabled() Option
WithStreamingResultsDisabled disables ndjson responses, so that the server only supports JSON responses.