Documentation ¶
Index ¶
- Constants
- func GetUnixDomainPath(param *ProxyParam) string
- type LocalProxy
- func (self *LocalProxy) GetProxy(pid, protocol, remote, initData string) (string, error)
- func (self *LocalProxy) HandleCloseProxyConn(w http.ResponseWriter, r *http.Request)
- func (self *LocalProxy) HandleDebugStatus(w http.ResponseWriter, r *http.Request)
- func (self *LocalProxy) HandleDestroyAll(w http.ResponseWriter, r *http.Request)
- func (self *LocalProxy) HandleDestroyProxyConn(w http.ResponseWriter, r *http.Request)
- func (self *LocalProxy) HandleGetProxyConn(w http.ResponseWriter, r *http.Request)
- func (self *LocalProxy) HandleSetLogLevel(w http.ResponseWriter, r *http.Request)
- func (self *LocalProxy) HandleStatus(w http.ResponseWriter, r *http.Request)
- func (self *LocalProxy) Restart()
- func (self *LocalProxy) StartInheritedProxy() error
- func (self *LocalProxy) StartLocalProxy(port uint16) error
- func (self *LocalProxy) Stop()
- type ProxyConnData
- type ProxyListenerData
- type ProxyManager
- type ProxyParam
- type TCPConnPool
- func (self *TCPConnPool) AcquireConn() (bool, *ProxyConnData, error)
- func (self *TCPConnPool) CleanPool()
- func (self *TCPConnPool) DestroyRemoteConn(proxyconn *ProxyConnData)
- func (self *TCPConnPool) IsEmpty() bool
- func (self *TCPConnPool) IsUnusedSince(t time.Time) bool
- func (self *TCPConnPool) ReleaseConn(p *ProxyConnData)
- func (self *TCPConnPool) ShrinkPool()
- func (self *TCPConnPool) StatusString() string
Constants ¶
View Source
const ( RSP_BUF_SIZE = 1024 BUF_MAX_NUM = 200 MAX_CONN_NUM = 100 SHRINK_THRESHOLD = 10 SHRINK_NUM = 2 CONN_TIMEOUT = 3 )
View Source
const (
TMP_PROXY_PARAM_PATH = "/tmp/proxyparams.tmp"
)
Variables ¶
This section is empty.
Functions ¶
func GetUnixDomainPath ¶
func GetUnixDomainPath(param *ProxyParam) string
Types ¶
type LocalProxy ¶
func NewLocalProxy ¶
func NewLocalProxy() *LocalProxy
func (*LocalProxy) GetProxy ¶
func (self *LocalProxy) GetProxy(pid, protocol, remote, initData string) (string, error)
func (*LocalProxy) HandleCloseProxyConn ¶
func (self *LocalProxy) HandleCloseProxyConn(w http.ResponseWriter, r *http.Request)
proxy client could call the close to avoid the connection data mismatch. If any timeout or error on the client the connection should be closed. If the client finished normally, the client can just close the socket and the connection
on the remote will be reused.
func (*LocalProxy) HandleDebugStatus ¶
func (self *LocalProxy) HandleDebugStatus(w http.ResponseWriter, r *http.Request)
func (*LocalProxy) HandleDestroyAll ¶
func (self *LocalProxy) HandleDestroyAll(w http.ResponseWriter, r *http.Request)
func (*LocalProxy) HandleDestroyProxyConn ¶
func (self *LocalProxy) HandleDestroyProxyConn(w http.ResponseWriter, r *http.Request)
If the remote will be not used anymore, the local listener can be deleted.
func (*LocalProxy) HandleGetProxyConn ¶
func (self *LocalProxy) HandleGetProxyConn(w http.ResponseWriter, r *http.Request)
func (*LocalProxy) HandleSetLogLevel ¶
func (self *LocalProxy) HandleSetLogLevel(w http.ResponseWriter, r *http.Request)
func (*LocalProxy) HandleStatus ¶
func (self *LocalProxy) HandleStatus(w http.ResponseWriter, r *http.Request)
func (*LocalProxy) Restart ¶
func (self *LocalProxy) Restart()
func (*LocalProxy) StartInheritedProxy ¶
func (self *LocalProxy) StartInheritedProxy() error
func (*LocalProxy) StartLocalProxy ¶
func (self *LocalProxy) StartLocalProxy(port uint16) error
func (*LocalProxy) Stop ¶
func (self *LocalProxy) Stop()
type ProxyConnData ¶
type ProxyConnData struct {
// contains filtered or unexported fields
}
func NewProxyConnData ¶
func NewProxyConnData(c *net.TCPConn) *ProxyConnData
func (*ProxyConnData) Close ¶
func (self *ProxyConnData) Close()
type ProxyListenerData ¶
type ProxyListenerData struct { ProxyParam LastUsed time.Time AutoClean bool }
type ProxyManager ¶
type ProxyManager struct {
// contains filtered or unexported fields
}
func NewProxyManager ¶
func NewProxyManager(c []common.ProxyConf) *ProxyManager
func (*ProxyManager) StartAll ¶
func (self *ProxyManager) StartAll(lp *LocalProxy) error
func (*ProxyManager) StopAll ¶
func (self *ProxyManager) StopAll()
type ProxyParam ¶
type TCPConnPool ¶
type TCPConnPool struct {
// contains filtered or unexported fields
}
func NewTCPConnPool ¶
func NewTCPConnPool(userspbuf bool, pid, address string, p *util.FixedBufferPool) *TCPConnPool
if use response buffer, the pool will manager the read from remote and the client should read from the buffer. Otherwise, the client can read from remote directly.
func (*TCPConnPool) AcquireConn ¶
func (self *TCPConnPool) AcquireConn() (bool, *ProxyConnData, error)
func (*TCPConnPool) CleanPool ¶
func (self *TCPConnPool) CleanPool()
func (*TCPConnPool) DestroyRemoteConn ¶
func (self *TCPConnPool) DestroyRemoteConn(proxyconn *ProxyConnData)
func (*TCPConnPool) IsEmpty ¶
func (self *TCPConnPool) IsEmpty() bool
func (*TCPConnPool) IsUnusedSince ¶
func (self *TCPConnPool) IsUnusedSince(t time.Time) bool
func (*TCPConnPool) ReleaseConn ¶
func (self *TCPConnPool) ReleaseConn(p *ProxyConnData)
func (*TCPConnPool) ShrinkPool ¶
func (self *TCPConnPool) ShrinkPool()
func (*TCPConnPool) StatusString ¶
func (self *TCPConnPool) StatusString() string
Click to show internal directories.
Click to hide internal directories.