proxy

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KeepAliveTime = 180 * time.Second
	// DialTimeout is the timeout of dial.
	DialTimeout    = 5 * time.Second
	ConnectTimeout = 5 * time.Second
)

Functions

This section is empty.

Types

type Dialer

type Dialer interface {
	Dial(network, addr string) (c net.Conn, err error)
}
var (
	Direct Dialer = &net.Dialer{
		Timeout:   DialTimeout,
		KeepAlive: KeepAliveTime,
	}
)

func NewDialer

func NewDialer(rawURL string, forward Dialer) (Dialer, error)

type DialerContext

type DialerContext interface {
	Dialer
	DialContext(ctx context.Context, network, addr string) (net.Conn, error)
}

func NewHTTPDialer

func NewHTTPDialer(addr string, forward Dialer, options HTTPOptions) DialerContext

type DialerContextFunc

type DialerContextFunc func(ctx context.Context, network, addr string) (net.Conn, error)

func (DialerContextFunc) Dial

func (f DialerContextFunc) Dial(network, addr string) (net.Conn, error)

func (DialerContextFunc) DialContext

func (f DialerContextFunc) DialContext(ctx context.Context, network, addr string) (net.Conn, error)

type HTTPDialer

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

func (*HTTPDialer) Dial

func (d *HTTPDialer) Dial(network, addr string) (net.Conn, error)

func (*HTTPDialer) DialContext

func (d *HTTPDialer) DialContext(ctx context.Context, network, addr string) (conn net.Conn, err error)

type HTTPOptions

type HTTPOptions struct {
	UserAgent string
	User      *url.Userinfo
	Timeout   time.Duration
}

Jump to

Keyboard shortcuts

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