outbound

package
v0.19.1-0...-8efe5d4 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2020 License: GPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConn

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

func ParseProxy

func ParseProxy(mapping map[string]interface{}) (C.Proxy, error)

Types

type Base

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

func NewBase

func NewBase(name string, addr string, tp C.AdapterType, udp bool) *Base

func (*Base) Addr

func (b *Base) Addr() string

func (*Base) DialUDP

func (b *Base) DialUDP(metadata *C.Metadata) (C.PacketConn, error)

func (*Base) MarshalJSON

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

func (*Base) Name

func (b *Base) Name() string

func (*Base) StreamConn

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

func (*Base) SupportUDP

func (b *Base) SupportUDP() bool

func (*Base) Type

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

type Direct

type Direct struct {
	*Base
}

func NewDirect

func NewDirect() *Direct

func (*Direct) DialContext

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

func (*Direct) DialUDP

func (d *Direct) DialUDP(metadata *C.Metadata) (C.PacketConn, error)

type Http

type Http struct {
	*Base
	// 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) (C.Conn, error)

func (*Http) StreamConn

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

type HttpOption

type HttpOption struct {
	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"`
	SkipCertVerify bool   `proxy:"skip-cert-verify,omitempty"`
}

type NopConn

type NopConn struct{}

func (*NopConn) Close

func (rw *NopConn) Close() error

Close is fake function for net.Conn

func (*NopConn) LocalAddr

func (rw *NopConn) LocalAddr() net.Addr

LocalAddr is fake function for net.Conn

func (*NopConn) Read

func (rw *NopConn) Read(b []byte) (int, error)

func (*NopConn) RemoteAddr

func (rw *NopConn) RemoteAddr() net.Addr

RemoteAddr is fake function for net.Conn

func (*NopConn) SetDeadline

func (rw *NopConn) SetDeadline(time.Time) error

SetDeadline is fake function for net.Conn

func (*NopConn) SetReadDeadline

func (rw *NopConn) SetReadDeadline(time.Time) error

SetReadDeadline is fake function for net.Conn

func (*NopConn) SetWriteDeadline

func (rw *NopConn) SetWriteDeadline(time.Time) error

SetWriteDeadline is fake function for net.Conn

func (*NopConn) Write

func (rw *NopConn) Write(b []byte) (int, error)

type PacketConn

type PacketConn interface {
	net.PacketConn
	WriteWithMetadata(p []byte, metadata *C.Metadata) (n int, err error)
}

type Proxy

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

func NewProxy

func NewProxy(adapter C.ProxyAdapter) *Proxy

func (*Proxy) Alive

func (p *Proxy) Alive() bool

func (*Proxy) DelayHistory

func (p *Proxy) DelayHistory() []C.DelayHistory

func (*Proxy) Dial

func (p *Proxy) Dial(metadata *C.Metadata) (C.Conn, error)

func (*Proxy) DialContext

func (p *Proxy) DialContext(ctx context.Context, metadata *C.Metadata) (C.Conn, error)

func (*Proxy) LastDelay

func (p *Proxy) LastDelay() (delay uint16)

LastDelay return last history record. if proxy is not alive, return the max value of uint16.

func (*Proxy) MarshalJSON

func (p *Proxy) MarshalJSON() ([]byte, error)

func (*Proxy) URLTest

func (p *Proxy) URLTest(ctx context.Context, url string) (t uint16, err error)

URLTest get the delay for the specified URL

type Reject

type Reject struct {
	*Base
}

func NewReject

func NewReject() *Reject

func (*Reject) DialContext

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

func (*Reject) DialUDP

func (r *Reject) DialUDP(metadata *C.Metadata) (C.PacketConn, error)

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) (C.Conn, error)

func (*ShadowSocks) DialUDP

func (ss *ShadowSocks) DialUDP(metadata *C.Metadata) (C.PacketConn, error)

func (*ShadowSocks) MarshalJSON

func (ss *ShadowSocks) MarshalJSON() ([]byte, error)

func (*ShadowSocks) StreamConn

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

type ShadowSocksOption

type ShadowSocksOption struct {
	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]interface{} `proxy:"plugin-opts,omitempty"`

	// deprecated when bump to 1.0
	Obfs     string `proxy:"obfs,omitempty"`
	ObfsHost string `proxy:"obfs-host,omitempty"`
}

type ShadowsocksR

type ShadowsocksR struct {
	*Base

	ObfsData     interface{}
	ProtocolData interface{}
	// contains filtered or unexported fields
}

func NewShadowsocksR

func NewShadowsocksR(ssrop ShadowsocksROption) (*ShadowsocksR, error)

func (*ShadowsocksR) DialContext

func (ssrins *ShadowsocksR) DialContext(ctx context.Context, metadata *C.Metadata) (C.Conn, error)

func (*ShadowsocksR) DialUDP

func (ssr *ShadowsocksR) DialUDP(metadata *C.Metadata) (pac C.PacketConn, err error)

func (*ShadowsocksR) MarshalJSON

func (ssr *ShadowsocksR) MarshalJSON() ([]byte, error)

type ShadowsocksROption

type ShadowsocksROption struct {
	Name          string `proxy:"name"`
	Server        string `proxy:"server"`
	Port          int    `proxy:"port"`
	Password      string `proxy:"password"`
	Cipher        string `proxy:"cipher"`
	Protocol      string `proxy:"protocol"`
	ProtocolParam string `proxy:"protocolparam"`
	Obfs          string `proxy:"obfs"`
	ObfsParam     string `proxy:"obfsparam"`
}

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) (C.Conn, error)

func (*Snell) StreamConn

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

type SnellOption

type SnellOption struct {
	Name     string                 `proxy:"name"`
	Server   string                 `proxy:"server"`
	Port     int                    `proxy:"port"`
	Psk      string                 `proxy:"psk"`
	ObfsOpts map[string]interface{} `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) (C.Conn, error)

func (*Socks5) DialUDP

func (ss *Socks5) DialUDP(metadata *C.Metadata) (_ C.PacketConn, err error)

func (*Socks5) StreamConn

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

type Socks5Option

type Socks5Option struct {
	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) (C.Conn, error)

func (*Trojan) DialUDP

func (t *Trojan) DialUDP(metadata *C.Metadata) (C.PacketConn, error)

func (*Trojan) MarshalJSON

func (t *Trojan) MarshalJSON() ([]byte, error)

func (*Trojan) StreamConn

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

type TrojanOption

type TrojanOption struct {
	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"`
}

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) (C.Conn, error)

func (*Vmess) DialUDP

func (v *Vmess) DialUDP(metadata *C.Metadata) (C.PacketConn, error)

func (*Vmess) StreamConn

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

type VmessOption

type VmessOption struct {
	Name           string            `proxy:"name"`
	Server         string            `proxy:"server"`
	Port           int               `proxy:"port"`
	UUID           string            `proxy:"uuid"`
	AlterID        int               `proxy:"alterId"`
	Cipher         string            `proxy:"cipher"`
	TLS            bool              `proxy:"tls,omitempty"`
	UDP            bool              `proxy:"udp,omitempty"`
	Network        string            `proxy:"network,omitempty"`
	WSPath         string            `proxy:"ws-path,omitempty"`
	WSHeaders      map[string]string `proxy:"ws-headers,omitempty"`
	SkipCertVerify bool              `proxy:"skip-cert-verify,omitempty"`
}

Jump to

Keyboard shortcuts

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