proxy

package
v2.0.0-...-f08b0b4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2022 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package proxy provides implementations of proxy protocols.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(metadata *M.Metadata) (net.Conn, error)

Dial uses default Dialer to dial TCP.

func DialContext

func DialContext(ctx context.Context, metadata *M.Metadata) (net.Conn, error)

DialContext uses default Dialer to dial TCP with context.

func DialUDP

func DialUDP(metadata *M.Metadata) (net.PacketConn, error)

DialUDP uses default Dialer to dial UDP.

func SetDialer

func SetDialer(d Dialer)

SetDialer sets default Dialer.

Types

type Base

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

func (*Base) Addr

func (b *Base) Addr() string

func (*Base) DialContext

func (b *Base) DialContext(context.Context, *M.Metadata) (net.Conn, error)

func (*Base) DialUDP

func (b *Base) DialUDP(*M.Metadata) (net.PacketConn, error)

func (*Base) Proto

func (b *Base) Proto() proto.Proto

type Dialer

type Dialer interface {
	DialContext(context.Context, *M.Metadata) (net.Conn, error)
	DialUDP(*M.Metadata) (net.PacketConn, error)
}

type Direct

type Direct struct {
	*Base
}

func NewDirect

func NewDirect() *Direct

func (*Direct) DialContext

func (d *Direct) DialContext(ctx context.Context, metadata *M.Metadata) (net.Conn, error)

func (*Direct) DialUDP

func (d *Direct) DialUDP(*M.Metadata) (net.PacketConn, error)

type HTTP

type HTTP struct {
	*Base
	// contains filtered or unexported fields
}

func NewHTTP

func NewHTTP(addr, user, pass string) (*HTTP, error)

func (*HTTP) DialContext

func (h *HTTP) DialContext(ctx context.Context, metadata *M.Metadata) (c net.Conn, err error)

type Proxy

type Proxy interface {
	Dialer
	Addr() string
	Proto() proto.Proto
}

type Reject

type Reject struct {
	*Base
}

func NewReject

func NewReject() *Reject

func (*Reject) DialContext

func (r *Reject) DialContext(context.Context, *M.Metadata) (net.Conn, error)

func (*Reject) DialUDP

func (r *Reject) DialUDP(*M.Metadata) (net.PacketConn, error)

type Shadowsocks

type Shadowsocks struct {
	*Base
	// contains filtered or unexported fields
}

func NewShadowsocks

func NewShadowsocks(addr, method, password, obfsMode, obfsHost string) (*Shadowsocks, error)

func (*Shadowsocks) DialContext

func (ss *Shadowsocks) DialContext(ctx context.Context, metadata *M.Metadata) (c net.Conn, err error)

func (*Shadowsocks) DialUDP

func (ss *Shadowsocks) DialUDP(*M.Metadata) (net.PacketConn, error)

type Socks4

type Socks4 struct {
	*Base
	// contains filtered or unexported fields
}

func NewSocks4

func NewSocks4(addr, userID string) (*Socks4, error)

func (*Socks4) DialContext

func (ss *Socks4) DialContext(ctx context.Context, metadata *M.Metadata) (c net.Conn, err error)

type Socks5

type Socks5 struct {
	*Base
	// contains filtered or unexported fields
}

func NewSocks5

func NewSocks5(addr, user, pass string) (*Socks5, error)

func (*Socks5) DialContext

func (ss *Socks5) DialContext(ctx context.Context, metadata *M.Metadata) (c net.Conn, err error)

func (*Socks5) DialUDP

func (ss *Socks5) DialUDP(*M.Metadata) (_ net.PacketConn, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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