Documentation ¶
Index ¶
- func SetupOutgoing()
- type DefaultHttpProxyHandler
- type ProxyServer
- func (this *ProxyServer) GetOptions() *ProxyServerOptions
- func (this *ProxyServer) Listen(port int, hostname string) error
- func (this *ProxyServer) OnClose(listener func(...interface{}))
- func (this *ProxyServer) OnError(listener func(...interface{}))
- func (this *ProxyServer) OnProxyError(listener func(resp http.ResponseWriter, req *http.Request, err error))
- func (this *ProxyServer) OnProxyReq(...)
- func (this *ProxyServer) OnProxyReqWs(...)
- func (this *ProxyServer) OnProxyResp(listener func(proxyResp *http.Response))
- func (this *ProxyServer) RefreshOptions()
- func (this *ProxyServer) Web(response http.ResponseWriter, request *http.Request, args ...interface{})
- type ProxyServerOptions
- type ProxyType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetupOutgoing ¶
func SetupOutgoing()
Copies the right headers from `options` and `req` to `outgoing` which is then used to fire the proxied request.
Examples:
common.setupOutgoing(outgoing, options, req) // => { host: ..., hostname: ...}
@param {Object} Outgoing Base object to be filled with required properties
@param {Object} Options Config object passed to the proxy
@param {ClientRequest} Req Request Object
@param {String} Forward String to select forward or target
@return {Object} Outgoing Object with all required properties set
@api private
Types ¶
type DefaultHttpProxyHandler ¶
type DefaultHttpProxyHandler struct {
// contains filtered or unexported fields
}
func (*DefaultHttpProxyHandler) ServeHTTP ¶
func (this *DefaultHttpProxyHandler) ServeHTTP(response http.ResponseWriter, request *http.Request)
func (*DefaultHttpProxyHandler) SetWebHandler ¶
func (this *DefaultHttpProxyHandler) SetWebHandler(f func(resp http.ResponseWriter, request *http.Request))
type ProxyServer ¶
type ProxyServer struct { events.EventEmitter // contains filtered or unexported fields }
func NewProxyServer ¶
func NewProxyServer(options *ProxyServerOptions) *ProxyServer
func (*ProxyServer) GetOptions ¶
func (this *ProxyServer) GetOptions() *ProxyServerOptions
func (*ProxyServer) OnClose ¶
func (this *ProxyServer) OnClose(listener func(...interface{}))
OnClose
@param listener func(throwable try.Throwable)
func (*ProxyServer) OnError ¶
func (this *ProxyServer) OnError(listener func(...interface{}))
OnError
@param listener func(throwable try.Throwable)
func (*ProxyServer) OnProxyError ¶
func (this *ProxyServer) OnProxyError(listener func(resp http.ResponseWriter, req *http.Request, err error))
func (*ProxyServer) OnProxyReq ¶
func (this *ProxyServer) OnProxyReq(listener func(proxyReq *http.Request, request *http.Request, response http.ResponseWriter, options *ProxyServerOptions, ))
OnProxyReq
@param listener func(listener func(proxyReq *http.Request, request *http.Request, response http.ResponseWriter, options *ProxyServerOptions)
func (*ProxyServer) OnProxyReqWs ¶
func (this *ProxyServer) OnProxyReqWs(listener func(proxyReq *http.Request, request *http.Request, response http.ResponseWriter, options *ProxyServerOptions, ))
OnProxyReqWs
@param listener func(listener func(proxyReq *http.Request, request *http.Request, response http.ResponseWriter, options *ProxyServerOptions)
func (*ProxyServer) OnProxyResp ¶
func (this *ProxyServer) OnProxyResp(listener func(proxyResp *http.Response))
OnProxyResp
@param listener func(listener func(proxyReq *http.Request, request *http.Request, response http.ResponseWriter, options *ProxyServerOptions)
func (*ProxyServer) RefreshOptions ¶
func (this *ProxyServer) RefreshOptions()
func (*ProxyServer) Web ¶
func (this *ProxyServer) Web(response http.ResponseWriter, request *http.Request, args ...interface{})
web proxy
@param response http.ResponseWriter
@param request *http.Request
@param extOptions *ProxyServerOptions
type ProxyServerOptions ¶
type ProxyServerOptions struct { // url string to be parsed with the url module Target string // object to be passed to https.createServer() Ssl *ProxyServerOptions // true/false, Default: true adds x-forward headers Xfwd bool // true/false, Default: false verify SSL certificate Secure bool // Basic authentication i.e. 'user:password' to compute an Authorization header Auth string // rewrites domain of `set-cookie` headers CookieDomainRewrite map[string]string // rewrites path of `set-cookie` headers CookiePathRewrite map[string]string // object with extra headers to be added to target requests Headers map[string]string // ProxyTimeout Default: 60s ProxyTimeout time.Duration // KeepAlive Default: 60s KeepAlive time.Duration // Maximum idle connections default: 100 MaxIdleConns int // Idle Conn Timeout default: 90s IdleConnTimeout time.Duration // Idle Conn Timeout default: 10s TLSHandshakeTimeout time.Duration // Idle Conn Timeout default: 3s ExpectContinueTimeout time.Duration // Disable Compression default: true DisableCompression bool // true/false, Default: true - specify whether you want to follow redirects FollowRedirects bool }
ProxyServerOptions
func NewProxyServerOptions ¶
func NewProxyServerOptions() *ProxyServerOptions