plugin

package
v0.35.4 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const PluginHTTP2HTTPS = "http2https"
View Source
const PluginHTTPProxy = "http_proxy"
View Source
const PluginHTTPS2HTTP = "https2http"
View Source
const PluginSocks5 = "socks5"
View Source
const PluginStaticFile = "static_file"
View Source
const PluginUnixDomainSocket = "unix_domain_socket"

Variables

This section is empty.

Functions

func Register

func Register(name string, fn CreatorFn)

Types

type CreatorFn

type CreatorFn func(params map[string]string) (Plugin, error)

params has prefix "plugin_"

type HTTP2HTTPSPlugin

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

func (*HTTP2HTTPSPlugin) Close

func (p *HTTP2HTTPSPlugin) Close() error

func (*HTTP2HTTPSPlugin) Handle

func (p *HTTP2HTTPSPlugin) Handle(conn io.ReadWriteCloser, realConn net.Conn, extraBufToLocal []byte)

func (*HTTP2HTTPSPlugin) Name

func (p *HTTP2HTTPSPlugin) Name() string

type HTTPProxy

type HTTPProxy struct {
	AuthUser   string
	AuthPasswd string
	// contains filtered or unexported fields
}

func (*HTTPProxy) Auth

func (hp *HTTPProxy) Auth(req *http.Request) bool

func (*HTTPProxy) Close

func (hp *HTTPProxy) Close() error

func (*HTTPProxy) ConnectHandler

func (hp *HTTPProxy) ConnectHandler(rw http.ResponseWriter, req *http.Request)

deprecated Hijack needs to SetReadDeadline on the Conn of the request, but if we use stream compression here, we may always get i/o timeout error.

func (*HTTPProxy) HTTPHandler

func (hp *HTTPProxy) HTTPHandler(rw http.ResponseWriter, req *http.Request)

func (*HTTPProxy) Handle

func (hp *HTTPProxy) Handle(conn io.ReadWriteCloser, realConn net.Conn, extraBufToLocal []byte)

func (*HTTPProxy) Name

func (hp *HTTPProxy) Name() string

func (*HTTPProxy) ServeHTTP

func (hp *HTTPProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type HTTPS2HTTPPlugin

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

func (*HTTPS2HTTPPlugin) Close

func (p *HTTPS2HTTPPlugin) Close() error

func (*HTTPS2HTTPPlugin) Handle

func (p *HTTPS2HTTPPlugin) Handle(conn io.ReadWriteCloser, realConn net.Conn, extraBufToLocal []byte)

func (*HTTPS2HTTPPlugin) Name

func (p *HTTPS2HTTPPlugin) Name() string

type Listener

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

func NewProxyListener

func NewProxyListener() *Listener

func (*Listener) Accept

func (l *Listener) Accept() (net.Conn, error)

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

func (*Listener) Close

func (l *Listener) Close() error

func (*Listener) PutConn

func (l *Listener) PutConn(conn net.Conn) error

type Plugin

type Plugin interface {
	Name() string

	// extraBufToLocal will send to local connection first, then join conn with local connection
	Handle(conn io.ReadWriteCloser, realConn net.Conn, extraBufToLocal []byte)
	Close() error
}

func Create

func Create(name string, params map[string]string) (p Plugin, err error)

func NewHTTP2HTTPSPlugin

func NewHTTP2HTTPSPlugin(params map[string]string) (Plugin, error)

func NewHTTPProxyPlugin

func NewHTTPProxyPlugin(params map[string]string) (Plugin, error)

func NewHTTPS2HTTPPlugin

func NewHTTPS2HTTPPlugin(params map[string]string) (Plugin, error)

func NewSocks5Plugin

func NewSocks5Plugin(params map[string]string) (p Plugin, err error)

func NewStaticFilePlugin

func NewStaticFilePlugin(params map[string]string) (Plugin, error)

func NewUnixDomainSocketPlugin

func NewUnixDomainSocketPlugin(params map[string]string) (p Plugin, err error)

type Socks5Plugin

type Socks5Plugin struct {
	Server *gosocks5.Server
	// contains filtered or unexported fields
}

func (*Socks5Plugin) Close

func (sp *Socks5Plugin) Close() error

func (*Socks5Plugin) Handle

func (sp *Socks5Plugin) Handle(conn io.ReadWriteCloser, realConn net.Conn, extraBufToLocal []byte)

func (*Socks5Plugin) Name

func (sp *Socks5Plugin) Name() string

type StaticFilePlugin

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

func (*StaticFilePlugin) Close

func (sp *StaticFilePlugin) Close() error

func (*StaticFilePlugin) Handle

func (sp *StaticFilePlugin) Handle(conn io.ReadWriteCloser, realConn net.Conn, extraBufToLocal []byte)

func (*StaticFilePlugin) Name

func (sp *StaticFilePlugin) Name() string

type UnixDomainSocketPlugin

type UnixDomainSocketPlugin struct {
	UnixAddr *net.UnixAddr
}

func (*UnixDomainSocketPlugin) Close

func (uds *UnixDomainSocketPlugin) Close() error

func (*UnixDomainSocketPlugin) Handle

func (uds *UnixDomainSocketPlugin) Handle(conn io.ReadWriteCloser, realConn net.Conn, extraBufToLocal []byte)

func (*UnixDomainSocketPlugin) Name

func (uds *UnixDomainSocketPlugin) Name() string

Jump to

Keyboard shortcuts

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