Documentation ¶
Index ¶
- Constants
- func GetHashLink(resource, metadata string) string
- func GetHashLinkFromResourceHash(resource string) string
- func GetResourceHashFromHashLink(hashLink string) (string, error)
- func ToString(hl ...*url.URL) string
- type Decoder
- type Encoder
- type HashLink
- func (hl *HashLink) CreateHashLink(content []byte, links []string) (string, error)
- func (hl *HashLink) CreateMetadataFromLinks(links []string) (string, error)
- func (hl *HashLink) CreateResourceHash(content []byte) (string, error)
- func (hl *HashLink) GetLinksFromMetadata(enc string) ([]string, error)
- func (hl *HashLink) ParseHashLink(hashLink string) (*Info, error)
- type Info
- type Option
Constants ¶
const (
// HLPrefix is hash link prefix.
HLPrefix = hl + separator
)
Variables ¶
This section is empty.
Functions ¶
func GetHashLink ¶
GetHashLink will create hashlink from resource hash and metadata.
func GetHashLinkFromResourceHash ¶
GetHashLinkFromResourceHash will create hashlink from resource hash.
func GetResourceHashFromHashLink ¶
GetResourceHashFromHashLink will return resource hash.
Types ¶
type HashLink ¶
type HashLink struct {
// contains filtered or unexported fields
}
HashLink implements hashlink related functionality.
func (*HashLink) CreateHashLink ¶
CreateHashLink will create hashlink for the supplied content and links.
func (*HashLink) CreateMetadataFromLinks ¶
CreateMetadataFromLinks will create metadata for the supplied links.
func (*HashLink) CreateResourceHash ¶
CreateResourceHash will create resource hash for the supplied content.
func (*HashLink) GetLinksFromMetadata ¶
GetLinksFromMetadata will create links from metadata.
type Option ¶
type Option func(opts *HashLink)
Option is a hashlink instance option.
func WithDecoder ¶
WithDecoder option is for specifying custom decoder.
func WithEncoder ¶
WithEncoder option is for specifying custom encoder.
func WithMultihashCode ¶
WithMultihashCode option is for specifying custom multihash code.