adapters

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2019 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelayTest

func DelayTest(proxy C.Proxy, url string) (t int16, err error)

DelayTest get the delay for the specified URL

Types

type Base added in v0.11.0

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

func (*Base) MarshalJSON added in v0.11.0

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

func (*Base) Name added in v0.11.0

func (b *Base) Name() string

func (*Base) Type added in v0.11.0

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

type Direct

type Direct struct {
	*Base
}

func NewDirect

func NewDirect() *Direct

func (*Direct) Generator

func (d *Direct) Generator(metadata *C.Metadata) (net.Conn, error)

type Fallback

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

func NewFallback

func NewFallback(option FallbackOption, proxies []C.Proxy) (*Fallback, error)

func (*Fallback) Close

func (f *Fallback) Close()

func (*Fallback) Generator

func (f *Fallback) Generator(metadata *C.Metadata) (net.Conn, error)

func (*Fallback) MarshalJSON added in v0.10.0

func (f *Fallback) MarshalJSON() ([]byte, error)

func (*Fallback) Now

func (f *Fallback) Now() string

type FallbackOption

type FallbackOption struct {
	Name     string   `proxy:"name"`
	Proxies  []string `proxy:"proxies"`
	URL      string   `proxy:"url"`
	Interval int      `proxy:"interval"`
}

type Http added in v0.10.0

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

func NewHttp added in v0.10.0

func NewHttp(option HttpOption) *Http

func (*Http) Generator added in v0.10.0

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

type HttpOption added in v0.10.0

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 LoadBalance added in v0.12.0

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

func NewLoadBalance added in v0.12.0

func NewLoadBalance(name string, proxies []C.Proxy) (*LoadBalance, error)

func (*LoadBalance) Generator added in v0.12.0

func (lb *LoadBalance) Generator(metadata *C.Metadata) (net.Conn, error)

func (*LoadBalance) MarshalJSON added in v0.12.0

func (lb *LoadBalance) MarshalJSON() ([]byte, error)

type LoadBalanceOption added in v0.12.0

type LoadBalanceOption struct {
	Name    string   `proxy:"name"`
	Proxies []string `proxy:"proxies"`
}

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 Reject

type Reject struct {
	*Base
}

func NewReject

func NewReject() *Reject

func (*Reject) Generator

func (r *Reject) Generator(metadata *C.Metadata) (net.Conn, error)

type Selector

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

func NewSelector

func NewSelector(name string, proxies []C.Proxy) (*Selector, error)

func (*Selector) Generator

func (s *Selector) Generator(metadata *C.Metadata) (net.Conn, error)

func (*Selector) MarshalJSON added in v0.10.0

func (s *Selector) MarshalJSON() ([]byte, error)

func (*Selector) Now

func (s *Selector) Now() string

func (*Selector) Set

func (s *Selector) Set(name string) error

type SelectorOption

type SelectorOption struct {
	Name    string   `proxy:"name"`
	Proxies []string `proxy:"proxies"`
}

type ShadowSocks

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

func NewShadowSocks

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

func (*ShadowSocks) Generator

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

func (*ShadowSocks) MarshalJSON added in v0.10.0

func (ss *ShadowSocks) MarshalJSON() ([]byte, 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"`
	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 Socks5

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

func NewSocks5

func NewSocks5(option Socks5Option) *Socks5

func (*Socks5) Generator

func (ss *Socks5) Generator(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"`
	SkipCertVerify bool   `proxy:"skip-cert-verify,omitempty"`
}

type URLTest

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

func NewURLTest

func NewURLTest(option URLTestOption, proxies []C.Proxy) (*URLTest, error)

func (*URLTest) Close

func (u *URLTest) Close()

func (*URLTest) Generator

func (u *URLTest) Generator(metadata *C.Metadata) (net.Conn, error)

func (*URLTest) MarshalJSON added in v0.10.0

func (u *URLTest) MarshalJSON() ([]byte, error)

func (*URLTest) Now

func (u *URLTest) Now() string

type URLTestOption

type URLTestOption struct {
	Name     string   `proxy:"name"`
	Proxies  []string `proxy:"proxies"`
	URL      string   `proxy:"url"`
	Interval int      `proxy:"interval"`
}

type Vmess

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

func NewVmess

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

func (*Vmess) Generator

func (v *Vmess) Generator(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"`
	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