Documentation
¶
Index ¶
- Variables
- func Init(dir string) error
- type Config
- type Controller
- type Cors
- type DNS
- type Experimental
- type General
- type GeoXUrl
- type IPTables
- type Inbound
- type NTP
- type Profile
- type RawClashForAndroid
- type RawConfig
- type RawCors
- type RawDNS
- type RawExperimental
- type RawFallbackFilter
- type RawGeoXUrl
- type RawIPTables
- type RawNTP
- type RawProfile
- type RawSniffer
- type RawSniffingConfig
- type RawTLS
- type RawTuicServer
- type RawTun
- type TLS
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Config ¶
type Config struct { General *General Controller *Controller Experimental *Experimental IPTables *IPTables NTP *NTP DNS *DNS Hosts *trie.DomainTrie[resolver.HostValue] Profile *Profile Rules []C.Rule SubRules map[string][]C.Rule Users []auth.AuthUser Proxies map[string]C.Proxy Listeners map[string]C.InboundListener Providers map[string]providerTypes.ProxyProvider RuleProviders map[string]providerTypes.RuleProvider Tunnels []LC.Tunnel Sniffer *sniffer.Config TLS *TLS }
Config is mihomo config manager
func ParseRawConfig ¶ added in v1.17.0
type Controller ¶ added in v1.17.0
type Controller struct { ExternalController string ExternalControllerTLS string ExternalControllerUnix string ExternalControllerPipe string ExternalUI string ExternalUIURL string ExternalUIName string ExternalDohServer string Secret string Cors Cors }
Controller config
type DNS ¶ added in v1.17.0
type DNS struct { Enable bool PreferH3 bool IPv6 bool IPv6Timeout uint UseSystemHosts bool NameServer []dns.NameServer Fallback []dns.NameServer FallbackIPFilter []C.IpMatcher FallbackDomainFilter []C.DomainMatcher Listen string EnhancedMode C.DNSMode DefaultNameserver []dns.NameServer CacheAlgorithm string FakeIPRange *fakeip.Pool Hosts *trie.DomainTrie[resolver.HostValue] NameServerPolicy []dns.Policy ProxyServerNameserver []dns.NameServer DirectNameServer []dns.NameServer DirectFollowPolicy bool }
DNS config
type Experimental ¶ added in v1.17.0
type Experimental struct { Fingerprints []string QUICGoDisableGSO bool QUICGoDisableECN bool IP4PEnable bool }
Experimental config
type General ¶
type General struct { Inbound Mode T.TunnelMode `json:"mode"` UnifiedDelay bool `json:"unified-delay"` LogLevel log.LogLevel `json:"log-level"` IPv6 bool `json:"ipv6"` Interface string `json:"interface-name"` RoutingMark int `json:"routing-mark"` GeoXUrl GeoXUrl `json:"geox-url"` GeoAutoUpdate bool `json:"geo-auto-update"` GeoUpdateInterval int `json:"geo-update-interval"` GeodataMode bool `json:"geodata-mode"` GeodataLoader string `json:"geodata-loader"` GeositeMatcher string `json:"geosite-matcher"` TCPConcurrent bool `json:"tcp-concurrent"` FindProcessMode P.FindProcessMode `json:"find-process-mode"` Sniffing bool `json:"sniffing"` GlobalClientFingerprint string `json:"global-client-fingerprint"` GlobalUA string `json:"global-ua"` ETagSupport bool `json:"etag-support"` KeepAliveIdle int `json:"keep-alive-idle"` KeepAliveInterval int `json:"keep-alive-interval"` DisableKeepAlive bool `json:"disable-keep-alive"` }
General config
type GeoXUrl ¶ added in v1.17.0
type GeoXUrl struct { GeoIp string `json:"geo-ip"` Mmdb string `json:"mmdb"` ASN string `json:"asn"` GeoSite string `json:"geo-site"` }
GeoXUrl config
type Inbound ¶ added in v1.17.0
type Inbound struct { Port int `json:"port"` SocksPort int `json:"socks-port"` RedirPort int `json:"redir-port"` TProxyPort int `json:"tproxy-port"` MixedPort int `json:"mixed-port"` Tun LC.Tun `json:"tun"` TuicServer LC.TuicServer `json:"tuic-server"` ShadowSocksConfig string `json:"ss-config"` VmessConfig string `json:"vmess-config"` Authentication []string `json:"authentication"` SkipAuthPrefixes []netip.Prefix `json:"skip-auth-prefixes"` LanAllowedIPs []netip.Prefix `json:"lan-allowed-ips"` LanDisAllowedIPs []netip.Prefix `json:"lan-disallowed-ips"` AllowLan bool `json:"allow-lan"` BindAddress string `json:"bind-address"` InboundTfo bool `json:"inbound-tfo"` InboundMPTCP bool `json:"inbound-mptcp"` }
Inbound config
type NTP ¶ added in v1.17.0
type NTP struct { Enable bool Server string Port int Interval int DialerProxy string WriteToSystem bool }
NTP config
type RawClashForAndroid ¶ added in v1.17.0
type RawConfig ¶ added in v1.17.0
type RawConfig struct { Port int `yaml:"port" json:"port"` SocksPort int `yaml:"socks-port" json:"socks-port"` RedirPort int `yaml:"redir-port" json:"redir-port"` TProxyPort int `yaml:"tproxy-port" json:"tproxy-port"` MixedPort int `yaml:"mixed-port" json:"mixed-port"` ShadowSocksConfig string `yaml:"ss-config" json:"ss-config"` VmessConfig string `yaml:"vmess-config" json:"vmess-config"` InboundTfo bool `yaml:"inbound-tfo" json:"inbound-tfo"` InboundMPTCP bool `yaml:"inbound-mptcp" json:"inbound-mptcp"` Authentication []string `yaml:"authentication" json:"authentication"` SkipAuthPrefixes []netip.Prefix `yaml:"skip-auth-prefixes" json:"skip-auth-prefixes"` LanAllowedIPs []netip.Prefix `yaml:"lan-allowed-ips" json:"lan-allowed-ips"` LanDisAllowedIPs []netip.Prefix `yaml:"lan-disallowed-ips" json:"lan-disallowed-ips"` AllowLan bool `yaml:"allow-lan" json:"allow-lan"` BindAddress string `yaml:"bind-address" json:"bind-address"` Mode T.TunnelMode `yaml:"mode" json:"mode"` UnifiedDelay bool `yaml:"unified-delay" json:"unified-delay"` LogLevel log.LogLevel `yaml:"log-level" json:"log-level"` IPv6 bool `yaml:"ipv6" json:"ipv6"` ExternalController string `yaml:"external-controller" json:"external-controller"` ExternalControllerPipe string `yaml:"external-controller-pipe" json:"external-controller-pipe"` ExternalControllerUnix string `yaml:"external-controller-unix" json:"external-controller-unix"` ExternalControllerTLS string `yaml:"external-controller-tls" json:"external-controller-tls"` ExternalControllerCors RawCors `yaml:"external-controller-cors" json:"external-controller-cors"` ExternalUI string `yaml:"external-ui" json:"external-ui"` ExternalUIURL string `yaml:"external-ui-url" json:"external-ui-url"` ExternalUIName string `yaml:"external-ui-name" json:"external-ui-name"` ExternalDohServer string `yaml:"external-doh-server" json:"external-doh-server"` Secret string `yaml:"secret" json:"secret"` Interface string `yaml:"interface-name" json:"interface-name"` RoutingMark int `yaml:"routing-mark" json:"routing-mark"` Tunnels []LC.Tunnel `yaml:"tunnels" json:"tunnels"` GeoAutoUpdate bool `yaml:"geo-auto-update" json:"geo-auto-update"` GeoUpdateInterval int `yaml:"geo-update-interval" json:"geo-update-interval"` GeodataMode bool `yaml:"geodata-mode" json:"geodata-mode"` GeodataLoader string `yaml:"geodata-loader" json:"geodata-loader"` GeositeMatcher string `yaml:"geosite-matcher" json:"geosite-matcher"` TCPConcurrent bool `yaml:"tcp-concurrent" json:"tcp-concurrent"` FindProcessMode P.FindProcessMode `yaml:"find-process-mode" json:"find-process-mode"` GlobalClientFingerprint string `yaml:"global-client-fingerprint" json:"global-client-fingerprint"` GlobalUA string `yaml:"global-ua" json:"global-ua"` ETagSupport bool `yaml:"etag-support" json:"etag-support"` KeepAliveIdle int `yaml:"keep-alive-idle" json:"keep-alive-idle"` KeepAliveInterval int `yaml:"keep-alive-interval" json:"keep-alive-interval"` DisableKeepAlive bool `yaml:"disable-keep-alive" json:"disable-keep-alive"` ProxyProvider map[string]map[string]any `yaml:"proxy-providers" json:"proxy-providers"` RuleProvider map[string]map[string]any `yaml:"rule-providers" json:"rule-providers"` Proxy []map[string]any `yaml:"proxies" json:"proxies"` ProxyGroup []map[string]any `yaml:"proxy-groups" json:"proxy-groups"` Rule []string `yaml:"rules" json:"rule"` SubRules map[string][]string `yaml:"sub-rules" json:"sub-rules"` Listeners []map[string]any `yaml:"listeners" json:"listeners"` Hosts map[string]any `yaml:"hosts" json:"hosts"` DNS RawDNS `yaml:"dns" json:"dns"` NTP RawNTP `yaml:"ntp" json:"ntp"` Tun RawTun `yaml:"tun" json:"tun"` TuicServer RawTuicServer `yaml:"tuic-server" json:"tuic-server"` IPTables RawIPTables `yaml:"iptables" json:"iptables"` Experimental RawExperimental `yaml:"experimental" json:"experimental"` Profile RawProfile `yaml:"profile" json:"profile"` GeoXUrl RawGeoXUrl `yaml:"geox-url" json:"geox-url"` Sniffer RawSniffer `yaml:"sniffer" json:"sniffer"` TLS RawTLS `yaml:"tls" json:"tls"` ClashForAndroid RawClashForAndroid `yaml:"clash-for-android" json:"clash-for-android"` }
func DefaultRawConfig ¶ added in v1.18.8
func DefaultRawConfig() *RawConfig
func UnmarshalRawConfig ¶ added in v1.17.0
type RawDNS ¶ added in v1.17.0
type RawDNS struct { Enable bool `yaml:"enable" json:"enable"` PreferH3 bool `yaml:"prefer-h3" json:"prefer-h3"` IPv6 bool `yaml:"ipv6" json:"ipv6"` IPv6Timeout uint `yaml:"ipv6-timeout" json:"ipv6-timeout"` UseHosts bool `yaml:"use-hosts" json:"use-hosts"` UseSystemHosts bool `yaml:"use-system-hosts" json:"use-system-hosts"` RespectRules bool `yaml:"respect-rules" json:"respect-rules"` NameServer []string `yaml:"nameserver" json:"nameserver"` Fallback []string `yaml:"fallback" json:"fallback"` FallbackFilter RawFallbackFilter `yaml:"fallback-filter" json:"fallback-filter"` Listen string `yaml:"listen" json:"listen"` EnhancedMode C.DNSMode `yaml:"enhanced-mode" json:"enhanced-mode"` FakeIPRange string `yaml:"fake-ip-range" json:"fake-ip-range"` FakeIPFilter []string `yaml:"fake-ip-filter" json:"fake-ip-filter"` FakeIPFilterMode C.FilterMode `yaml:"fake-ip-filter-mode" json:"fake-ip-filter-mode"` DefaultNameserver []string `yaml:"default-nameserver" json:"default-nameserver"` CacheAlgorithm string `yaml:"cache-algorithm" json:"cache-algorithm"` NameServerPolicy *orderedmap.OrderedMap[string, any] `yaml:"nameserver-policy" json:"nameserver-policy"` ProxyServerNameserver []string `yaml:"proxy-server-nameserver" json:"proxy-server-nameserver"` DirectNameServer []string `yaml:"direct-nameserver" json:"direct-nameserver"` DirectNameServerFollowPolicy bool `yaml:"direct-nameserver-follow-policy" json:"direct-nameserver-follow-policy"` }
type RawExperimental ¶ added in v1.18.8
type RawFallbackFilter ¶ added in v1.17.0
type RawGeoXUrl ¶ added in v1.18.8
type RawIPTables ¶ added in v1.18.8
type RawNTP ¶ added in v1.17.0
type RawNTP struct { Enable bool `yaml:"enable" json:"enable"` Server string `yaml:"server" json:"server"` Port int `yaml:"port" json:"port"` Interval int `yaml:"interval" json:"interval"` DialerProxy string `yaml:"dialer-proxy" json:"dialer-proxy"` WriteToSystem bool `yaml:"write-to-system" json:"write-to-system"` }
type RawProfile ¶ added in v1.18.8
type RawSniffer ¶ added in v1.17.0
type RawSniffer struct { Enable bool `yaml:"enable" json:"enable"` OverrideDest bool `yaml:"override-destination" json:"override-destination"` Sniffing []string `yaml:"sniffing" json:"sniffing"` ForceDomain []string `yaml:"force-domain" json:"force-domain"` SkipSrcAddress []string `yaml:"skip-src-address" json:"skip-src-address"` SkipDstAddress []string `yaml:"skip-dst-address" json:"skip-dst-address"` SkipDomain []string `yaml:"skip-domain" json:"skip-domain"` Ports []string `yaml:"port-whitelist" json:"port-whitelist"` ForceDnsMapping bool `yaml:"force-dns-mapping" json:"force-dns-mapping"` ParsePureIp bool `yaml:"parse-pure-ip" json:"parse-pure-ip"` Sniff map[string]RawSniffingConfig `yaml:"sniff" json:"sniff"` }
type RawSniffingConfig ¶ added in v1.17.0
type RawTuicServer ¶ added in v1.17.0
type RawTuicServer struct { Enable bool `yaml:"enable" json:"enable"` Listen string `yaml:"listen" json:"listen"` Token []string `yaml:"token" json:"token"` Users map[string]string `yaml:"users" json:"users,omitempty"` Certificate string `yaml:"certificate" json:"certificate"` PrivateKey string `yaml:"private-key" json:"private-key"` CongestionController string `yaml:"congestion-controller" json:"congestion-controller,omitempty"` MaxIdleTime int `yaml:"max-idle-time" json:"max-idle-time,omitempty"` AuthenticationTimeout int `yaml:"authentication-timeout" json:"authentication-timeout,omitempty"` ALPN []string `yaml:"alpn" json:"alpn,omitempty"` MaxUdpRelayPacketSize int `yaml:"max-udp-relay-packet-size" json:"max-udp-relay-packet-size,omitempty"` CWND int `yaml:"cwnd" json:"cwnd,omitempty"` }
type RawTun ¶ added in v1.17.0
type RawTun struct { Enable bool `yaml:"enable" json:"enable"` Device string `yaml:"device" json:"device"` Stack C.TUNStack `yaml:"stack" json:"stack"` DNSHijack []string `yaml:"dns-hijack" json:"dns-hijack"` AutoRoute bool `yaml:"auto-route" json:"auto-route"` AutoDetectInterface bool `yaml:"auto-detect-interface"` MTU uint32 `yaml:"mtu" json:"mtu,omitempty"` GSO bool `yaml:"gso" json:"gso,omitempty"` GSOMaxSize uint32 `yaml:"gso-max-size" json:"gso-max-size,omitempty"` //Inet4Address []netip.Prefix `yaml:"inet4-address" json:"inet4-address,omitempty"` Inet6Address []netip.Prefix `yaml:"inet6-address" json:"inet6-address,omitempty"` IPRoute2TableIndex int `yaml:"iproute2-table-index" json:"iproute2-table-index,omitempty"` IPRoute2RuleIndex int `yaml:"iproute2-rule-index" json:"iproute2-rule-index,omitempty"` AutoRedirect bool `yaml:"auto-redirect" json:"auto-redirect,omitempty"` AutoRedirectInputMark uint32 `yaml:"auto-redirect-input-mark" json:"auto-redirect-input-mark,omitempty"` AutoRedirectOutputMark uint32 `yaml:"auto-redirect-output-mark" json:"auto-redirect-output-mark,omitempty"` StrictRoute bool `yaml:"strict-route" json:"strict-route,omitempty"` RouteAddress []netip.Prefix `yaml:"route-address" json:"route-address,omitempty"` RouteAddressSet []string `yaml:"route-address-set" json:"route-address-set,omitempty"` RouteExcludeAddress []netip.Prefix `yaml:"route-exclude-address" json:"route-exclude-address,omitempty"` RouteExcludeAddressSet []string `yaml:"route-exclude-address-set" json:"route-exclude-address-set,omitempty"` IncludeInterface []string `yaml:"include-interface" json:"include-interface,omitempty"` ExcludeInterface []string `yaml:"exclude-interface" json:"exclude-interface,omitempty"` IncludeUID []uint32 `yaml:"include-uid" json:"include-uid,omitempty"` IncludeUIDRange []string `yaml:"include-uid-range" json:"include-uid-range,omitempty"` ExcludeUID []uint32 `yaml:"exclude-uid" json:"exclude-uid,omitempty"` ExcludeUIDRange []string `yaml:"exclude-uid-range" json:"exclude-uid-range,omitempty"` IncludeAndroidUser []int `yaml:"include-android-user" json:"include-android-user,omitempty"` IncludePackage []string `yaml:"include-package" json:"include-package,omitempty"` ExcludePackage []string `yaml:"exclude-package" json:"exclude-package,omitempty"` EndpointIndependentNat bool `yaml:"endpoint-independent-nat" json:"endpoint-independent-nat,omitempty"` UDPTimeout int64 `yaml:"udp-timeout" json:"udp-timeout,omitempty"` FileDescriptor int `yaml:"file-descriptor" json:"file-descriptor"` Inet4RouteAddress []netip.Prefix `yaml:"inet4-route-address" json:"inet4-route-address,omitempty"` Inet6RouteAddress []netip.Prefix `yaml:"inet6-route-address" json:"inet6-route-address,omitempty"` Inet4RouteExcludeAddress []netip.Prefix `yaml:"inet4-route-exclude-address" json:"inet4-route-exclude-address,omitempty"` Inet6RouteExcludeAddress []netip.Prefix `yaml:"inet6-route-exclude-address" json:"inet6-route-exclude-address,omitempty"` }
Click to show internal directories.
Click to hide internal directories.