outbound

package
v1.16.4 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: GPL-3.0 Imports: 76 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultStreamReceiveWindow     = 15728640 // 15 MB/s
	DefaultConnectionReceiveWindow = 67108864 // 64 MB/s

	DefaultALPN        = "hysteria"
	DefaultProtocol    = "udp"
	DefaultHopInterval = 10
)

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

func NewSingMux

func NewSingMux(option SingMuxOption, proxy C.ProxyAdapter, base ProxyBase) (C.ProxyAdapter, error)

func StringToBps

func StringToBps(s string) uint64

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) DialContext

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

func (*Base) DialContextWithDialer

func (b *Base) DialContextWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (_ C.Conn, err error)

DialContextWithDialer implements C.ProxyAdapter

func (*Base) DialOptions

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

DialOptions return []dialer.Option from struct

func (*Base) Id

func (b *Base) Id() string

Id implements C.ProxyAdapter

func (*Base) IsL3Protocol

func (b *Base) IsL3Protocol(metadata *C.Metadata) bool

IsL3Protocol implements C.ProxyAdapter

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) ListenPacketWithDialer

func (b *Base) ListenPacketWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (_ C.PacketConn, err error)

ListenPacketWithDialer 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) StreamConnContext

func (b *Base) StreamConnContext(ctx context.Context, c net.Conn, metadata *C.Metadata) (net.Conn, error)

StreamConnContext implements C.ProxyAdapter

func (*Base) SupportTFO

func (b *Base) SupportTFO() bool

SupportTFO implements C.ProxyAdapter

func (*Base) SupportUDP

func (b *Base) SupportUDP() bool

SupportUDP implements C.ProxyAdapter

func (*Base) SupportUOT

func (b *Base) SupportUOT() bool

SupportUOT implements C.ProxyAdapter

func (*Base) SupportWithDialer

func (b *Base) SupportWithDialer() C.NetWork

SupportWithDialer implements C.ProxyAdapter

func (*Base) SupportXUDP

func (b *Base) SupportXUDP() bool

SupportXUDP 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, touch bool) C.Proxy

Unwrap implements C.ProxyAdapter

type BaseOption

type BaseOption struct {
	Name        string
	Addr        string
	Type        C.AdapterType
	UDP         bool
	XUDP        bool
	TFO         bool
	MPTCP       bool
	Interface   string
	RoutingMark int
	Prefer      C.DNSPrefer
}

type BasicOption

type BasicOption struct {
	TFO         bool   `proxy:"tfo,omitempty" group:"tfo,omitempty"`
	MPTCP       bool   `proxy:"mptcp,omitempty" group:"mptcp,omitempty"`
	Interface   string `proxy:"interface-name,omitempty" group:"interface-name,omitempty"`
	RoutingMark int    `proxy:"routing-mark,omitempty" group:"routing-mark,omitempty"`
	IPVersion   string `proxy:"ip-version,omitempty" group:"ip-version,omitempty"`
	DialerProxy string `proxy:"dialer-proxy,omitempty"` // don't apply this option into groups, but can set a group name in a proxy
}

type Direct

type Direct struct {
	*Base
}

func NewCompatible

func NewCompatible() *Direct

func NewDirect

func NewDirect() *Direct

func NewDirectWithOption

func NewDirectWithOption(option DirectOption) *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 DirectOption

type DirectOption struct {
	BasicOption
	Name string `proxy:"name"`
}

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
	// contains filtered or unexported fields
}

func NewHttp

func NewHttp(option HttpOption) (*Http, error)

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) DialContextWithDialer

func (h *Http) DialContextWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (_ C.Conn, err error)

DialContextWithDialer implements C.ProxyAdapter

func (*Http) StreamConnContext

func (h *Http) StreamConnContext(ctx context.Context, c net.Conn, metadata *C.Metadata) (net.Conn, error)

StreamConnContext implements C.ProxyAdapter

func (*Http) SupportWithDialer

func (h *Http) SupportWithDialer() C.NetWork

SupportWithDialer 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"`
	Fingerprint    string            `proxy:"fingerprint,omitempty"`
	Headers        map[string]string `proxy:"headers,omitempty"`
}

type Hysteria

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

func NewHysteria

func NewHysteria(option HysteriaOption) (*Hysteria, error)

func (*Hysteria) DialContext

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

func (*Hysteria) ListenPacketContext

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

type Hysteria2

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

func NewHysteria2

func NewHysteria2(option Hysteria2Option) (*Hysteria2, error)

func (*Hysteria2) DialContext

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

func (*Hysteria2) ListenPacketContext

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

type Hysteria2Option

type Hysteria2Option struct {
	BasicOption
	Name           string   `proxy:"name"`
	Server         string   `proxy:"server"`
	Port           int      `proxy:"port"`
	Up             string   `proxy:"up,omitempty"`
	Down           string   `proxy:"down,omitempty"`
	Password       string   `proxy:"password,omitempty"`
	Obfs           string   `proxy:"obfs,omitempty"`
	ObfsPassword   string   `proxy:"obfs-password,omitempty"`
	SNI            string   `proxy:"sni,omitempty"`
	SkipCertVerify bool     `proxy:"skip-cert-verify,omitempty"`
	Fingerprint    string   `proxy:"fingerprint,omitempty"`
	ALPN           []string `proxy:"alpn,omitempty"`
	CustomCA       string   `proxy:"ca,omitempty"`
	CustomCAString string   `proxy:"ca-str,omitempty"`
	CWND           int      `proxy:"cwnd,omitempty"`
}

type HysteriaOption

type HysteriaOption struct {
	BasicOption
	Name                string   `proxy:"name"`
	Server              string   `proxy:"server"`
	Port                int      `proxy:"port,omitempty"`
	Ports               string   `proxy:"ports,omitempty"`
	Protocol            string   `proxy:"protocol,omitempty"`
	ObfsProtocol        string   `proxy:"obfs-protocol,omitempty"` // compatible with Stash
	Up                  string   `proxy:"up"`
	UpSpeed             int      `proxy:"up-speed,omitempty"` // compatible with Stash
	Down                string   `proxy:"down"`
	DownSpeed           int      `proxy:"down-speed,omitempty"` // compatible with Stash
	Auth                string   `proxy:"auth,omitempty"`
	AuthString          string   `proxy:"auth-str,omitempty"`
	Obfs                string   `proxy:"obfs,omitempty"`
	SNI                 string   `proxy:"sni,omitempty"`
	SkipCertVerify      bool     `proxy:"skip-cert-verify,omitempty"`
	Fingerprint         string   `proxy:"fingerprint,omitempty"`
	ALPN                []string `proxy:"alpn,omitempty"`
	CustomCA            string   `proxy:"ca,omitempty"`
	CustomCAString      string   `proxy:"ca-str,omitempty"`
	ReceiveWindowConn   int      `proxy:"recv-window-conn,omitempty"`
	ReceiveWindow       int      `proxy:"recv-window,omitempty"`
	DisableMTUDiscovery bool     `proxy:"disable-mtu-discovery,omitempty"`
	FastOpen            bool     `proxy:"fast-open,omitempty"`
	HopInterval         int      `proxy:"hop-interval,omitempty"`
}

func (*HysteriaOption) Speed

func (c *HysteriaOption) Speed() (uint64, uint64, error)

type ProxyBase

type ProxyBase interface {
	DialOptions(opts ...dialer.Option) []dialer.Option
}

type RealityOptions

type RealityOptions struct {
	PublicKey string `proxy:"public-key"`
	ShortID   string `proxy:"short-id"`
}

func (RealityOptions) Parse

func (o RealityOptions) Parse() (*tlsC.RealityConfig, error)

type Reject

type Reject struct {
	*Base
}

func NewPass

func NewPass() *Reject

func NewReject

func NewReject() *Reject

func NewRejectWithOption

func NewRejectWithOption(option RejectOption) *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 RejectOption

type RejectOption struct {
	Name string `proxy:"name"`
}

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) DialContextWithDialer

func (ss *ShadowSocks) DialContextWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (_ C.Conn, err error)

DialContextWithDialer 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) ListenPacketOnStreamConn

func (ss *ShadowSocks) ListenPacketOnStreamConn(ctx context.Context, c net.Conn, metadata *C.Metadata) (_ C.PacketConn, err error)

ListenPacketOnStreamConn implements C.ProxyAdapter

func (*ShadowSocks) ListenPacketWithDialer

func (ss *ShadowSocks) ListenPacketWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (_ C.PacketConn, err error)

ListenPacketWithDialer implements C.ProxyAdapter

func (*ShadowSocks) StreamConnContext

func (ss *ShadowSocks) StreamConnContext(ctx context.Context, c net.Conn, metadata *C.Metadata) (net.Conn, error)

StreamConnContext implements C.ProxyAdapter

func (*ShadowSocks) SupportUOT

func (ss *ShadowSocks) SupportUOT() bool

SupportUOT implements C.ProxyAdapter

func (*ShadowSocks) SupportWithDialer

func (ss *ShadowSocks) SupportWithDialer() C.NetWork

SupportWithDialer 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"`
	UDPOverTCP        bool           `proxy:"udp-over-tcp,omitempty"`
	UDPOverTCPVersion int            `proxy:"udp-over-tcp-version,omitempty"`
	ClientFingerprint string         `proxy:"client-fingerprint,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) DialContextWithDialer

func (ssr *ShadowSocksR) DialContextWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (_ C.Conn, err error)

DialContextWithDialer 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) ListenPacketWithDialer

func (ssr *ShadowSocksR) ListenPacketWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (_ C.PacketConn, err error)

ListenPacketWithDialer implements C.ProxyAdapter

func (*ShadowSocksR) StreamConnContext

func (ssr *ShadowSocksR) StreamConnContext(ctx context.Context, c net.Conn, metadata *C.Metadata) (net.Conn, error)

StreamConnContext implements C.ProxyAdapter

func (*ShadowSocksR) SupportWithDialer

func (ssr *ShadowSocksR) SupportWithDialer() C.NetWork

SupportWithDialer 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 SingMux

type SingMux struct {
	C.ProxyAdapter
	// contains filtered or unexported fields
}

func (*SingMux) DialContext

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

func (*SingMux) ListenPacketContext

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

func (*SingMux) SupportUDP

func (s *SingMux) SupportUDP() bool

func (*SingMux) SupportUOT

func (s *SingMux) SupportUOT() bool

type SingMuxOption

type SingMuxOption struct {
	Enabled        bool   `proxy:"enabled,omitempty"`
	Protocol       string `proxy:"protocol,omitempty"`
	MaxConnections int    `proxy:"max-connections,omitempty"`
	MinStreams     int    `proxy:"min-streams,omitempty"`
	MaxStreams     int    `proxy:"max-streams,omitempty"`
	Padding        bool   `proxy:"padding,omitempty"`
	Statistic      bool   `proxy:"statistic,omitempty"`
	OnlyTcp        bool   `proxy:"only-tcp,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) DialContextWithDialer

func (s *Snell) DialContextWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (_ C.Conn, err error)

DialContextWithDialer 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) ListenPacketWithDialer

func (s *Snell) ListenPacketWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (C.PacketConn, error)

ListenPacketWithDialer implements C.ProxyAdapter

func (*Snell) StreamConnContext

func (s *Snell) StreamConnContext(ctx context.Context, c net.Conn, metadata *C.Metadata) (net.Conn, error)

StreamConnContext implements C.ProxyAdapter

func (*Snell) SupportUOT

func (s *Snell) SupportUOT() bool

SupportUOT implements C.ProxyAdapter

func (*Snell) SupportWithDialer

func (s *Snell) SupportWithDialer() C.NetWork

SupportWithDialer 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, error)

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) DialContextWithDialer

func (ss *Socks5) DialContextWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (_ C.Conn, err error)

DialContextWithDialer 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) StreamConnContext

func (ss *Socks5) StreamConnContext(ctx context.Context, c net.Conn, metadata *C.Metadata) (net.Conn, error)

StreamConnContext implements C.ProxyAdapter

func (*Socks5) SupportWithDialer

func (ss *Socks5) SupportWithDialer() C.NetWork

SupportWithDialer 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"`
	Fingerprint    string `proxy:"fingerprint,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) DialContextWithDialer

func (t *Trojan) DialContextWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (_ C.Conn, err error)

DialContextWithDialer 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) ListenPacketOnStreamConn

func (t *Trojan) ListenPacketOnStreamConn(c net.Conn, metadata *C.Metadata) (_ C.PacketConn, err error)

ListenPacketOnStreamConn implements C.ProxyAdapter

func (*Trojan) ListenPacketWithDialer

func (t *Trojan) ListenPacketWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (_ C.PacketConn, err error)

ListenPacketWithDialer implements C.ProxyAdapter

func (*Trojan) StreamConnContext

func (t *Trojan) StreamConnContext(ctx context.Context, c net.Conn, metadata *C.Metadata) (net.Conn, error)

StreamConnContext implements C.ProxyAdapter

func (*Trojan) SupportUOT

func (t *Trojan) SupportUOT() bool

SupportUOT implements C.ProxyAdapter

func (*Trojan) SupportWithDialer

func (t *Trojan) SupportWithDialer() C.NetWork

SupportWithDialer 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"`
	Fingerprint       string         `proxy:"fingerprint,omitempty"`
	UDP               bool           `proxy:"udp,omitempty"`
	Network           string         `proxy:"network,omitempty"`
	RealityOpts       RealityOptions `proxy:"reality-opts,omitempty"`
	GrpcOpts          GrpcOptions    `proxy:"grpc-opts,omitempty"`
	WSOpts            WSOptions      `proxy:"ws-opts,omitempty"`
	ClientFingerprint string         `proxy:"client-fingerprint,omitempty"`
}

type Tuic

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

func NewTuic

func NewTuic(option TuicOption) (*Tuic, error)

func (*Tuic) DialContext

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

DialContext implements C.ProxyAdapter

func (*Tuic) DialContextWithDialer

func (t *Tuic) DialContextWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (C.Conn, error)

DialContextWithDialer implements C.ProxyAdapter

func (*Tuic) ListenPacketContext

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

ListenPacketContext implements C.ProxyAdapter

func (*Tuic) ListenPacketWithDialer

func (t *Tuic) ListenPacketWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (_ C.PacketConn, err error)

ListenPacketWithDialer implements C.ProxyAdapter

func (*Tuic) SupportWithDialer

func (t *Tuic) SupportWithDialer() C.NetWork

SupportWithDialer implements C.ProxyAdapter

type TuicOption

type TuicOption struct {
	BasicOption
	Name                  string   `proxy:"name"`
	Server                string   `proxy:"server"`
	Port                  int      `proxy:"port"`
	Token                 string   `proxy:"token,omitempty"`
	UUID                  string   `proxy:"uuid,omitempty"`
	Password              string   `proxy:"password,omitempty"`
	Ip                    string   `proxy:"ip,omitempty"`
	HeartbeatInterval     int      `proxy:"heartbeat-interval,omitempty"`
	ALPN                  []string `proxy:"alpn,omitempty"`
	ReduceRtt             bool     `proxy:"reduce-rtt,omitempty"`
	RequestTimeout        int      `proxy:"request-timeout,omitempty"`
	UdpRelayMode          string   `proxy:"udp-relay-mode,omitempty"`
	CongestionController  string   `proxy:"congestion-controller,omitempty"`
	DisableSni            bool     `proxy:"disable-sni,omitempty"`
	MaxUdpRelayPacketSize int      `proxy:"max-udp-relay-packet-size,omitempty"`

	FastOpen             bool   `proxy:"fast-open,omitempty"`
	MaxOpenStreams       int    `proxy:"max-open-streams,omitempty"`
	CWND                 int    `proxy:"cwnd,omitempty"`
	SkipCertVerify       bool   `proxy:"skip-cert-verify,omitempty"`
	Fingerprint          string `proxy:"fingerprint,omitempty"`
	CustomCA             string `proxy:"ca,omitempty"`
	CustomCAString       string `proxy:"ca-str,omitempty"`
	ReceiveWindowConn    int    `proxy:"recv-window-conn,omitempty"`
	ReceiveWindow        int    `proxy:"recv-window,omitempty"`
	DisableMTUDiscovery  bool   `proxy:"disable-mtu-discovery,omitempty"`
	MaxDatagramFrameSize int    `proxy:"max-datagram-frame-size,omitempty"`
	SNI                  string `proxy:"sni,omitempty"`

	UDPOverStream        bool `proxy:"udp-over-stream,omitempty"`
	UDPOverStreamVersion int  `proxy:"udp-over-stream-version,omitempty"`
}

type Vless

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

func NewVless

func NewVless(option VlessOption) (*Vless, error)

func (*Vless) DialContext

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

DialContext implements C.ProxyAdapter

func (*Vless) DialContextWithDialer

func (v *Vless) DialContextWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (_ C.Conn, err error)

DialContextWithDialer implements C.ProxyAdapter

func (*Vless) ListenPacketContext

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

ListenPacketContext implements C.ProxyAdapter

func (*Vless) ListenPacketOnStreamConn

func (v *Vless) ListenPacketOnStreamConn(ctx context.Context, c net.Conn, metadata *C.Metadata) (_ C.PacketConn, err error)

ListenPacketOnStreamConn implements C.ProxyAdapter

func (*Vless) ListenPacketWithDialer

func (v *Vless) ListenPacketWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (_ C.PacketConn, err error)

ListenPacketWithDialer implements C.ProxyAdapter

func (*Vless) StreamConnContext

func (v *Vless) StreamConnContext(ctx context.Context, c net.Conn, metadata *C.Metadata) (net.Conn, error)

func (*Vless) SupportUOT

func (v *Vless) SupportUOT() bool

SupportUOT implements C.ProxyAdapter

func (*Vless) SupportWithDialer

func (v *Vless) SupportWithDialer() C.NetWork

SupportWithDialer implements C.ProxyAdapter

type VlessOption

type VlessOption struct {
	BasicOption
	Name              string            `proxy:"name"`
	Server            string            `proxy:"server"`
	Port              int               `proxy:"port"`
	UUID              string            `proxy:"uuid"`
	Flow              string            `proxy:"flow,omitempty"`
	TLS               bool              `proxy:"tls,omitempty"`
	ALPN              []string          `proxy:"alpn,omitempty"`
	UDP               bool              `proxy:"udp,omitempty"`
	PacketAddr        bool              `proxy:"packet-addr,omitempty"`
	XUDP              bool              `proxy:"xudp,omitempty"`
	PacketEncoding    string            `proxy:"packet-encoding,omitempty"`
	Network           string            `proxy:"network,omitempty"`
	RealityOpts       RealityOptions    `proxy:"reality-opts,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"`
	WSPath            string            `proxy:"ws-path,omitempty"`
	WSHeaders         map[string]string `proxy:"ws-headers,omitempty"`
	SkipCertVerify    bool              `proxy:"skip-cert-verify,omitempty"`
	Fingerprint       string            `proxy:"fingerprint,omitempty"`
	ServerName        string            `proxy:"servername,omitempty"`
	ClientFingerprint string            `proxy:"client-fingerprint,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) DialContextWithDialer

func (v *Vmess) DialContextWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (_ C.Conn, err error)

DialContextWithDialer 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) ListenPacketOnStreamConn

func (v *Vmess) ListenPacketOnStreamConn(ctx context.Context, c net.Conn, metadata *C.Metadata) (_ C.PacketConn, err error)

ListenPacketOnStreamConn implements C.ProxyAdapter

func (*Vmess) ListenPacketWithDialer

func (v *Vmess) ListenPacketWithDialer(ctx context.Context, dialer C.Dialer, metadata *C.Metadata) (_ C.PacketConn, err error)

ListenPacketWithDialer implements C.ProxyAdapter

func (*Vmess) StreamConnContext

func (v *Vmess) StreamConnContext(ctx context.Context, c net.Conn, metadata *C.Metadata) (net.Conn, error)

StreamConnContext implements C.ProxyAdapter

func (*Vmess) SupportUOT

func (v *Vmess) SupportUOT() bool

SupportUOT implements C.ProxyAdapter

func (*Vmess) SupportWithDialer

func (v *Vmess) SupportWithDialer() C.NetWork

SupportWithDialer 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"`
	ALPN                []string       `proxy:"alpn,omitempty"`
	SkipCertVerify      bool           `proxy:"skip-cert-verify,omitempty"`
	Fingerprint         string         `proxy:"fingerprint,omitempty"`
	ServerName          string         `proxy:"servername,omitempty"`
	RealityOpts         RealityOptions `proxy:"reality-opts,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"`
	PacketAddr          bool           `proxy:"packet-addr,omitempty"`
	XUDP                bool           `proxy:"xudp,omitempty"`
	PacketEncoding      string         `proxy:"packet-encoding,omitempty"`
	GlobalPadding       bool           `proxy:"global-padding,omitempty"`
	AuthenticatedLength bool           `proxy:"authenticated-length,omitempty"`
	ClientFingerprint   string         `proxy:"client-fingerprint,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"`
}

type WireGuard

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

func NewWireGuard

func NewWireGuard(option WireGuardOption) (*WireGuard, error)

func (*WireGuard) DialContext

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

func (*WireGuard) IsL3Protocol

func (w *WireGuard) IsL3Protocol(metadata *C.Metadata) bool

IsL3Protocol implements C.ProxyAdapter

func (*WireGuard) ListenPacketContext

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

type WireGuardOption

type WireGuardOption struct {
	BasicOption
	WireGuardPeerOption
	Name                string `proxy:"name"`
	PrivateKey          string `proxy:"private-key"`
	Workers             int    `proxy:"workers,omitempty"`
	MTU                 int    `proxy:"mtu,omitempty"`
	UDP                 bool   `proxy:"udp,omitempty"`
	PersistentKeepalive int    `proxy:"persistent-keepalive,omitempty"`

	Peers []WireGuardPeerOption `proxy:"peers,omitempty"`

	RemoteDnsResolve bool     `proxy:"remote-dns-resolve,omitempty"`
	Dns              []string `proxy:"dns,omitempty"`
}

type WireGuardPeerOption

type WireGuardPeerOption struct {
	Server       string   `proxy:"server"`
	Port         int      `proxy:"port"`
	Ip           string   `proxy:"ip,omitempty"`
	Ipv6         string   `proxy:"ipv6,omitempty"`
	PublicKey    string   `proxy:"public-key,omitempty"`
	PreSharedKey string   `proxy:"pre-shared-key,omitempty"`
	Reserved     []uint8  `proxy:"reserved,omitempty"`
	AllowedIPs   []string `proxy:"allowed-ips,omitempty"`
}

func (WireGuardPeerOption) Addr

func (option WireGuardPeerOption) Addr() M.Socksaddr

func (WireGuardPeerOption) Prefixes

func (option WireGuardPeerOption) Prefixes() ([]netip.Prefix, error)

Jump to

Keyboard shortcuts

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