microformats

package
v0.0.0-...-3a2841b Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoApp = errors.New("no h-x-app or h-app could be found")

ErrNoApp is used to signal when no app microformat exists.

Functions

This section is empty.

Types

type App

type App struct {
	Name         string
	URL          string
	RedirectURIs []string
}

func ParseApp

func ParseApp(r io.Reader, baseURL *url.URL) (app App, err error)

type Event

type Event struct {
	Type EventType
	Link string
	Err  error
}

Event is emitted by Me as new links are found and verified.

type EventType

type EventType uint

EventType defines what has occured.

const (
	// Error means something went wrong when trying to request a URL.
	Error EventType = iota
	// Found means a new link has been found that could be used for
	// authentication.
	Found
	// Verified means a link has been confirmed as usable for authentication.
	Verified
	// Unverified means a previously found link can't be used for authentication.
	Unverified
	// PGP means a pgpkey has been found that can be used for authentication.
	PGP
)

type RelMe

type RelMe struct {
	Client           *http.Client
	NoRedirectClient *http.Client
}

func (*RelMe) Find

func (me *RelMe) Find(profile string) (links []string, err error)

Find takes a profile URL and returns a list of all hrefs in <a rel="me"/> elements on the page.

func (*RelMe) FindAuth

func (me *RelMe) FindAuth(profile string) (links []string, pgpkey string, err error)

FindAuth takes a profile URL and returns a list of all hrefs in <a rel="me authn"/> elements on the page that also link back to the profile, if none exist it fallsback to using hrefs in <a rel="me"/> elements as FindVerified does.

func (*RelMe) LinksTo

func (me *RelMe) LinksTo(remote, test string) (ok bool, err error)

LinksTo takes a remote profile URL and checks whether any of the hrefs in <a rel="me"/> elements match the test URL.

func (*RelMe) Me

func (client *RelMe) Me(profile string, strategies matching) <-chan Event

Me requests profile, then finds all links that can be used to authenticate the user.

Jump to

Keyboard shortcuts

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