Documentation
¶
Index ¶
- Constants
- Variables
- func GetDemoConf() string
- func GetFormValuesWithPrefix(values url.Values, prefix string) map[string][]string
- func GetVersion() string
- func Int64ToBytes(i int64) []byte
- func IsLocalIp(host string) bool
- func NewRequestCtx(ser *ProxyServe, req *http.Request) *requestCtx
- func NewRequestModifier(ser *ProxyServe) *requestModifier
- type Config
- type HttpProxy
- type KvTable
- func (tb *KvTable) Count() int
- func (tb *KvTable) Delete(id int) error
- func (tb *KvTable) ForEachDoc(fn func(int, []byte) bool)
- func (tb *KvTable) Gc(max_time_unix int64) int
- func (tb *KvTable) GetByKey(id int) (data KvType, err error)
- func (tb *KvTable) Scrub()
- func (tb *KvTable) Set(id int, data KvType) error
- type KvType
- type ProxyServe
- func (ser *ProxyServe) Broadcast_Req(req *http.Request, reqCtx *requestCtx) bool
- func (ser *ProxyServe) GetHostsFilePath() string
- func (ser *ProxyServe) GetNewDocid() int
- func (ser *ProxyServe) GetRequestByDocid(docid int) (req_data KvType)
- func (ser *ProxyServe) GetResponseByDocid(docid int) (res_data KvType)
- func (ser *ProxyServe) GetRewriteJsPath() string
- func (ser *ProxyServe) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (ser *ProxyServe) Start()
- type TieDb
- type User
- type WebsocketProxy
Constants ¶
View Source
const ( AuthType_NO = 0 AuthType_Basic = 1 AuthType_Basic_WithAny = 2 AuthType_Basic_Try = 3 ResponseSave_All = 0 ResponseSave_HasBroad = 1 //has show SessionView_ALL = 0 SessionView_IP_OR_USER = 1 )
View Source
const ( REDO_FLAG = "Proxy-pproxy_redo" REDO_REMOTEADDR = "Proxy-pproxy_remoteaddr" REDO_USER_NAME = "Proxy-pproxy_user" )
View Source
const (
Content_Encoding = "Content-Encoding"
)
Variables ¶
View Source
var CookieName = "pproxy"
View Source
var ( // DefaultUpgrader specifies the parameters for upgrading an HTTP // connection to a WebSocket connection. DefaultUpgrader = &websocket.Upgrader{ ReadBufferSize: 1024, WriteBufferSize: 1024, } )
View Source
var PproxyVersion string = ""
Functions ¶
func GetDemoConf ¶
func GetDemoConf() string
func GetFormValuesWithPrefix ¶
func GetVersion ¶
func GetVersion() string
func Int64ToBytes ¶
func NewRequestCtx ¶
func NewRequestCtx(ser *ProxyServe, req *http.Request) *requestCtx
func NewRequestModifier ¶
func NewRequestModifier(ser *ProxyServe) *requestModifier
Types ¶
type Config ¶
type Config struct { Port int Title string Notice string AuthType int DataDir string ResponseSave int SessionView int DataStoreDay int ParentProxy *url.URL }
func LoadConfig ¶
type HttpProxy ¶
type HttpProxy struct { GoProxy *goproxy.ProxyHttpServer // contains filtered or unexported fields }
func NewHttpProxy ¶
func NewHttpProxy(ser *ProxyServe) *HttpProxy
type ProxyServe ¶
type ProxyServe struct { MaxResSaveLength int64 Debug bool Users map[string]*User ProxyClients map[string]*clientSession // contains filtered or unexported fields }
func NewProxyServe ¶
func NewProxyServe(confPath string, port int) (*ProxyServe, error)
func (*ProxyServe) Broadcast_Req ¶
func (ser *ProxyServe) Broadcast_Req(req *http.Request, reqCtx *requestCtx) bool
func (*ProxyServe) GetHostsFilePath ¶
func (ser *ProxyServe) GetHostsFilePath() string
func (*ProxyServe) GetNewDocid ¶
func (ser *ProxyServe) GetNewDocid() int
func (*ProxyServe) GetRequestByDocid ¶
func (ser *ProxyServe) GetRequestByDocid(docid int) (req_data KvType)
func (*ProxyServe) GetResponseByDocid ¶
func (ser *ProxyServe) GetResponseByDocid(docid int) (res_data KvType)
func (*ProxyServe) GetRewriteJsPath ¶
func (ser *ProxyServe) GetRewriteJsPath() string
func (*ProxyServe) ServeHTTP ¶
func (ser *ProxyServe) ServeHTTP(w http.ResponseWriter, req *http.Request)
func (*ProxyServe) Start ¶
func (ser *ProxyServe) Start()
type TieDb ¶
type TieDb struct { RequestTable *KvTable ResponseTable *KvTable // contains filtered or unexported fields }
func (*TieDb) StartGcTimer ¶
type User ¶
func (*User) ConfigString ¶
type WebsocketProxy ¶
type WebsocketProxy struct { // Upgrader specifies the parameters for upgrading a incoming HTTP // connection to a WebSocket connection. If nil, DefaultUpgrader is used. Upgrader *websocket.Upgrader // contains filtered or unexported fields }
WebsocketProxy is an HTTP Handler that takes an incoming WebSocket connection and proxies it to another server.
func NewWsProxy ¶
func NewWsProxy(ser *ProxyServe) *WebsocketProxy
NewProxy returns a new Websocket reverse proxy that rewrites the URL's to the scheme, host and base path provider in target.
func (*WebsocketProxy) ServeHTTP ¶
func (w *WebsocketProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request)
ServeHTTP implements the http.Handler that proxies WebSocket connections.
Click to show internal directories.
Click to hide internal directories.