xrd

package
v0.0.0-...-30adf6a Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2018 License: MIT Imports: 6 Imported by: 3

Documentation

Overview

Package xrd implements Extensible Resource Descriptor as defined in http://docs.oasis-open.org/xri/xrd/v1.0/xrd-1.0.html.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSuchResource = errors.New("xrd: no such resource")

ErrNoSuchResource can be returned by a Backend if a resource doesn't exist.

Functions

func NewHandler

func NewHandler(be Backend) http.Handler

NewHandler creates a new XRD endpoint.

Types

type Backend

type Backend interface {
	Resource(req *http.Request) (*Resource, error)
}

A Backend is used to build an XRD endpoint.

type HTTPError

type HTTPError int

An HTTPError is returned when an HTTP error has occured. Its value is the HTTP status code.

func (HTTPError) Error

func (err HTTPError) Error() string

Error implements error.

type Link struct {
	Rel        string            `xml:"rel,attr,omitempty" json:"rel"`
	Type       string            `xml:"type,attr,omitempty" json:"type,omitempty"`
	Href       string            `xml:"href,attr,omitempty" json:"href,omitempty"`
	Template   string            `xml:"template,attr,omitempty" json:"template,omitempty"`
	Titles     map[string]string `xml:"-" json:"titles,omitempty"`
	Properties map[string]string `xml:"-" json:"properties,omitempty"`
}

A Link provides a relationship between a resource and a URL.

type Resource

type Resource struct {
	XMLName    xml.Name          `xml:"http://docs.oasis-open.org/ns/xri/xrd-1.0 XRD" json:"-"`
	Subject    string            `xml:"Subject" json:"subject,omitempty"`
	Aliases    []string          `xml:"Alias" json:"aliases,omitempty"`
	Properties map[string]string `xml:"-" json:"properties,omitempty"`
	Links      []*Link           `xml:"Link" json:"links,omitempty"`
}

A Resource is a resource descriptor.

func Get

func Get(url string) (*Resource, error)

Get queries a resource.

Directories

Path Synopsis
Package hostmeta implements Web Host Metadata, as defined in https://tools.ietf.org/html/rfc6415.
Package hostmeta implements Web Host Metadata, as defined in https://tools.ietf.org/html/rfc6415.
Package lrdd implements Link-based Resource Descriptor Discovery as defined in https://tools.ietf.org/html/draft-hammer-discovery-04.
Package lrdd implements Link-based Resource Descriptor Discovery as defined in https://tools.ietf.org/html/draft-hammer-discovery-04.
Package webfinger implements WebFinger, as defined in https://tools.ietf.org/html/rfc7033.
Package webfinger implements WebFinger, as defined in https://tools.ietf.org/html/rfc7033.

Jump to

Keyboard shortcuts

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