config

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConfig

type ClientConfig struct {
	Server    string         `yaml:"server"`
	UUID      string         `yaml:"uuid"`
	Domains   []string       `yaml:"domains"`
	Settings  ClientSettings `yaml:"settings"`
	Transport string         `yaml:"transport"`  // "mtp" (default) or "tcp"
	LocalPort int            `yaml:"local_port"` // Deprecated: SOCKS5 proxy port (default 1080). Use Proxies instead.
	Proxies   []ProxyConfig  `yaml:"proxies"`    // List of local proxies to start (e.g. socks5, http)
	DNS       string         `yaml:"dns"`        // Custom DNS resolver (e.g. 1.1.1.1:53)
	Routing   RoutingConfig  `yaml:"routing"`    // Routing rules
}

ClientConfig defines the configuration for the Mimic Client

func LoadClientConfig

func LoadClientConfig(path string) (*ClientConfig, error)

LoadClientConfig reads and parses the client configuration file

type ClientSettings

type ClientSettings struct {
	SwitchTimeRangeStr string `yaml:"switch_time"` // e.g. "60s-300s"
	Randomize          bool   `yaml:"randomize"`

	// Parsed values (internal use)
	SwitchMin time.Duration `yaml:"-"`
	SwitchMax time.Duration `yaml:"-"`
}

type ProxyConfig

type ProxyConfig struct {
	Type string `yaml:"type"` // "socks5", "http"
	Port int    `yaml:"port"` // Listen port
}

ProxyConfig defines a local proxy endpoint

type RoutingConfig

type RoutingConfig struct {
	DefaultPolicy string        `yaml:"default_policy"` // "proxy" (default) or "direct" or "block"
	Rules         []RoutingRule `yaml:"rules"`
}

RoutingConfig defines routing engine rules for the client

type RoutingRule

type RoutingRule struct {
	Type   string `yaml:"type"`   // "domain_suffix", "domain_keyword", "ip_cidr"
	Value  string `yaml:"value"`  // e.g. "google.com" or "192.168.0.0/16"
	Policy string `yaml:"policy"` // "proxy", "direct", "block"
}

RoutingRule defines a single rule

type ServerConfig

type ServerConfig struct {
	Port        int      `yaml:"port"`
	UUID        string   `yaml:"uuid"`
	DomainList  []string `yaml:"domain_list"`
	DomainsFile string   `yaml:"domains_file"`
	PresetsDir  string   `yaml:"presets_dir"`
	MaxClients  int      `yaml:"max_clients"`
	RateLimit   int      `yaml:"rate_limit"`
	Transport   string   `yaml:"transport"` // "mtp" (default) or "tcp"
	DNS         string   `yaml:"dns"`       // Custom DNS resolver (e.g. 1.1.1.1:53)
}

ServerConfig defines the configuration for the Mimic Server

func LoadServerConfig

func LoadServerConfig(path string) (*ServerConfig, error)

LoadServerConfig reads and parses the server configuration file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL