proxy

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialer

type Dialer interface {
	Dial(context.Context, *addr.Addr) (net.Conn, error)
}
var DirectDialer Dialer = DialerFunc(func(ctx context.Context, a *addr.Addr) (net.Conn, error) {
	var d net.Dialer
	return d.DialContext(ctx, "tcp", a.String())
})

type DialerFunc

type DialerFunc func(context.Context, *addr.Addr) (net.Conn, error)

func (DialerFunc) Dial

func (f DialerFunc) Dial(ctx context.Context, h *addr.Addr) (net.Conn, error)

type Logger

type Logger interface {
	Error(msg string, fields ...any)
	Info(msg string, fields ...any)
}
var DiscardLogger Logger = discardLogger{}

func NewContextLogger

func NewContextLogger(l Logger, fields ...any) Logger

type Proto

type Proto int
const (
	ProtoDirect Proto = iota + 1

	ProtoSOCKS
	ProtoSOCKS4
	ProtoSOCKS4a
	ProtoSOCKS5
	ProtoSOCKS5h

	ProtoHTTP
)

func (Proto) MarshalText

func (p Proto) MarshalText() ([]byte, error)

func (Proto) String

func (p Proto) String() string

func (*Proto) UnmarshalText

func (p *Proto) UnmarshalText(text []byte) error

type Proxy

type Proxy interface {
	ForwardHTTP(ctx context.Context, r *http.Request, dstHost *addr.Addr) (*http.Response, error)
	OpenTunnel(ctx context.Context, srcConn net.Conn, dstHost *addr.Addr) (done <-chan error, err error)
}

func New

func New(d Dialer) Proxy

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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