dial

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: BSD-2-Clause Imports: 8 Imported by: 12

Documentation

Overview

Package dial contains methods and types for dialing XMPP connections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

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

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.

Types

type Dialer

type Dialer struct {
	net.Dialer

	// NoLookup stops the dialer from looking up SRV 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 implicit TLS entirely (eg. when using opportunistic TLS on a server
	// that does not support implicit TLS).
	NoTLS bool

	// The configuration to use when dialing with implicit TLS support.
	// Setting TLSConfig has no effect if NoTLS is true.
	// The default 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 various session establishment functions in the main xmpp package should be passed the resulting 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

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. 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").

func (*Dialer) DialServer added in v0.22.0

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

DialServer behaves exactly the same as Dial, besides that the server it tries to connect to is given as argument instead of using the domainpart of the JID.

Changing the server does not affect the server name expected by the default TLSConfig which remains the addresses domainpart.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL