outbound

package
v0.0.0-...-7c62277 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: GPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUDPRemoteAddrMismatch = errors.New("udp packet dropped due to mismatched remote address")

Functions

func NewConn

func NewConn(c net.Conn, a C.ProxyAdapter) C.Conn

Types

type Base

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

func NewBase

func NewBase(opt BaseOption) *Base

func (*Base) Addr

func (b *Base) Addr() string

Addr implements C.ProxyAdapter

func (*Base) DialOptions

func (b *Base) DialOptions(opts ...dialer.Option) []dialer.Option

DialOptions return []dialer.Option from struct

func (*Base) ListenPacketContext

func (b *Base) ListenPacketContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (C.PacketConn, error)

ListenPacketContext implements C.ProxyAdapter

func (*Base) MarshalJSON

func (b *Base) MarshalJSON() ([]byte, error)

MarshalJSON implements C.ProxyAdapter

func (*Base) Name

func (b *Base) Name() string

Name implements C.ProxyAdapter

func (*Base) StreamConn

func (b *Base) StreamConn(c net.Conn, metadata *C.Metadata) (net.Conn, error)

StreamConn implements C.ProxyAdapter

func (*Base) SupportUDP

func (b *Base) SupportUDP() bool

SupportUDP implements C.ProxyAdapter

func (*Base) Type

func (b *Base) Type() C.AdapterType

Type implements C.ProxyAdapter

func (*Base) Unwrap

func (b *Base) Unwrap(metadata *C.Metadata) C.Proxy

Unwrap implements C.ProxyAdapter

type BaseOption

type BaseOption struct {
	Name        string
	Addr        string
	Type        C.AdapterType
	UDP         bool
	Interface   string
	RoutingMark int
}

type BasicOption

type BasicOption struct {
	Interface   string `proxy:"interface-name,omitempty" group:"interface-name,omitempty"`
	RoutingMark int    `proxy:"routing-mark,omitempty" group:"routing-mark,omitempty"`
}

type Direct

type Direct struct {
	*Base
}

func NewDirect

func NewDirect() *Direct

func (*Direct) DialContext

func (d *Direct) DialContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (C.Conn, error)

DialContext implements C.ProxyAdapter

func (*Direct) ListenPacketContext

func (d *Direct) ListenPacketContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (C.PacketConn, error)

ListenPacketContext implements C.ProxyAdapter

type GrpcOptions

type GrpcOptions struct {
	GrpcServiceName string `proxy:"grpc-service-name,omitempty"`
}

type HTTP2Options

type HTTP2Options struct {
	Host []string `proxy:"host,omitempty"`
	Path string   `proxy:"path,omitempty"`
}

type HTTPOptions

type HTTPOptions struct {
	Method  string              `proxy:"method,omitempty"`
	Path    []string            `proxy:"path,omitempty"`
	Headers map[string][]string `proxy:"headers,omitempty"`
}

type Http

type Http struct {
	*Base

	Headers http.Header
	// contains filtered or unexported fields
}

func NewHttp

func NewHttp(option HttpOption) *Http

func (*Http) DialContext

func (h *Http) DialContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (_ C.Conn, err error)

DialContext implements C.ProxyAdapter

func (*Http) StreamConn

func (h *Http) StreamConn(c net.Conn, metadata *C.Metadata) (net.Conn, error)

StreamConn implements C.ProxyAdapter

type HttpOption

type HttpOption struct {
	BasicOption
	Name           string            `proxy:"name"`
	Server         string            `proxy:"server"`
	Port           int               `proxy:"port"`
	UserName       string            `proxy:"username,omitempty"`
	Password       string            `proxy:"password,omitempty"`
	TLS            bool              `proxy:"tls,omitempty"`
	SNI            string            `proxy:"sni,omitempty"`
	SkipCertVerify bool              `proxy:"skip-cert-verify,omitempty"`
	Headers        map[string]string `proxy:"headers,omitempty"`
}

type Reject

type Reject struct {
	*Base
}

func NewReject

func NewReject() *Reject

func (*Reject) DialContext

func (r *Reject) DialContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (C.Conn, error)

