Documentation ¶
Index ¶
- Constants
- Variables
- func GetAction(hostname string) func() (interface{}, error)
- type Certificate
- type ConnPeer
- type HttpRequestEvent
- type HttpResponseEvent
- type ProxyHttp
- func (i *ProxyHttp) DialContext() func(ctx context.Context, network, addr string) (conn net.Conn, err error)
- func (i *ProxyHttp) Handle()
- func (i *ProxyHttp) ReadRequestBody(reader io.Reader) ([]byte, error)
- func (i *ProxyHttp) ReadResponseBody(response *http.Response) ([]byte, error)
- func (i *ProxyHttp) RemoveHeader(header http.Header)
- func (i *ProxyHttp) RemoveWsHeader()
- func (i *ProxyHttp) SetRequest(request *http.Request) *http.Request
- func (i *ProxyHttp) SslReceiveSend()
- func (i *ProxyHttp) Transport(request *http.Request) (*http.Response, error)
- func (i *ProxyHttp) WsIsConnected(conn *Websocket.Conn) bool
- type ProxyServer
- type ProxySocks5
- type ProxyTcp
- type ResolveHttpRequest
- type ResolveHttpResponse
- type ResolveSocks5
- type ResolveTcp
- type ResolveWs
- type Socks5RequestEvent
- type Socks5ResponseEvent
- type Storage
- type TcpClientStreamEvent
- type TcpClosetEvent
- type TcpConnectEvent
- type TcpServerStreamEvent
- type WsRequestEvent
- type WsResponseEvent
Constants ¶
View Source
const ( MethodGet = 0x47 MethodConnect = 0x43 MethodPost = 0x50 MethodPut = 0x50 MethodDelete = 0x44 MethodOptions = 0x4F MethodHead = 0x48 SocksFive = 0x5 )
View Source
const ( // 预留位 Rsv = 0x00 // 命令 CommandConn = 0x01 CommandBind = 0x02 CommandUdp = 0x03 // 目标类型 TargetIpv4 = 0x01 TargetIpv6 = 0x04 TargetDomain = 0x03 Version = 0x5 )
View Source
const ( GssApi = 0x01 UsernamePassword = 0x02 IanaAssignedMin = 0x03 IanaAssignedMax = 0x7F ReservedForPrivateMin = 0x80 ReservedForPrivateMax = 0xFE NoAcceptMethod = 0xFF )
View Source
const ConnectFailed = "HTTP/1.1 502 Bad Gateway\r\n\r\n"
View Source
const ConnectSuccess = "HTTP/1.1 200 Connection Established\r\n\r\n"
View Source
const SocketClient = "client"
View Source
const SocketServer = "server"
View Source
const SslFileHost = "shermie-proxy.io"
View Source
const TcpClient = "client"
View Source
const TcpServer = "server"
Variables ¶
View Source
var Cache = NewStorage()
Functions ¶
Types ¶
type Certificate ¶
type Certificate struct { RootKey *rsa.PrivateKey RootCa *x509.Certificate RootCaStr []byte RootKeyStr []byte }
var Cert *Certificate
func NewCertificate ¶
func NewCertificate() *Certificate
func (*Certificate) GenerateKeyPair ¶
func (i *Certificate) GenerateKeyPair() (*rsa.PrivateKey, error)
生成一对具有指定字位数的RSA密钥
func (*Certificate) GeneratePem ¶
func (i *Certificate) GeneratePem(host string) ([]byte, []byte, error)
用根证书生成新的子证书
func (*Certificate) GenerateRootPemFile ¶
生成新的根证书
type HttpRequestEvent ¶
type HttpResponseEvent ¶
type ProxyHttp ¶
type ProxyHttp struct { ConnPeer // contains filtered or unexported fields }
func (*ProxyHttp) DialContext ¶
func (*ProxyHttp) ReadRequestBody ¶
读取http请求体
func (*ProxyHttp) ReadResponseBody ¶
func (*ProxyHttp) SetRequest ¶
设置请求头
type ProxyServer ¶
type ProxyServer struct { OnHttpRequestEvent HttpRequestEvent OnHttpResponseEvent HttpResponseEvent OnWsRequestEvent WsRequestEvent OnWsResponseEvent WsResponseEvent OnSocks5ResponseEvent Socks5ResponseEvent OnSocks5RequestEvent Socks5RequestEvent OnTcpConnectEvent TcpConnectEvent OnTcpCloseEvent TcpClosetEvent OnTcpServerStreamEvent TcpServerStreamEvent OnTcpClientStreamEvent TcpClientStreamEvent // contains filtered or unexported fields }
func NewProxyServer ¶
func (*ProxyServer) Install ¶
func (i *ProxyServer) Install()
func (*ProxyServer) Logo ¶
func (i *ProxyServer) Logo()
func (*ProxyServer) MultiListen ¶
func (i *ProxyServer) MultiListen()
func (*ProxyServer) Start ¶
func (i *ProxyServer) Start() error
func (*ProxyServer) Stop ¶
func (i *ProxyServer) Stop() error
func (*ProxyServer) UnInstall ¶
func (i *ProxyServer) UnInstall()
type ProxySocks5 ¶
type ProxySocks5 struct { ConnPeer // contains filtered or unexported fields }
func NewProxySocket ¶
func NewProxySocket() *ProxySocks5
func (*ProxySocks5) Handle ¶
func (i *ProxySocks5) Handle()
func (*ProxySocks5) IpV4 ¶
func (i *ProxySocks5) IpV4(ipAddr string) bool
func (*ProxySocks5) IpV6 ¶
func (i *ProxySocks5) IpV6(ipAddr string) bool
type ResolveHttpRequest ¶
type ResolveHttpResponse ¶
type ResolveSocks5 ¶
type ResolveTcp ¶
type Socks5RequestEvent ¶
type Socks5ResponseEvent ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func NewStorage ¶
func NewStorage() *Storage
type TcpClientStreamEvent ¶
type TcpClosetEvent ¶
type TcpConnectEvent ¶
type TcpServerStreamEvent ¶
type WsRequestEvent ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.