dialer

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package dialer introduces base interfaces for the structs that are responsible for connecting to a host or modifying the connection logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DialFunc

type DialFunc func(network, addr string) (conn net.Conn, err error)

DialFunc is a function that opens a net.Conn to the specified addr over the specified network.

func (DialFunc) Dial

func (f DialFunc) Dial(network, addr string) (conn net.Conn, err error)

Dial calls f(w, r).

type Dialer

type Dialer interface {
	// Dial attempts to open a new connection to the specified address
	// over the specified network.
	Dial(network, addr string) (conn net.Conn, err error)
}

Dialer is a base interface for the structures responsible for connecting to hosts. Dialers are supposed to "chain" one over another in order to add more logic on top of the connection (redirecting, proxying, etc).

type Direct

type Direct struct {
	// contains filtered or unexported fields
}

Direct implements the Dialer interface and provides the base DialFunc implementation that resolves the target hostname and opens a connection to it.

func NewDirect

func NewDirect(resolver *resolve.Resolver, out *output.Output) (d *Direct)

NewDirect creates a new instance of *Direct.

func (*Direct) Dial

func (d *Direct) Dial(network, addr string) (conn net.Conn, err error)

Dial implements Dialer for *Direct.

Jump to

Keyboard shortcuts

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