Documentation ¶
Index ¶
- Variables
- func Name(peerID peer.ID) string
- func Resolve(ctx context.Context, name string, findURL string) (path.Path, error)
- func ResolveNotPrivate(ctx context.Context, name string, findURL string) (path.Path, error)
- type Naam
- type Option
- func WithAnnounceURL(a string) Option
- func WithDatastore(ds datastore.Datastore) Option
- func WithFindURL(a string) Option
- func WithHost(h host.Host) Option
- func WithHttpClient(c *http.Client) Option
- func WithLinkSystem(ls *ipld.LinkSystem) Option
- func WithListenAddr(a string) Option
- func WithProviderAddrs(addrs ...string) Option
- func WithPublisherAddrs(addrs ...string) Option
- func WithReaderPrivacy(enabled bool) Option
- type PublishOption
Constants ¶
This section is empty.
Variables ¶
var ( MetadataProtocolID = multicodec.IpnsRecord ContextID = []byte("/ipni/naam") )
var ErrNotFound = errors.New("naam: not found")
ErrNotFound is returned when naam fails to find the requested IPNS record.
Functions ¶
func Resolve ¶
Resolve performs a reader-privacy-enabled indexer lookup of the name and returns the IPFS path identified by the name. The multihash lookup request is sent to the host specified in findURL.
func ResolveNotPrivate ¶
ResolveNotPrivate performs an indexer lookup of the name, without reader privacy, and returns the IPFS path identified by the name. The multihash lookup request is sent to the host specified by findURL.
Types ¶
type Naam ¶
type Naam struct {
// contains filtered or unexported fields
}
func (*Naam) Publish ¶
Publish creates a new IPNI advertisement containing an IPNS record for the given path value and a multihash key for the peer. The advertisement is published to the configured indexer.
This allows the peer multihash to lookup an IPNS record using an IPNI indexer. The IPNS record is then resolved to the path that was published in the IPNI advertisement.
func (*Naam) Resolve ¶
Resolve returns the IPFS path identified by the specified name.
If name matches that of this Naam instance, it is fetched from the local datastore. Otherwise, Resolve performs an indexer lookup of the name. Reader-privacy is enabled by default unless the option WithReaderPrivacy(false) was specified.
If doing an indexer lookup, the multihash lookup request is sent to the host specified in the WithHttpFindURL option, or if not specified, then in WithHttpIndexerURL.
type Option ¶
type Option func(*options)
func WithAnnounceURL ¶
WithAnnounceURL is the IPNI endpoint to send direct HTTP advertisement announcement messages to. If no values are specified, then the value of defaultAnnounceURL is used.
func WithDatastore ¶
func WithDatastore(ds datastore.Datastore) Option
WithDatastore supplies an existing datastore. An in-memory datastore is created if one is not supplied.
func WithFindURL ¶
WithFindURL configures the URL use for lookups. This is the URL of the dhstore that is used for multihash lookup. If not specified the URL configured by WithAnnounceURL is used.
func WithHttpClient ¶
WithHttpClient supplies an optional HTTP client. If not specified, the default client is used.
func WithLinkSystem ¶
func WithLinkSystem(ls *ipld.LinkSystem) Option
func WithListenAddr ¶
WithListenAddr specifies the address:port that the publisher listens on when serving advertisements over HTTP. If not specified, the default "0.0.0.0:8080" is used.
func WithProviderAddrs ¶
WithProviderAddrs are multiaddrs that get put into advertisements as the provider addresses. If not specified then the publisher addresses are used.
When publishing to a public indexer, this should always be set to a public address so that the advertisement is not rejected.
These addresses to not have a role in resolving IPNS, but may be used to tell an IPNS clients where to get the content corresponding to the CIR in the IPNS record.
func WithPublisherAddrs ¶
WithPublisherAddrs is the multiaddr that tells IPNI where to fetch advertisements from.
This address must be routable from the indexer. If not specified then the publisher listen addresses are used.
func WithReaderPrivacy ¶
WithReaderPrivacy enables (true) or disables (false) reader-privacy. This is enabled by default.
type PublishOption ¶
type PublishOption func(*publishOptions)
func WithEOL ¶
func WithEOL(eol time.Time) PublishOption
func WithEmbedPublicKey ¶
func WithEmbedPublicKey(epk bool) PublishOption
func WithTTL ¶
func WithTTL(ttl time.Duration) PublishOption