Documentation
¶
Index ¶
- Variables
- func Background() context.Context
- func CancelGlobalContext()
- func CancelLogWaiters()
- func GetBrowserFingerprintJSON(userAgent string) (string, error)
- func GetSupportedBrowsers() []string
- func GetSupportedBrowsersForPython() []string
- func GetSupportedVersions(browserName string) []int
- func GetSupportedVersionsForPython(browserName string) []int
- func NewContext() context.Context
- func NewLogger(cb func(line string)) zerolog.Logger
- func NewLoggerWithID(id string) zerolog.Logger
- func NewLoggerWithIDAndLevel(id string, level zerolog.Level) zerolog.Logger
- func NewLoggerWithLevel(level zerolog.Level, cb func(line string)) zerolog.Logger
- func ParseDuration(s string) (time.Duration, error)
- func SetLoggerGlobalLevel(level zerolog.Level)
- type BasicAuth
- type BrowserFingerprint
- type BrowserInfo
- type BufferedMITMConn
- type CertManager
- type ChunkedWriter
- type Config
- type ContextWithCancel
- type HTTP2Fingerprint
- type LogEntry
- type Manager
- type PayloadInjector
- type Server
- type ServerHandle
- func (h *ServerHandle) Addr() string
- func (h *ServerHandle) Close() error
- func (h *ServerHandle) GetCAPEM() []byte
- func (h *ServerHandle) ResetSessions() int
- func (h *ServerHandle) SetUpstreamProxy(proxyURL string) error
- func (h *ServerHandle) Start() error
- func (h *ServerHandle) StartBackground() error
- func (h *ServerHandle) Stop() error
- type ServerOption
Constants ¶
This section is empty.
Variables ¶
var ( Nanosecond = time.Nanosecond Microsecond = time.Microsecond Millisecond = time.Millisecond Second = time.Second Minute = time.Minute Hour = time.Hour )
var ( LevelTrace = zerolog.TraceLevel LevelDebug = zerolog.DebugLevel LevelInfo = zerolog.InfoLevel LevelWarn = zerolog.WarnLevel LevelError = zerolog.ErrorLevel LevelFatal = zerolog.FatalLevel LevelPanic = zerolog.PanicLevel )
Zerolog level constants for Python bindings
var ( Version = "v1.1.2" Platform = runtime.GOOS + "/" + runtime.GOARCH )
Functions ¶
func Background ¶ added in v1.0.8
Background returns a process-wide background context.
func CancelGlobalContext ¶ added in v1.0.8
func CancelGlobalContext()
CancelGlobalContext cancels the global background context.
func CancelLogWaiters ¶ added in v1.0.10
func CancelLogWaiters()
CancelLogWaiters cancels all waiting log listeners
func GetBrowserFingerprintJSON ¶ added in v1.0.8
GetBrowserFingerprintJSON returns a JSON string describing the fingerprint.
func GetSupportedBrowsers ¶
func GetSupportedBrowsers() []string
GetSupportedBrowsers returns list of supported browsers
func GetSupportedBrowsersForPython ¶ added in v1.0.8
func GetSupportedBrowsersForPython() []string
GetSupportedBrowsersForPython returns the list of supported browser names.
func GetSupportedVersions ¶
GetSupportedVersions returns list of supported versions for specified browser
func GetSupportedVersionsForPython ¶ added in v1.0.8
GetSupportedVersionsForPython returns the supported major versions for a browser.
func NewContext ¶ added in v1.0.8
NewContext returns a new background-derived context.
func NewLoggerWithID ¶ added in v1.0.10
NewLoggerWithID creates a new zerolog.Logger that tags output with the given ID
func NewLoggerWithIDAndLevel ¶ added in v1.0.10
NewLoggerWithIDAndLevel creates a new zerolog.Logger with specified level that tags output with the given ID
func NewLoggerWithLevel ¶ added in v1.0.10
NewLoggerWithLevel creates a new zerolog.Logger with auto-generated ID and specified level
func ParseDuration ¶ added in v1.0.8
ParseDuration parses a duration string (e.g. "300ms", "2h45m").
func SetLoggerGlobalLevel ¶ added in v1.0.10
SetLoggerGlobalLevel sets the global log level for all loggers
Types ¶
type BasicAuth ¶
type BasicAuth struct {
// contains filtered or unexported fields
}
BasicAuth handles HTTP Basic Authentication for proxy
func NewBasicAuth ¶
NewBasicAuth creates a new basic auth handler
func (*BasicAuth) GetAuthRequiredResponse ¶
GetAuthRequiredResponse returns HTTP 407 response for auth required
type BrowserFingerprint ¶
BrowserFingerprint contains complete browser fingerprint
func GetBrowserFingerprint ¶
func GetBrowserFingerprint(userAgent string) (*BrowserFingerprint, error)
GetBrowserFingerprint gets complete browser fingerprint from User-Agent
type BrowserInfo ¶
BrowserInfo contains browser information
func ParseUserAgent ¶
func ParseUserAgent(userAgent string) (*BrowserInfo, error)
ParseUserAgent parses User-Agent string
type BufferedMITMConn ¶ added in v1.0.6
BufferedMITMConn wraps a connection with a buffered reader for protocol detection
type CertManager ¶
type CertManager struct {
// contains filtered or unexported fields
}
CertManager manages certificate generation for MITM
func NewCertManager ¶
func NewCertManager() (*CertManager, error)
NewCertManager creates a new certificate manager
func NewCertManagerFromFiles ¶ added in v1.0.17
func NewCertManagerFromFiles(certFile, keyFile string) (*CertManager, error)
NewCertManagerFromFiles creates a certificate manager and loads the CA certificate/key from disk when possible. If files are missing, it generates a new CA and persists it to the provided paths.
func (*CertManager) GetCACert ¶
func (cm *CertManager) GetCACert() []byte
GetCACert returns the DER-encoded CA certificate bytes.
func (*CertManager) GetCACertDER ¶ added in v1.0.8
func (cm *CertManager) GetCACertDER() []byte
GetCACertDER returns the DER-encoded CA certificate bytes.
func (*CertManager) GetCACertPEM ¶ added in v1.0.8
func (cm *CertManager) GetCACertPEM() []byte
GetCACertPEM returns the PEM-encoded CA certificate.
func (*CertManager) GetCertificate ¶
func (cm *CertManager) GetCertificate(hostname string) (*tls.Certificate, error)
GetCertificate returns a certificate for the given hostname
type ChunkedWriter ¶ added in v1.0.6
type ChunkedWriter struct {
// contains filtered or unexported fields
}
ChunkedWriter is a helper to wrap a net.Conn to write in chunked encoding format.
func NewChunkedWriter ¶ added in v1.0.6
func NewChunkedWriter(conn net.Conn, useChunked bool) *ChunkedWriter
NewChunkedWriter creates a new ChunkedWriter.
func (*ChunkedWriter) Close ¶ added in v1.0.6
func (cw *ChunkedWriter) Close() error
Close finalizes the stream. For chunked encoding, it writes the final zero-length chunk. This is implicitly called by io.Copy when the source reader returns EOF.
type Config ¶
type Config struct {
Addr string
Port string
UserAgent string
Payload string
UpstreamProxy string
Username string
Password string
CertFile string
KeyFile string
Verbose int
Logger *zerolog.Logger // Custom logger for Python bindings
}
Config holds the proxy server configuration
type ContextWithCancel ¶ added in v1.0.8
type ContextWithCancel struct {
// contains filtered or unexported fields
}
ContextWithCancel wraps a context and its cancel function.
func NewContextWithCancel ¶ added in v1.0.8
func NewContextWithCancel() *ContextWithCancel
NewContextWithCancel creates a new cancellable context.
func (*ContextWithCancel) Cancel ¶ added in v1.0.8
func (c *ContextWithCancel) Cancel()
Cancel cancels the underlying context.
func (*ContextWithCancel) Context ¶ added in v1.0.8
func (c *ContextWithCancel) Context() context.Context
Context returns the underlying context.
type HTTP2Fingerprint ¶
type HTTP2Fingerprint struct {
Settings string
WindowUpdate string
Priority string
PseudoHeader string
}
HTTP2Fingerprint contains HTTP/2 fingerprint configuration
type LogEntry ¶ added in v1.0.10
LogEntry represents a single log entry with metadata
func GetLogEntries ¶ added in v1.0.10
func GetLogEntries() []LogEntry
GetLogEntries returns and clears log entries from the buffer
func WaitForLogEntries ¶ added in v1.0.10
WaitForLogEntries waits for new log entries with timeout (in milliseconds) Returns log entries when available, or nil on timeout If timeoutMs is 0, waits indefinitely
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages all azuretls sessions
func NewManagerWithLogger ¶ added in v1.0.10
NewManagerWithLogger creates a new session manager with custom logger
func (*Manager) GetSession ¶
GetSession gets or creates session based on configuration
func (*Manager) GetSessionCount ¶
GetSessionCount returns current session count
type PayloadInjector ¶
type PayloadInjector struct {
// contains filtered or unexported fields
}
PayloadInjector handles JavaScript payload injection into responses
func NewPayloadInjector ¶
func NewPayloadInjector(payload string) *PayloadInjector
NewPayloadInjector creates a new payload injector
func (*PayloadInjector) InjectIntoResponse ¶
func (p *PayloadInjector) InjectIntoResponse(body []byte, contentType string) []byte
InjectIntoResponse injects payload into HTTP response based on content type
func (*PayloadInjector) PrependToBuffer ¶
func (p *PayloadInjector) PrependToBuffer(buf *bytes.Buffer, contentType string)
PrependToBuffer prepends payload to buffer for streaming responses
func (*PayloadInjector) ShouldInject ¶
func (p *PayloadInjector) ShouldInject(contentType string) bool
ShouldInject checks if payload should be injected based on content type
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the MaskTunnel proxy server
func (*Server) ActualAddr ¶ added in v1.0.16
ActualAddr returns the actual listening address (host:port). This is useful when port 0 is specified to get the OS-assigned port.
type ServerHandle ¶ added in v1.0.8
type ServerHandle struct {
// contains filtered or unexported fields
}
ServerHandle wraps *Server for Python. Note: gopy doesn't like interfaces or embedded complex fields; keep it simple.
func NewServerHandle ¶ added in v1.0.8
func NewServerHandle(opt *ServerOption) *ServerHandle
NewServerHandle creates a new server handle.
func (*ServerHandle) Addr ¶ added in v1.0.8
func (h *ServerHandle) Addr() string
Addr returns the effective listen address (host:port). If the server has started, returns the actual bound address. Otherwise, returns the configured address.
func (*ServerHandle) Close ¶ added in v1.0.8
func (h *ServerHandle) Close() error
Close is an alias of Stop.
func (*ServerHandle) GetCAPEM ¶ added in v1.0.8
func (h *ServerHandle) GetCAPEM() []byte
GetCAPEM returns the in-memory CA certificate in PEM format.
func (*ServerHandle) ResetSessions ¶ added in v1.0.8
func (h *ServerHandle) ResetSessions() int
ResetSessions closes all cached TLS sessions.
func (*ServerHandle) SetUpstreamProxy ¶ added in v1.0.8
func (h *ServerHandle) SetUpstreamProxy(proxyURL string) error
SetUpstreamProxy sets the upstream proxy and resets sessions.
func (*ServerHandle) Start ¶ added in v1.0.8
func (h *ServerHandle) Start() error
Start starts the proxy server (blocking).
func (*ServerHandle) StartBackground ¶ added in v1.0.16
func (h *ServerHandle) StartBackground() error
StartBackground starts the proxy server in a background goroutine. It waits until the server is ready to accept connections, then returns. The actual listening address can be retrieved via Addr() after this returns.
func (*ServerHandle) Stop ¶ added in v1.0.8
func (h *ServerHandle) Stop() error
Stop stops the proxy server.
type ServerOption ¶ added in v1.0.8
type ServerOption struct {
Addr string
Port string
UserAgent string
Payload string
UpstreamProxy string
Username string
Password string
Verbose int
// contains filtered or unexported fields
}
ServerOption describes server configuration for bindings. Keep fields as basic types to ensure gopy can map them.
func DefaultServerOption ¶ added in v1.0.8
func DefaultServerOption() *ServerOption
DefaultServerOption returns default options.
func (*ServerOption) WithLogger ¶ added in v1.0.10
func (opt *ServerOption) WithLogger(logger zerolog.Logger)
WithLogger sets a custom logger for the server.