dial

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAfterHookPriority = 10
)

Variables

This section is empty.

Functions

func Dial

func Dial(addr string, opts ...DialOption) (c net.Conn, err error)

func DialContext

func DialContext(ctx context.Context, addr string, opts ...DialOption) (c net.Conn, err error)

Types

type AfterHook

type AfterHook struct {
	// smaller value will be called first, 0 is reserverd for private use.
	// If caller set this 0, use DefaultAfterHookPriority instead.
	Priority uint64
	Hook     AfterHookFunc
}

type AfterHookFunc

type AfterHookFunc func(ctx context.Context, c net.Conn, addr string) (context.Context, net.Conn, error)

type BeforeHook

type BeforeHook struct {
	Hook BeforeHookFunc
}

type BeforeHookFunc

type BeforeHookFunc func(ctx context.Context, addr string) context.Context

type DialMetas

type DialMetas map[interface{}]interface{}

func GetDialMetasFromContext

func GetDialMetasFromContext(ctx context.Context) DialMetas

func (DialMetas) Value

func (m DialMetas) Value(key interface{}) interface{}

type DialOption

type DialOption interface {
	// contains filtered or unexported methods
}

func WithAfterHook

func WithAfterHook(hook AfterHook) DialOption

func WithKeepAlive

func WithKeepAlive(keepAlive time.Duration) DialOption

func WithLocalAddr

func WithLocalAddr(laddr string) DialOption

func WithProtocol

func WithProtocol(protocol string) DialOption

func WithProxy

func WithProxy(proxyType string, address string) DialOption

func WithProxyAuth

func WithProxyAuth(auth *ProxyAuth) DialOption

func WithTLSConfig

func WithTLSConfig(tlsConfig *tls.Config) DialOption

func WithTimeout

func WithTimeout(timeout time.Duration) DialOption

type ProxyAuth

type ProxyAuth struct {
	Username string
	Passwd   string
}

func ParseProxyURL

func ParseProxyURL(proxyURL string) (proxyType string, address string, auth *ProxyAuth, err error)

Jump to

Keyboard shortcuts

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