webmention

package module
Version: v0.0.0-...-8052267 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: BSD-3-Clause Imports: 9 Imported by: 1

README

webmention

GoDoc Test Status Test Coverage

webmention is a go library and command line tool for assisting in sending webmentions.

Install the library by running:

go get willnorris.com/go/webmention

To install the command line tool, run:

go get willnorris.com/go/webmention/cmd/webmention

License

This library is copyright Google, but is not an official Google product. It is available under a BSD License.

Documentation

Overview

Package webmention provides functions for discovering the webmention endpoint for URLs, and sending webmentions according to http://webmention.org/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoverLinksFromReader

func DiscoverLinksFromReader(r io.Reader, baseURL string, sel string) ([]string, error)

DiscoverLinksFromReader discovers URLs in the HTML read from 'r'. Relative URLs found the HTML are resolved against 'baseURL'. These are candidates for sending webmentions to. If non-empty, sel is a CSS selector identifying the root node(s) to search in for links.

Types

type Client

type Client struct {
	*http.Client
}

Client is a webmention client that can discover webmention endpoints and send webmentions.

func New

func New(client *http.Client) *Client

New constructs a new webmention Client using the provided http.Client. If a nil http.Client is provided, http.DefaultClient is used.

func (*Client) DiscoverEndpoint

func (c *Client) DiscoverEndpoint(urlStr string) (string, error)

DiscoverEndpoint discovers the webmention endpoint for the provided URL.

func (c *Client) DiscoverLinks(urlStr string, sel string) ([]string, error)

DiscoverLinks discovers URLs that the provided resource links to. These are candidates for sending webmentions to. If non-empty, sel is a CSS selector identifying the root node(s) to search in for links.

func (*Client) SendWebmention

func (c *Client) SendWebmention(endpoint, source, target string) (*http.Response, error)

SendWebmention sends a webmention to endpoint, indicating that source has mentioned target.

Directories

Path Synopsis
cmd
webmention
The webmention binary is a command line utility for sending webmentions to the URLs linked to by a given webpage.
The webmention binary is a command line utility for sending webmentions to the URLs linked to by a given webpage.
third_party
header
Package header provides functions for parsing HTTP headers.
Package header provides functions for parsing HTTP headers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL