Versions in this module Expand all Collapse all v0 v0.2.0 Dec 1, 2020 Changes in this version + const TCPClientMaxAttempts + const TCPClientStreamSize + var ErrFTPTooManyConnections = errors.New("ftp: too many connections") + var HOSTNAME = os.Hostname() + var QPS = int32(0) + var ShareStaticDelivery = NewStaticDelivery() + var SharedFTPClientPool = NewFTPClientPool() + var SharedHTTPClientPool = NewHTTPClientPool() + var SharedManager = NewManager() + var SharedTunnelManager = NewTunnelManager() + func AddRequestHook(hook *RequestHook) + func CallRequestAfterHook(req *Request, writer *ResponseWriter) (goNext bool) + func CallRequestBeforeHook(req *Request, writer *ResponseWriter) (goNext bool) + func CleanPath(path string) string + type EmptyResponseWriter struct + func NewEmptyResponseWriter() *EmptyResponseWriter + func (this *EmptyResponseWriter) Header() http.Header + func (this *EmptyResponseWriter) Write([]byte) (int, error) + func (this *EmptyResponseWriter) WriteHeader(statusCode int) + type FTPClient struct + func (this *FTPClient) Close() error + func (this *FTPClient) Do(req *http.Request) (*http.Response, error) + type FTPClientPool struct + func NewFTPClientPool() *FTPClientPool + type FTPConnectionPool struct + func (this *FTPConnectionPool) Close(client *ftp.ServerConn) error + func (this *FTPConnectionPool) CloseAll() error + func (this *FTPConnectionPool) Decrease() + func (this *FTPConnectionPool) Get() (*ftp.ServerConn, error) + func (this *FTPConnectionPool) Increase() + func (this *FTPConnectionPool) Put(client *ftp.ServerConn) + type FTPResponseBody struct + func (this *FTPResponseBody) Close() error + type ForwardProxy struct + type HTTPClientPool struct + func NewHTTPClientPool() *HTTPClientPool + type HTTPServeMux struct + func (this *HTTPServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Listener struct + Address string + Error error + IsChanged bool + Scheme Scheme + func NewListener() *Listener + func (this *Listener) ApplyServer(server *teaconfigs.ServerConfig) + func (this *Listener) CloseTCPClient(lAddr string) error + func (this *Listener) HasServer(serverId string) bool + func (this *Listener) HasServers() bool + func (this *Listener) Reload() error + func (this *Listener) RemoveServer(serverId string) + func (this *Listener) Reset() + func (this *Listener) Shutdown() error + func (this *Listener) Start() error + func (this *Listener) TCPClients(maxSize int) []*TCPClient + type Manager struct + func NewManager() *Manager + func (this *Manager) ApplyServer(server *teaconfigs.ServerConfig) + func (this *Manager) FindAllServers() []*teaconfigs.ServerConfig + func (this *Manager) FindServer(serverId string) *teaconfigs.ServerConfig + func (this *Manager) FindServerErrors(serverId string) []string + func (this *Manager) FindServerListeners(serverId string) []*Listener + func (this *Manager) Reload() error + func (this *Manager) RemoveServer(serverId string) + func (this *Manager) Restart() error + func (this *Manager) Shutdown() error + func (this *Manager) Start() error + func (this *Manager) Wait() + type NamedServer struct + Name string + Server *teaconfigs.ServerConfig + type Request struct + func NewRequest(rawRequest *http.Request) *Request + func (this *Request) CachePolicy() *shared.CachePolicy + func (this *Request) Format(source string) string + func (this *Request) Forward(writer *ResponseWriter) error + func (this *Request) IsCacheEnabled() bool + func (this *Request) IsWatching() bool + func (this *Request) Raw() *http.Request + func (this *Request) SetAttr(key string, value string) + func (this *Request) SetCacheEnabled() + func (this *Request) SetCachePolicy(config *shared.CachePolicy) + func (this *Request) SetHost(host string) + func (this *Request) SetIsWatching(isWatching bool) + func (this *Request) SetRawScheme(scheme string) + func (this *Request) SetURI(uri string) + func (this *Request) SetVarMapping(varName string, varValue string) + func (this *Request) WriteResponseHeaders(writer *ResponseWriter, statusCode int) + type RequestHook struct + AfterRequest func(req *Request, writer *ResponseWriter) (goNext bool) + BeforeRequest func(req *Request, writer *ResponseWriter) (goNext bool) + type ResponseWriter struct + func NewResponseWriter(httpResponseWriter http.ResponseWriter) *ResponseWriter + func (this *ResponseWriter) AddHeaders(header http.Header) + func (this *ResponseWriter) Body() []byte + func (this *ResponseWriter) BodyIsCopying() bool + func (this *ResponseWriter) Close() + func (this *ResponseWriter) Flush() + func (this *ResponseWriter) Gzip(config *teaconfigs.GzipConfig) + func (this *ResponseWriter) Header() http.Header + func (this *ResponseWriter) HeaderData() []byte + func (this *ResponseWriter) Hijack() (conn net.Conn, buf *bufio.ReadWriter, err error) + func (this *ResponseWriter) Prepare(size int64) + func (this *ResponseWriter) Raw() http.ResponseWriter + func (this *ResponseWriter) Reset(httpResponseWriter http.ResponseWriter) + func (this *ResponseWriter) SentBodyBytes() int64 + func (this *ResponseWriter) SetBodyCopying(b bool) + func (this *ResponseWriter) StatusCode() int + func (this *ResponseWriter) Write(data []byte) (n int, err error) + func (this *ResponseWriter) WriteHeader(statusCode int) + func (this *ResponseWriter) WriteString(s string) (n int, err error) + type Scheme = uint8 + const SchemeHTTP + const SchemeHTTPS + const SchemeTCP + const SchemeTCPTLS + type StaticDelivery struct + func NewStaticDelivery() *StaticDelivery + func (this *StaticDelivery) Read(path string, stat os.FileInfo) (reader io.Reader, shouldClose bool, err error) + type StaticFileCache struct + type TCPClient struct + func NewTCPClient(serverPool func() *teaconfigs.ServerConfig, conn net.Conn) *TCPClient + func (this *TCPClient) Close() error + func (this *TCPClient) Connect() + func (this *TCPClient) LConn() net.Conn + func (this *TCPClient) RConn() net.Conn + func (this *TCPClient) ReadSpeed() int64 + func (this *TCPClient) WriteSpeed() int64 + type Tunnel struct + func NewTunnel(config *teaconfigs.TunnelConfig) *Tunnel + func (this *Tunnel) Close() error + func (this *Tunnel) CountConnections() int + func (this *Tunnel) Id() string + func (this *Tunnel) Start() error + func (this *Tunnel) Write(req *http.Request) (resp *http.Response, err error) + type TunnelConnection struct + func NewTunnelConnection(conn net.Conn, tunnelConfig *teaconfigs.TunnelConfig) *TunnelConnection + func (this *TunnelConnection) Close() error + func (this *TunnelConnection) IsAuthenticated() bool + func (this *TunnelConnection) OnClose(handler func(tunnelConn *TunnelConnection)) + func (this *TunnelConnection) Ping() error + func (this *TunnelConnection) RemoteAddr() string + func (this *TunnelConnection) Write(req *http.Request) (*http.Response, error) + type TunnelManager struct + func NewTunnelManager() *TunnelManager + func (this *TunnelManager) FindTunnel(serverId, tunnelId string) *Tunnel + func (this *TunnelManager) OnAttach(server *teaconfigs.ServerConfig) + func (this *TunnelManager) OnDetach(server *teaconfigs.ServerConfig) + type TunnelResponseBody struct + func (this *TunnelResponseBody) Close() error