plugin

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const PluginHttpProxy = "http_proxy"
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 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) Handle

func (hp *HttpProxy) Handle(conn io.ReadWriteCloser)

func (*HttpProxy) HttpHandler

func (hp *HttpProxy) HttpHandler(rw http.ResponseWriter, req *http.Request)

func (*HttpProxy) Name

func (hp *HttpProxy) Name() string

func (*HttpProxy) ServeHTTP

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

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
	Handle(conn io.ReadWriteCloser)
	Close() error
}

func Create

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

func NewHttpProxyPlugin

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

func NewUnixDomainSocketPlugin

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

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)

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