DialContext implements C.ProxyAdapter

func (*Reject) ListenPacketContext

func (r *Reject) ListenPacketContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (C.PacketConn, error)

ListenPacketContext implements C.ProxyAdapter

type ShadowSocks

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

func NewShadowSocks

func NewShadowSocks(option ShadowSocksOption) (*ShadowSocks, error)

func (*ShadowSocks) DialContext

func (ss *ShadowSocks) DialContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (_ C.Conn, err error)

DialContext implements C.ProxyAdapter

func (*ShadowSocks) ListenPacketContext

func (ss *ShadowSocks) ListenPacketContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (C.PacketConn, error)

ListenPacketContext implements C.ProxyAdapter

func (*ShadowSocks) StreamConn

func (ss *ShadowSocks) StreamConn(c net.Conn, metadata *C.Metadata) (net.Conn, error)

StreamConn implements C.ProxyAdapter

type ShadowSocksOption

type ShadowSocksOption struct {
	BasicOption
	Name       string         `proxy:"name"`
	Server     string         `proxy:"server"`
	Port       int            `proxy:"port"`
	Password   string         `proxy:"password"`
	Cipher     string         `proxy:"cipher"`
	UDP        bool           `proxy:"udp,omitempty"`
	Plugin     string         `proxy:"plugin,omitempty"`
	PluginOpts map[string]any `proxy:"plugin-opts,omitempty"`
}

type ShadowSocksR

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

func NewShadowSocksR

func NewShadowSocksR(option ShadowSocksROption) (*ShadowSocksR, error)

func (*ShadowSocksR) DialContext

func (ssr *ShadowSocksR) DialContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (_ C.Conn, err error)

DialContext implements C.ProxyAdapter

func (*ShadowSocksR) ListenPacketContext

func (ssr *ShadowSocksR) ListenPacketContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (C.PacketConn, error)

ListenPacketContext implements C.ProxyAdapter

func (*ShadowSocksR) StreamConn

func (ssr *ShadowSocksR) StreamConn(c net.Conn, metadata *C.Metadata) (net.Conn, error)

StreamConn implements C.ProxyAdapter

type ShadowSocksROption

type ShadowSocksROption struct {
	BasicOption
	Name          string `proxy:"name"`
	Server        string `proxy:"server"`
	Port          int    `proxy:"port"`
	Password      string `proxy:"password"`
	Cipher        string `proxy:"cipher"`
	Obfs          string `proxy:"obfs"`
	ObfsParam     string `proxy:"obfs-param,omitempty"`
	Protocol      string `proxy:"protocol"`
	ProtocolParam string `proxy:"protocol-param,omitempty"`
	UDP           bool   `proxy:"udp,omitempty"`
}

type Snell

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

func NewSnell

func NewSnell(option SnellOption) (*Snell, error)

func (*Snell) DialContext

func (s *Snell) DialContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (_ C.Conn, err error)

DialContext implements C.ProxyAdapter

func (*Snell) ListenPacketContext

func (s *Snell) ListenPacketContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (C.PacketConn, error)

ListenPacketContext implements C.ProxyAdapter

func (*Snell) StreamConn

func (s *Snell) StreamConn(c net.Conn, metadata *C.Metadata) (net.Conn, error)

StreamConn implements C.ProxyAdapter

type SnellOption

type SnellOption struct {
	BasicOption
	Name     string         `proxy:"name"`
	Server   string         `proxy:"server"`
	Port     int            `proxy:"port"`
	Psk      string         `proxy:"psk"`
	UDP      bool           `proxy:"udp,omitempty"`
	Version  int            `proxy:"version,omitempty"`
	ObfsOpts map[string]any `proxy:"obfs-opts,omitempty"`
}

type Socks5

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

func NewSocks5

func NewSocks5(option Socks5Option) *Socks5

func (*Socks5) DialContext

func (ss *Socks5) DialContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (_ C.Conn, err error)

DialContext implements C.ProxyAdapter

func (*Socks5) ListenPacketContext

func (ss *Socks5) ListenPacketContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (_ C.PacketConn, err error)

