Documentation ¶
Index ¶
- Constants
- type Cipher
- type ClientConfig
- type IOConfig
- type IOReadCloserCipher
- type Options
- type ProxyClient
- func (proxy *ProxyClient) Bridge(down net.Conn, host string)
- func (proxy *ProxyClient) DialUpstream(conn net.Conn, host string, resp []byte, extra uint32, dialStyle byte) (net.Conn, error)
- func (proxy *ProxyClient) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (proxy *ProxyClient) Start() error
- func (proxy *ProxyClient) StartLocalRP(n int)
- type ProxyServer
- type ResponseHook
- type Rule
- type ServerConfig
- type TokenBucket
- type UserConfig
Constants ¶
View Source
const ( FullCipher _CipherMode = iota PartialCipher NoneCipher )
View Source
const ( PolicyMITM = 1 << iota PolicyForward PolicyAgent PolicyGlobal PolicyVPN PolicyWebSocket PolicyHTTPS PolicyKCP PolicyDisableUDP PolicyDisableLRP )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cipher ¶
type Cipher struct { IO io_t Key string Block cipher.Block GCM cipher.AEAD Rand *rand.Rand Mode _CipherMode Alias string // contains filtered or unexported fields }
type ClientConfig ¶
type IOConfig ¶
type IOConfig struct { Bucket *TokenBucket Chunked bool Mode _CipherMode Print bool Role byte WSCtrl byte }
type IOReadCloserCipher ¶
type IOReadCloserCipher struct {
// contains filtered or unexported fields
}
func (*IOReadCloserCipher) Close ¶
func (rc *IOReadCloserCipher) Close() error
type ProxyClient ¶
type ProxyClient struct { *ClientConfig Localaddr string Listener *listenerWrapper // contains filtered or unexported fields }
func NewClient ¶
func NewClient(localaddr string, config *ClientConfig) (*ProxyClient, error)
func (*ProxyClient) DialUpstream ¶
func (*ProxyClient) ServeHTTP ¶
func (proxy *ProxyClient) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*ProxyClient) Start ¶
func (proxy *ProxyClient) Start() error
func (*ProxyClient) StartLocalRP ¶
func (proxy *ProxyClient) StartLocalRP(n int)
StartLocalRP is a block call, it will never return
type ProxyServer ¶
type ProxyServer struct { Localaddr string Listener net.Listener *ServerConfig // contains filtered or unexported fields }
ProxyServer is the main struct for upstream server
func NewServer ¶
func NewServer(addr string, config *ServerConfig) (*ProxyServer, error)
func (*ProxyServer) ServeHTTP ¶
func (proxy *ProxyServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*ProxyServer) Start ¶
func (proxy *ProxyServer) Start() (err error)
func (*ProxyServer) Write ¶
func (proxy *ProxyServer) Write(w http.ResponseWriter, key [ivLen]byte, p []byte, code int) (n int, err error)
type ResponseHook ¶
type ResponseHook interface {
SetBody(r io.ReadCloser)
}
type ServerConfig ¶
type TokenBucket ¶
type TokenBucket struct { Speed int64 // bytes per second // contains filtered or unexported fields }
func NewTokenBucket ¶
func NewTokenBucket(speed, max int64) *TokenBucket
func (*TokenBucket) Consume ¶
func (tb *TokenBucket) Consume(n int64)
type UserConfig ¶
UserConfig is for multi-users server, not implemented yet
Click to show internal directories.
Click to hide internal directories.