xmpp: mellium.im/xmpp/internal/discover Index | Files

package discover

import "mellium.im/xmpp/internal/discover"

Package discover is used to look up information about XMPP-based services.

Index

Package Files

lookup.go notfound.go

Variables

var (
    ErrNoServiceAtAddress = errors.New("This address does not offer the requested service")
)

Errors related to address and service lookups.

func LookupBOSH Uses

func LookupBOSH(ctx context.Context, resolver *net.Resolver, client *http.Client, addr *jid.JID) (urls []string, err error)

LookupBOSH discovers BOSH endpoints that are valid for the given address using DNS TXT records and Web Host Metadata as described in XEP-0156. If client is nil, only DNS is queried.

func LookupPort Uses

func LookupPort(network, service string) (uint16, error)

LookupPort returns the default port for the provided network and service using net.LookupPort. If the provided service is one of xmpp-client, xmpp-server, or xmpp-bosh and it is not found by net.LookupPort, a default value is returned.

func LookupService Uses

func LookupService(ctx context.Context, resolver *net.Resolver, service, network string, addr net.Addr) (addrs []*net.SRV, err error)

LookupService looks for an XMPP service hosted by the given address. It returns addresses from SRV records or the default domain (as a fake SRV record) if no real records exist. Service should be one of "xmpp-client" or "xmpp-server".

func LookupWebsocket Uses

func LookupWebsocket(ctx context.Context, resolver *net.Resolver, client *http.Client, addr *jid.JID) (urls []string, err error)

LookupWebsocket discovers websocket endpoints that are valid for the given address using DNS TXT records and Web Host Metadata as described in XEP-0156. If client is nil, only DNS is queried.

type Link struct {
    Rel  string `xml:"rel,attr"`
    Href string `xml:"href,attr"`
}

Link is an individual hyperlink in an XRD document.

type XRD Uses

type XRD struct {
    XMLName xml.Name `xml:"http://docs.oasis-open.org/ns/xri/xrd-1.0 XRD"`
    Links   []Link   `xml:"Link"`
}

XRD represents an Extensible Resource Descriptor document of the form:

<?xml version='1.0' encoding=utf-9'?>
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
  …
  <Link rel="urn:xmpp:alt-connections:xbosh"
        href="https://web.example.com:5280/bosh" />
  <Link rel="urn:xmpp:alt-connections:websocket"
        href="wss://web.example.com:443/ws" />
  …
</XRD>

as defined by RFC 6415 and OASIS.XRD-1.0.

Package discover imports 11 packages (graph) and is imported by 1 packages. Updated 2019-08-25. Refresh now. Tools for package owners.