ListenPacketContext implements C.ProxyAdapter

func (*Socks5) StreamConn

func (ss *Socks5) StreamConn(c net.Conn, metadata *C.Metadata) (net.Conn, error)

StreamConn implements C.ProxyAdapter

type Socks5Option

type Socks5Option struct {
	BasicOption
	Name           string `proxy:"name"`
	Server         string `proxy:"server"`
	Port           int    `proxy:"port"`
	UserName       string `proxy:"username,omitempty"`
	Password       string `proxy:"password,omitempty"`
	TLS            bool   `proxy:"tls,omitempty"`
	UDP            bool   `proxy:"udp,omitempty"`
	SkipCertVerify bool   `proxy:"skip-cert-verify,omitempty"`
}

type Trojan

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

func NewTrojan

func NewTrojan(option TrojanOption) (*Trojan, error)

func (*Trojan) DialContext

func (t *Trojan) DialContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (_ C.Conn, err error)

DialContext implements C.ProxyAdapter

func (*Trojan) ListenPacketContext

func (t *Trojan) ListenPacketContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (_ C.PacketConn, err error)

ListenPacketContext implements C.ProxyAdapter

func (*Trojan) StreamConn

func (t *Trojan) StreamConn(c net.Conn, metadata *C.Metadata) (net.Conn, error)

StreamConn implements C.ProxyAdapter

type TrojanOption

type TrojanOption struct {
	BasicOption
	Name           string      `proxy:"name"`
	Server         string      `proxy:"server"`
	Port           int         `proxy:"port"`
	Password       string      `proxy:"password"`
	ALPN           []string    `proxy:"alpn,omitempty"`
	SNI            string      `proxy:"sni,omitempty"`
	SkipCertVerify bool        `proxy:"skip-cert-verify,omitempty"`
	UDP            bool        `proxy:"udp,omitempty"`
	Network        string      `proxy:"network,omitempty"`
	GrpcOpts       GrpcOptions `proxy:"grpc-opts,omitempty"`
	WSOpts         WSOptions   `proxy:"ws-opts,omitempty"`
}

type Vmess

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

func NewVmess

func NewVmess(option VmessOption) (*Vmess, error)

func (*Vmess) DialContext

func (v *Vmess) DialContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (_ C.Conn, err error)

DialContext implements C.ProxyAdapter

func (*Vmess) ListenPacketContext

func (v *Vmess) ListenPacketContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (_ C.PacketConn, err error)

ListenPacketContext implements C.ProxyAdapter

func (*Vmess) StreamConn

func (v *Vmess) StreamConn(c net.Conn, metadata *C.Metadata) (net.Conn, error)

StreamConn implements C.ProxyAdapter

type VmessOption

type VmessOption struct {
	BasicOption
	Name           string       `proxy:"name"`
	Server         string       `proxy:"server"`
	Port           int          `proxy:"port"`
	UUID           string       `proxy:"uuid"`
	AlterID        int          `proxy:"alterId"`
	Cipher         string       `proxy:"cipher"`
	UDP            bool         `proxy:"udp,omitempty"`
	Network        string       `proxy:"network,omitempty"`
	TLS            bool         `proxy:"tls,omitempty"`
	SkipCertVerify bool         `proxy:"skip-cert-verify,omitempty"`
	ServerName     string       `proxy:"servername,omitempty"`
	HTTPOpts       HTTPOptions  `proxy:"http-opts,omitempty"`
	HTTP2Opts      HTTP2Options `proxy:"h2-opts,omitempty"`
	GrpcOpts       GrpcOptions  `proxy:"grpc-opts,omitempty"`
	WSOpts         WSOptions    `proxy:"ws-opts,omitempty"`
}

type WSOptions

type WSOptions struct {
	Path                string            `proxy:"path,omitempty"`
	Headers             map[string]string `proxy:"headers,omitempty"`
	MaxEarlyData        int               `proxy:"max-early-data,omitempty"`
	EarlyDataHeaderName string            `proxy:"early-data-header-name,omitempty"`
}

Jump to

Keyboard shortcuts

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