Documentation ¶
Index ¶
- Variables
- func Verify(ctx context.Context, mention *Mention, configurators ...func(c *VerifyOptions)) error
- type Document
- type EndpointDiscoverer
- type EndpointDiscoveryConfiguration
- type EndpointDiscoveryConfigurator
- type Mention
- type Sender
- type SenderConfiguration
- type SenderConfigurator
- type Verifier
- type VerifyOptions
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidRequest = errors.New("the request does not contain a source and a target")
ErrInvalidRequest is returned by ExtractMention if either source or target are not provided or not URLs.
var ErrUnsupportedContentType = errors.New("application/x-www-form-urlencoded content-type required")
ErrUnsupportedContentType is returned by ExtractMention if the POST request is not form-urlencoded.
var ErrUnsupportedMethod = errors.New("unsupported HTTP method")
ErrUnsupportedMethod is returned by ExtractMention if a non-POST request is present.
Functions ¶
Types ¶
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
func DocumentFromReader ¶
func (*Document) ExternalLinks ¶
type EndpointDiscoverer ¶
type EndpointDiscoverer interface {
DiscoverEndpoint(ctx context.Context, url string) (string, error)
}
EndpointDiscoverer is used to discover the Webmention endpoint for the given URL.
func NewEndpointDiscoverer ¶
func NewEndpointDiscoverer(configurators ...EndpointDiscoveryConfigurator) EndpointDiscoverer
NewEndpointDiscoverer creates a new EndpointDiscoverer configured with the given configurators.
type EndpointDiscoveryConfiguration ¶
EndpointDiscoveryConfiguration allows to pass configuration parameters to a new Discoverer.
type EndpointDiscoveryConfigurator ¶
type EndpointDiscoveryConfigurator func(*EndpointDiscoveryConfiguration)
EndpointDiscoveryConfigurator is passed to NewEndDiscoverer to configure it.
type Mention ¶
type Mention struct { Source string Target string Title string Content string AuthorName string Type string RSVP string }
Mention is what is sent to a receiver linking source and target.
type Sender ¶
type Sender interface { // Send a webmention to the specified endpoint indicating that source // mentioned target. Send(ctx context.Context, endpoint string, mention Mention) error }
Sender is used to send webmentions.
func NewSender ¶
func NewSender(configurators ...SenderConfigurator) Sender
NewSender creates a configured sender implementation.
type SenderConfiguration ¶
SenderConfiguration allows to inject a custom HTTP Client into the Sender.
type SenderConfigurator ¶
type SenderConfigurator func(*SenderConfiguration)
SenderConfigurator is used as argument for the NewSender method and helps configuring a new Sender instance.
type Verifier ¶
type Verifier interface {
Verify(ctx context.Context, resp *http.Response, body io.Reader, mention *Mention) error
}
Verifier is used to check if a given response body produced by fetching mention.Source contains a link to mention.Target.
type VerifyOptions ¶
type VerifyOptions struct {
MaxRedirects int
}