Documentation
¶
Overview ¶
Package webfinger provides a simple client implementation of the WebFinger protocol.
It is a work in progress, the API is not frozen. We're trying to catchup with the last draft of the protocol: http://tools.ietf.org/html/draft-ietf-appsawg-webfinger-14 and to support the http://webfist.org
Example:
package main
import (
"fmt"
"github.com/ant0ine/go-webfinger"
"os"
)
func main() {
email := os.Args[1]
client := webfinger.NewClient(nil)
resource, err := webfinger.MakeResource(email)
if err != nil {
panic(err)
}
jrd, err := client.GetJRD(resource)
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("JRD: %+v", jrd)
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultClient = &Client{ client: http.DefaultClient, WebFistServer: webFistDefaultServer, }
DefaultClient is the default Client and is used by Lookup.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// WebFistServer is the host used for issuing WebFist queries when standard
// WebFinger lookup fails. If set to the empty string, queries will not fall
// back to the WebFist protocol.
WebFistServer string
// Allow the use of HTTP endoints for lookups. The WebFinger spec requires
// all lookups be performed over HTTPS, so this should only ever be enabled
// for development.
AllowHTTP bool
// contains filtered or unexported fields
}
A Client is a WebFinger client.
func NewClient ¶
NewClient returns a new WebFinger Client. If a nil http.Client is provied, http.DefaultClient will be used. New Clients will use the default WebFist host if WebFinger lookup fails.
func (*Client) Lookup ¶
Lookup returns the JRD for the specified identifier. If provided, only the specified rel values will be requested, though WebFinger servers are not obligated to respect that request.
func (*Client) LookupResource ¶
LookupResource returns the JRD for the specified Resource. If provided, only the specified rel values will be requested, though WebFinger servers are not obligated to respect that request.
type Resource ¶
Resource is a resource for which a WebFinger query can be issued.
func Parse ¶
Parse parses rawurl into a WebFinger Resource. The rawurl should be an absolute URL, or an email-like identifier (e.g. "bob@example.com").
func (*Resource) JRDURL ¶
JRDURL returns the WebFinger query URL at the specified host for this resource. If host is an empty string, the default host for the resource will be used, as returned from WebFingerHost().
func (*Resource) WebFingerHost ¶
WebFingerHost returns the default host for issuing WebFinger queries for this resource. For Resource URLs with a host component, that value is used. For URLs that do not have a host component, the host is determined by other mains if possible (for example, the domain in the addr-spec of a mailto URL). If the host cannot be determined from the URL, this value will be an empty string.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
cmdline
command
TODO * improve JRD output * do stuff with the JRD
|
TODO * improve JRD output * do stuff with the JRD |
|
simple
command
Minimal example, used in the README
|
Minimal example, used in the README |
|
Package jrd provides a simple JRD parser.
|
Package jrd provides a simple JRD parser. |
