xmpp: mellium.im/xmpp/dial Index | Files

package dial

import "mellium.im/xmpp/dial"

Package dial contains methods and types for dialing XMPP connections.

Index

Package Files

dial.go

func Client Uses

func Client(ctx context.Context, network string, addr jid.JID) (net.Conn, error)

Client discovers and connects to the address on the named network with a client-to-server (c2s) connection.

For more information see the Dialer type.

func Server Uses

func Server(ctx context.Context, network string, addr jid.JID) (net.Conn, error)

Server discovers and connects to the address on the named network with a server-to-server connection (s2s).

For more info see the Dialer type.

type Dialer Uses

type Dialer struct {
    net.Dialer

    // NoLookup stops the dialer from looking up SRV or TXT records for the given
    // domain. It also prevents fetching of the host metadata file.
    // Instead, it will try to connect to the domain directly.
    NoLookup bool

    // S2S causes the server to attempt to dial a server-to-server connection.
    S2S bool

    // Disable TLS entirely (eg. when using StartTLS on a server that does not
    // support implicit TLS).
    NoTLS bool

    // Attempt to create a TLS connection by first looking up SRV records (unless
    // NoLookup is set) and then attempting to use the domains A or AAAA record.
    // The nil value is interpreted as a tls.Config with the expected host set to
    // that of the connection addresses domain part.
    TLSConfig *tls.Config
}

A Dialer contains options for connecting to an XMPP address. After a connection is established the Dial method does not attempt to create an XMPP session on the connection.

The zero value for each field is equivalent to dialing without that option. Dialing with the zero value of Dialer is equivalent to calling the Client function.

func (*Dialer) Dial Uses

func (d *Dialer) Dial(ctx context.Context, network string, addr jid.JID) (net.Conn, error)

Dial discovers and connects to the address on the named network. It will attempt to look up SRV records for the JIDs domainpart or connect to the domainpart directly if dialing the SRV records fails. If Dial returns a net.DNSError, setting NoTLS and then NoLookup and trying again may be a good fallback order.

If the context expires before the connection is complete, an error is returned. Once successfully connected, any expiration of the context will not affect the connection.

Network may be any of the network types supported by net.Dial, but you most likely want to use one of the tcp connection types ("tcp", "tcp4", or "tcp6").

Package dial imports 7 packages (graph) and is imported by 1 packages. Updated 2019-08-17. Refresh now. Tools for package owners.