resource

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option added in v0.1.3

type Option func(opts *Resolver)

Option is a resolver option.

func WithCacheLifetime added in v0.1.3

func WithCacheLifetime(lifetime time.Duration) Option

WithCacheLifetime option defines the lifetime of an object in the cache.

func WithCacheSize added in v0.1.3

func WithCacheSize(size int) Option

WithCacheSize option defines the cache size.

type Resolver

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

Resolver is used for resolving host-meta resources.

func New

func New(httpClient *http.Client, ipfsReader *ipfs.Client, domainResolver domainResolver, opts ...Option) *Resolver

New returns a new Resolver. ipfsReader is optional. If not provided (is nil), then host-meta links specified with IPNS won't be resolvable.

func (c *Resolver) ResolveHostMetaLink(urlToGetHostMetaFrom, linkType string) (string, error)

ResolveHostMetaLink resolves a host-meta link for a given url and linkType. The url may have an HTTP, HTTPS, or IPNS scheme. If the url has an HTTP or HTTPS scheme, then the hostname for the host-meta call will be extracted from the url argument. Example: For url = https://orb.domain1.com/services/orb, this method will look for a host-meta document at the following URL: https://orb.domain1.com/.well-known/host-meta. If the resource has an IPNS scheme, then this method will look for a host-meta document stored under that IPNS address. In both cases, the first link in the host-meta document with a matching type will have its associated href value returned.

Directories

Path Synopsis
didanchorinfo/mocks
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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