Documentation
¶
Index ¶
- Constants
- func GenerateMimicURL(cfg *ClientConfig) string
- type AndroidConfig
- type ClientConfig
- type ClientSettings
- type CompressionConfig
- type CustomPresetConfig
- type DomainEntry
- type ProxyConfig
- type RangeInt
- type RoutingConfig
- type RoutingRule
- type ServerConfig
- type TrafficPattern
- type WebSocketConfig
Constants ¶
const SchemeMimic = "mimic"
Variables ¶
This section is empty.
Functions ¶
func GenerateMimicURL ¶ added in v0.3.1
func GenerateMimicURL(cfg *ClientConfig) string
GenerateMimicURL generates a mimic:// URI from full ClientConfig.
Types ¶
type AndroidConfig ¶ added in v0.3.5
type AndroidConfig struct {
// EnableTUN enables Android TUN backend (requires VpnService)
EnableTUN bool
// TUNFD is the TUN file descriptor from VpnService (optional, set at runtime)
TUNFD int
// MTU for TUN interface (default: 1500)
MTU int
// UseProtectedSockets enables socket protection via VpnService.protect()
UseProtectedSockets bool
}
AndroidConfig represents Android-specific configuration
type ClientConfig ¶
type ClientConfig struct {
Server string // Server address (IP:PORT)
UUID string // Unique authorization identifier
Domains []DomainEntry // List of domains for masking (with optional preset)
Transport string // Transport type: "mtp", "tcp", "ws", "wss"
Proxies []ProxyConfig // Local proxy server settings
DNS string // Custom DNS server
Settings ClientSettings // Fine-tuning settings
Routing RoutingConfig // Routing rules
ServerName string // Server name from URL
LocalPort int // Local proxy port (for backward compatibility)
Android AndroidConfig // Android-specific configuration
Compression CompressionConfig // Data compression settings
CustomPresets map[string]CustomPresetConfig // Custom traffic presets
WebSocket WebSocketConfig // WebSocket-specific configuration
}
ClientConfig represents the client configuration
func LoadClientConfig ¶
func LoadClientConfig(path string) (*ClientConfig, error)
LoadClientConfig loads client configuration from YAML file
func ParseMimicURL ¶ added in v0.3.1
func ParseMimicURL(uri string) (*ClientConfig, error)
ParseMimicURL parses a mimic:// URI into a ClientConfig. Format: mimic://<uuid>@<server_ip>:<port>?domains=d1,d2&transport=mtp&dns=8.8.8.8:53 Extended format: mimic://<uuid>@<server_ip>:<port>?domains=d1:preset1,d2:preset2&transport=mtp&dns=8.8.8.8:53&compression=true&compression_level=2&switch_time=60s-300s&randomize=true
type ClientSettings ¶
type ClientSettings struct {
SwitchTimeRangeStr string // Time range for domain switching (e.g., "60s-300s")
SwitchMin time.Duration // Minimum switch interval
SwitchMax time.Duration // Maximum switch interval
Randomize bool // Randomize domain order
}
ClientSettings represents fine-tuning settings
type CompressionConfig ¶ added in v0.3.5
type CompressionConfig struct {
// Enable enables/disables compression (default: false)
Enable bool `yaml:"enable"`
// Level is the compression level (1-3): 1=Fastest, 2=Default, 3=Better
Level int `yaml:"level"`
// MinSize is the minimum size to attempt compression (default: 64 bytes)
MinSize int `yaml:"min_size"`
}
CompressionConfig represents data compression settings
func DefaultCompressionConfig ¶ added in v0.3.5
func DefaultCompressionConfig() CompressionConfig
DefaultCompressionConfig returns default compression settings
type CustomPresetConfig ¶ added in v0.3.5
type CustomPresetConfig struct {
Name string `yaml:"name"`
Type string `yaml:"type"`
PacketSize RangeInt `yaml:"packet_size"`
PacketsPerSecond RangeInt `yaml:"packets_per_sec"`
UploadDownloadRatio float64 `yaml:"upload_download_ratio"`
SessionDuration string `yaml:"session_duration"`
Patterns []TrafficPattern `yaml:"patterns,omitempty"`
}
CustomPresetConfig represents a custom traffic preset configuration
type DomainEntry ¶ added in v0.3.5
type DomainEntry struct {
Domain string `yaml:"domain" json:"domain"` // Domain name
Preset string `yaml:"preset" json:"preset"` // Preset name (optional, empty = auto-detect)
}
DomainEntry represents a domain with optional preset
type ProxyConfig ¶
ProxyConfig represents local proxy configuration
type RangeInt ¶ added in v0.3.5
RangeInt represents a min-max integer range (shared with presets package)
type RoutingConfig ¶
type RoutingConfig struct {
DefaultPolicy string // Default policy: "proxy", "direct", "block"
Rules []RoutingRule // Routing rules
}
RoutingConfig represents routing configuration
type RoutingRule ¶
type RoutingRule struct {
Type string // Rule type: "domain_suffix", "domain_keyword", "ip_cidr"
Value string // Rule value (domain, keyword, or CIDR)
Policy string // Policy: "proxy", "direct", "block"
}
RoutingRule represents a single routing rule
type ServerConfig ¶
type ServerConfig struct {
Port int // Listening port
MaxClients int // Maximum number of clients
UUID string // Server UUID for authentication
DomainList []DomainEntry // List of domains for masking (with optional preset)
Transport string // Transport type: "mtp", "tcp", "ws", "wss"
DNS string // DNS server
Name string // Server name
Compression CompressionConfig // Data compression settings
WebSocket WebSocketConfig // WebSocket-specific configuration
}
ServerConfig represents the server configuration
func LoadServerConfig ¶
func LoadServerConfig(path string) (*ServerConfig, error)
LoadServerConfig loads server configuration from YAML file
type TrafficPattern ¶ added in v0.3.5
type TrafficPattern struct {
Type string `yaml:"type"`
Duration string `yaml:"duration"`
Interval string `yaml:"interval"`
}
TrafficPattern represents a traffic pattern (shared with presets package)
type WebSocketConfig ¶ added in v0.3.5
type WebSocketConfig struct {
// Path is the URL path for WebSocket endpoint (default: "/ws")
Path string `yaml:"path"`
// Host is the Host header value for masquerading (optional)
Host string `yaml:"host"`
// TLS enables WSS (WebSocket over TLS) (default: false)
TLS bool `yaml:"tls"`
}
WebSocketConfig represents WebSocket-specific configuration
func DefaultWebSocketConfig ¶ added in v0.3.5
func DefaultWebSocketConfig() WebSocketConfig
DefaultWebSocketConfig returns default WebSocket settings