Documentation
¶
Index ¶
- func DeleteHijacker(name string)
- func GetDefaultCAAndPriv() (*x509.Certificate, *rsa.PrivateKey, error)
- func GetDefaultCAAndPrivRaw() ([]byte, []byte)
- func GetDefaultCaAndKey() ([]byte, []byte, error)
- func GetDefaultCaFilePath() string
- func InitMITMCert()
- func NewRequestModifier(f martian.RequestModifierFunc) martian.RequestModifier
- func NewResponseModifier(f martian.ResponseModifierFunc) martian.ResponseModifier
- func NewRoundTripHandler(f HTTPRoundTripHandler) *mitmRoundTrip
- func NewTransport(opts *HTTPClientOptions) (*http.Transport, error)
- func ParsePKCS12FromFile(c PKCS12Config) (*tls.Certificate, error)
- func Snapshot(s string, timeout time.Duration) ([]byte, *types.Type, error)
- type ClientCertificationPair
- type Dialer
- type HTTPClientOptions
- type HTTPRoundTripHandler
- type Hijacker
- func (h *Hijacker) FinishCurrentHijackingRequest(data []byte) error
- func (h *Hijacker) GetCurrentHijackingRequest() (*hijackerMsg, error)
- func (h *Hijacker) GetHijackingRequest(ctx context.Context) (req []byte, err error)
- func (h *Hijacker) GetHijackingRequestById(id string) (*hijackerMsg, error)
- func (h *Hijacker) Name() string
- func (h *Hijacker) RequireHijack(rootCtx context.Context, data []byte) []byte
- type MITMConfig
- func MITM_AppendDNSServers(servers ...string) MITMConfig
- func MITM_MergeOptions(b ...MITMConfig) MITMConfig
- func MITM_MutualTLSClient(crt, key []byte, cas ...[]byte) MITMConfig
- func MITM_ProxyAuth(username string, password string) MITMConfig
- func MITM_SetCaCertAndPrivKey(ca []byte, key []byte) MITMConfig
- func MITM_SetDNSServers(servers ...string) MITMConfig
- func MITM_SetDownstreamProxy(s string) MITMConfig
- func MITM_SetForceTextFrame(t bool) MITMConfig
- func MITM_SetGM(b bool) MITMConfig
- func MITM_SetGMOnly(b bool) MITMConfig
- func MITM_SetGMPrefer(b bool) MITMConfig
- func MITM_SetHTTP2(b bool) MITMConfig
- func MITM_SetHTTPRequestHijack(c func(isHttps bool, req *http.Request) *http.Request) MITMConfig
- func MITM_SetHTTPRequestHijackRaw(c func(isHttps bool, reqIns *http.Request, req []byte) []byte) MITMConfig
- func MITM_SetHTTPRequestMirror(f func(isHttps bool, req *http.Request)) MITMConfig
- func MITM_SetHTTPRequestMirrorRaw(f func(isHttps bool, raw []byte)) MITMConfig
- func MITM_SetHTTPResponseHijackRaw(c func(isHttps bool, req *http.Request, rsp []byte, remoteAddr string) []byte) MITMConfig
- func MITM_SetHTTPResponseMirror(f func(bool, string, *http.Request, *http.Response, string)) MITMConfig
- func MITM_SetHTTPResponseMirrorInstance(...) MITMConfig
- func MITM_SetHTTPResponseMirrorRaw(f func(isHttps bool, req, rsp []byte, remoteAddr string)) MITMConfig
- func MITM_SetHijackedMaxContentLength(i int) MITMConfig
- func MITM_SetHostMapping(m map[string]string) MITMConfig
- func MITM_SetLowerHeader(c ...string) MITMConfig
- func MITM_SetTransparentHijackHTTPRequest(f MITMTransparentHijackHTTPRequestFunc) MITMConfig
- func MITM_SetTransparentHijackHTTPResponse(f MITMTransparentHijackHTTPResponseFunc) MITMConfig
- func MITM_SetTransparentHijackMode(t bool) MITMConfig
- func MITM_SetTransparentHijackRequest(f MITMTransparentHijackFunc) MITMConfig
- func MITM_SetTransparentHijackRequestManager(m *TransparentHijackManager) MITMConfig
- func MITM_SetTransparentHijackResponse(f MITMTransparentHijackFunc) MITMConfig
- func MITM_SetTransparentHijackedMirror(f MITMTransparentMirrorFunc) MITMConfig
- func MITM_SetTransparentHijackedMirrorHTTP(f MITMTransparentMirrorHTTPFunc) MITMConfig
- func MITM_SetTransparentMirror(f MITMTransparentMirrorFunc) MITMConfig
- func MITM_SetTransparentMirrorHTTP(f MITMTransparentMirrorHTTPFunc) MITMConfig
- func MITM_SetTransport(tr *http.Transport) MITMConfig
- func MITM_SetTransportByHTTPClientOptions(client *HTTPClientOptions) (MITMConfig, error)
- func MITM_SetVia(s string) MITMConfig
- func MITM_SetWebsocketHijackMode(t bool) MITMConfig
- func MITM_SetWebsocketRequestHijackRaw(...) MITMConfig
- func MITM_SetWebsocketRequestMirrorRaw(f func(req []byte)) MITMConfig
- func MITM_SetWebsocketResponseHijackRaw(...) MITMConfig
- func MITM_SetWebsocketResponseMirrorRaw(f func(req []byte)) MITMConfig
- func MITM_SetXForwarded(b bool) MITMConfig
- type MITMServer
- func (m *MITMServer) Configure(options ...MITMConfig) error
- func (m *MITMServer) GetCaCert() []byte
- func (m *MITMServer) GetMartianProxy() *martian.Proxy
- func (s *MITMServer) GetRemoteAddr(isHttps bool, host string) string
- func (s *MITMServer) GetRemoteAddrRaw(host string) string
- func (m *MITMServer) Serve(ctx context.Context, addr string) error
- func (m *MITMServer) ServeTransparentTLS(ctx context.Context, addr string) error
- type MITMTransparentHijackFunc
- type MITMTransparentHijackHTTPRequestFunc
- type MITMTransparentHijackHTTPResponseFunc
- type MITMTransparentMirrorFunc
- type MITMTransparentMirrorHTTPFunc
- type PKCS12Config
- type ProxyAuth
- type TransparentHijackManager
- func (t *TransparentHijackManager) Hijacked(isHttps bool, req []byte) []byte
- func (t *TransparentHijackManager) List() []string
- func (t *TransparentHijackManager) RemoveByHash(h string)
- func (t *TransparentHijackManager) SetHijackRequestForHost(re string, requsetFunc MITMTransparentHijackFunc) error
- func (t *TransparentHijackManager) SetHijackRequestForPath(re string, requestFunc MITMTransparentHijackFunc) error
- type WebSocketModifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteHijacker ¶
func DeleteHijacker(name string)
func GetDefaultCAAndPriv ¶
func GetDefaultCAAndPriv() (*x509.Certificate, *rsa.PrivateKey, error)
func GetDefaultCAAndPrivRaw ¶
func GetDefaultCaAndKey ¶
func GetDefaultCaFilePath ¶
func GetDefaultCaFilePath() string
func InitMITMCert ¶
func InitMITMCert()
func NewRequestModifier ¶
func NewRequestModifier(f martian.RequestModifierFunc) martian.RequestModifier
request modifier
func NewResponseModifier ¶
func NewResponseModifier(f martian.ResponseModifierFunc) martian.ResponseModifier
response modifier
func NewRoundTripHandler ¶
func NewRoundTripHandler(f HTTPRoundTripHandler) *mitmRoundTrip
func NewTransport ¶
func NewTransport(opts *HTTPClientOptions) (*http.Transport, error)
func ParsePKCS12FromFile ¶
func ParsePKCS12FromFile(c PKCS12Config) (*tls.Certificate, error)
Types ¶
type ClientCertificationPair ¶
func NewClientCertificationPair ¶
func NewClientCertificationPair(crt, key []byte, cas ...[]byte) *ClientCertificationPair
type Dialer ¶ added in v1.2.3
type Dialer struct {
// contains filtered or unexported fields
}
type HTTPClientOptions ¶
type HTTPClientOptions struct { Proxy string `json:"proxy" yaml:"proxy"` // HTTP 代理 DialTimeout int `json:"dial_timeout" yaml:"dial_timeout"` // tcp connect timeout DnsResolveTimeout int `json:"dns_resolve_timeout" yaml:"dns_resolve_timeout"` TLSHandshakeTimeout int `json:"tls_handshake_timeout" yaml:"tls_handshake_timeout"` ReadTimeout int `json:"read_timeout" yaml:"read_timeout"` // http read timeout IdleConnTimeout int `json:"idle_conn_timeout" yaml:"idle_conn_timeout"` MaxConnsPerHost int `json:"max_conns_per_host" yaml:"max_conns_per_host"` MaxIdleConns int `json:"max_idle_conns" yaml:"max_idle_conns"` TLSSkipVerify bool `json:"tls_skip_verify" yaml:"tls_skip_verify"` // 是否验证证书 TLSMinVersion uint16 `json:"tls_min_version" yaml:"tls_min_version"` // ssl / tls 版本号 TLSMaxVersion uint16 `json:"tls_max_version" yaml:"tls_max_version"` PKCS12 PKCS12Config `json:"pkcs12" yaml:"pkcs12"` EnableHTTP2 bool `json:"enable_http2" yaml:"enable_http2"` EnableGMTLS bool PreferGM bool OnlyGM bool DnsServers []string HostMapping map[string]string ClientCerts []*ClientCertificationPair }
func NewDefaultClientOptions ¶
func NewDefaultClientOptions() *HTTPClientOptions
type HTTPRoundTripHandler ¶
round trip
type Hijacker ¶
type Hijacker struct {
// contains filtered or unexported fields
}
func GetDefaultHijacker ¶
func GetDefaultHijacker() *Hijacker
func GetHijacker ¶
func GetOrCreateHijacker ¶
func (*Hijacker) FinishCurrentHijackingRequest ¶
func (*Hijacker) GetCurrentHijackingRequest ¶
func (*Hijacker) GetHijackingRequest ¶
func (*Hijacker) GetHijackingRequestById ¶
type MITMConfig ¶
type MITMConfig func(server *MITMServer) error
config
func MITM_AppendDNSServers ¶
func MITM_AppendDNSServers(servers ...string) MITMConfig
func MITM_MergeOptions ¶
func MITM_MergeOptions(b ...MITMConfig) MITMConfig
func MITM_MutualTLSClient ¶
func MITM_MutualTLSClient(crt, key []byte, cas ...[]byte) MITMConfig
func MITM_ProxyAuth ¶
func MITM_ProxyAuth(username string, password string) MITMConfig
func MITM_SetCaCertAndPrivKey ¶
func MITM_SetCaCertAndPrivKey(ca []byte, key []byte) MITMConfig
func MITM_SetDNSServers ¶
func MITM_SetDNSServers(servers ...string) MITMConfig
func MITM_SetDownstreamProxy ¶
func MITM_SetDownstreamProxy(s string) MITMConfig
func MITM_SetForceTextFrame ¶
func MITM_SetForceTextFrame(t bool) MITMConfig
func MITM_SetGM ¶
func MITM_SetGM(b bool) MITMConfig
func MITM_SetGMOnly ¶
func MITM_SetGMOnly(b bool) MITMConfig
func MITM_SetGMPrefer ¶
func MITM_SetGMPrefer(b bool) MITMConfig
func MITM_SetHTTP2 ¶
func MITM_SetHTTP2(b bool) MITMConfig
func MITM_SetHTTPRequestMirror ¶
func MITM_SetHTTPRequestMirror(f func(isHttps bool, req *http.Request)) MITMConfig
func MITM_SetHTTPRequestMirrorRaw ¶
func MITM_SetHTTPRequestMirrorRaw(f func(isHttps bool, raw []byte)) MITMConfig
func MITM_SetHTTPResponseMirrorRaw ¶
func MITM_SetHTTPResponseMirrorRaw(f func(isHttps bool, req, rsp []byte, remoteAddr string)) MITMConfig
func MITM_SetHijackedMaxContentLength ¶
func MITM_SetHijackedMaxContentLength(i int) MITMConfig
func MITM_SetHostMapping ¶ added in v1.2.3
func MITM_SetHostMapping(m map[string]string) MITMConfig
func MITM_SetLowerHeader ¶
func MITM_SetLowerHeader(c ...string) MITMConfig
func MITM_SetTransparentHijackHTTPRequest ¶
func MITM_SetTransparentHijackHTTPRequest(f MITMTransparentHijackHTTPRequestFunc) MITMConfig
func MITM_SetTransparentHijackHTTPResponse ¶
func MITM_SetTransparentHijackHTTPResponse(f MITMTransparentHijackHTTPResponseFunc) MITMConfig
func MITM_SetTransparentHijackMode ¶
func MITM_SetTransparentHijackMode(t bool) MITMConfig
func MITM_SetTransparentHijackRequest ¶
func MITM_SetTransparentHijackRequest(f MITMTransparentHijackFunc) MITMConfig
func MITM_SetTransparentHijackRequestManager ¶
func MITM_SetTransparentHijackRequestManager(m *TransparentHijackManager) MITMConfig
func MITM_SetTransparentHijackResponse ¶
func MITM_SetTransparentHijackResponse(f MITMTransparentHijackFunc) MITMConfig
func MITM_SetTransparentHijackedMirror ¶
func MITM_SetTransparentHijackedMirror(f MITMTransparentMirrorFunc) MITMConfig
func MITM_SetTransparentHijackedMirrorHTTP ¶
func MITM_SetTransparentHijackedMirrorHTTP(f MITMTransparentMirrorHTTPFunc) MITMConfig
func MITM_SetTransparentMirror ¶
func MITM_SetTransparentMirror(f MITMTransparentMirrorFunc) MITMConfig
func MITM_SetTransparentMirrorHTTP ¶
func MITM_SetTransparentMirrorHTTP(f MITMTransparentMirrorHTTPFunc) MITMConfig
func MITM_SetTransport ¶
func MITM_SetTransport(tr *http.Transport) MITMConfig
func MITM_SetTransportByHTTPClientOptions ¶
func MITM_SetTransportByHTTPClientOptions(client *HTTPClientOptions) (MITMConfig, error)
func MITM_SetVia ¶
func MITM_SetVia(s string) MITMConfig
func MITM_SetWebsocketHijackMode ¶
func MITM_SetWebsocketHijackMode(t bool) MITMConfig
func MITM_SetWebsocketRequestMirrorRaw ¶
func MITM_SetWebsocketRequestMirrorRaw(f func(req []byte)) MITMConfig
func MITM_SetWebsocketResponseMirrorRaw ¶
func MITM_SetWebsocketResponseMirrorRaw(f func(req []byte)) MITMConfig
func MITM_SetXForwarded ¶
func MITM_SetXForwarded(b bool) MITMConfig
type MITMServer ¶
type MITMServer struct { DNSServers []string HostMapping map[string]string // contains filtered or unexported fields }
func NewMITMServer ¶
func NewMITMServer(options ...MITMConfig) (*MITMServer, error)
func (*MITMServer) Configure ¶
func (m *MITMServer) Configure(options ...MITMConfig) error
func (*MITMServer) GetCaCert ¶
func (m *MITMServer) GetCaCert() []byte
func (*MITMServer) GetMartianProxy ¶
func (m *MITMServer) GetMartianProxy() *martian.Proxy
func (*MITMServer) GetRemoteAddr ¶
func (s *MITMServer) GetRemoteAddr(isHttps bool, host string) string
func (*MITMServer) GetRemoteAddrRaw ¶
func (s *MITMServer) GetRemoteAddrRaw(host string) string
func (*MITMServer) ServeTransparentTLS ¶
func (m *MITMServer) ServeTransparentTLS(ctx context.Context, addr string) error
type PKCS12Config ¶
type TransparentHijackManager ¶
type TransparentHijackManager struct {
// contains filtered or unexported fields
}
func NewTransparentHijackManager ¶
func NewTransparentHijackManager() *TransparentHijackManager
func (*TransparentHijackManager) Hijacked ¶
func (t *TransparentHijackManager) Hijacked(isHttps bool, req []byte) []byte
func (*TransparentHijackManager) List ¶
func (t *TransparentHijackManager) List() []string
func (*TransparentHijackManager) RemoveByHash ¶
func (t *TransparentHijackManager) RemoveByHash(h string)
func (*TransparentHijackManager) SetHijackRequestForHost ¶
func (t *TransparentHijackManager) SetHijackRequestForHost( re string, requsetFunc MITMTransparentHijackFunc, ) error
func (*TransparentHijackManager) SetHijackRequestForPath ¶
func (t *TransparentHijackManager) SetHijackRequestForPath( re string, requestFunc MITMTransparentHijackFunc, ) error
type WebSocketModifier ¶
type WebSocketModifier struct { ProxyStr string TR *http.Transport ProxyGetter func() *martian.Proxy RequestHijackCallback func(req *http.Request) error // contains filtered or unexported fields }
func (*WebSocketModifier) ModifyRequest ¶
func (w *WebSocketModifier) ModifyRequest(req *http.Request) error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.