indexerlookup

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2025 License: Apache-2.0, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DelegatedProvider

type DelegatedProvider struct {
	Schema    string                 `json:"Schema"`
	ID        string                 `json:"ID"`
	Addrs     []string               `json:"Addrs,omitempty"`
	Protocols []string               `json:"Protocols,omitempty"`
	Metadata  map[string]interface{} `json:"-"` // Capture all additional fields
}

DelegatedProvider represents a single provider in the delegated routing response

func (*DelegatedProvider) ToAddrInfo

func (dp *DelegatedProvider) ToAddrInfo() (*peer.AddrInfo, error)

ToAddrInfo converts the delegated provider to a libp2p peer.AddrInfo

func (*DelegatedProvider) ToMetadata

func (dp *DelegatedProvider) ToMetadata() (metadata.Metadata, error)

ToMetadata converts the delegated provider's protocol information to metadata.Metadata

func (*DelegatedProvider) UnmarshalJSON

func (dp *DelegatedProvider) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom JSON unmarshaling to capture protocol-specific metadata

type DelegatedRoutingResponse

type DelegatedRoutingResponse struct {
	Providers []DelegatedProvider `json:"Providers"`
}

DelegatedRoutingResponse represents the HTTP Routing V1 API response format See: https://specs.ipfs.tech/routing/http-routing-v1/#get-routing-v1-providers-cid

type IndexerCandidateSource

type IndexerCandidateSource struct {
	// contains filtered or unexported fields
}

func NewCandidateSource

func NewCandidateSource(o ...Option) (*IndexerCandidateSource, error)

func (*IndexerCandidateSource) FindCandidates

func (idxf *IndexerCandidateSource) FindCandidates(ctx context.Context, c cid.Cid, cb func(types.RetrievalCandidate)) error

type Option

type Option func(*options) error

func WithAsyncResultsChanBuffer

func WithAsyncResultsChanBuffer(i int) Option

WithAsyncResultsChanBuffer sets the channel buffer returned by IndexerCandidateSource.FindCandidates. Defaults to 1 if unspecified.

func WithHttpClient

func WithHttpClient(c *http.Client) Option

WithHttpClient sets the http.Client used to contact the delegated routing service. Defaults to http.DefaultClient if unspecified.

func WithHttpClientTimeout

func WithHttpClientTimeout(t time.Duration) Option

WithHttpClientTimeout sets the timeout for the HTTP requests sent to the delegated routing service. Defaults to one minute if unspecified.

func WithHttpEndpoint

func WithHttpEndpoint(e *url.URL) Option

WithHttpEndpoint sets the delegated routing HTTP API endpoint. Defaults to https://cid.contact if unspecified.

func WithHttpUserAgent

func WithHttpUserAgent(a string) Option

WithHttpUserAgent sets the User-Agent header value when contacting the delegated routing HTTP API. Setting this option to empty string will disable inclusion of User-Agent header. Defaults to "sheltie" if unspecified.

func WithProtocols

func WithProtocols(protocols []multicodec.Code) Option

WithProtocols sets the list of protocols to filter by when querying the delegated routing service. This adds a filter-protocols query parameter to requests (for spec-compliant servers) and performs client-side filtering as fallback (for non-compliant servers like cid.contact). If unspecified, no protocol filtering is applied.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址