### Mieru Proxy Configuration Example Source: https://wiki.metacubex.one/en/config/proxies/mieru Example configuration for the Mieru proxy. Ensure to set the server, port, and other parameters according to your network setup. ```yaml proxies: - name: mieru type: mieru server: server port: 2999 port-range: 2090-2099 transport: TCP username: user password: password multiplexing: MULTIPLEXING_LOW traffic-pattern: "" ``` -------------------------------- ### DNS Configuration Example Source: https://wiki.metacubex.one/en/config/dns A comprehensive example of the DNS configuration block, including nameservers, fallback settings, and fake-ip filters. ```yaml dns: enable: true cache-algorithm: arc prefer-h3: false use-hosts: true use-system-hosts: true respect-rules: false listen: 0.0.0.0:1053 ipv6: false default-nameserver: - 223.5.5.5 enhanced-mode: fake-ip fake-ip-range: 198.18.0.1/16 # fake-ip-range6: fdfe:dcba:9876::1/64 fake-ip-filter-mode: blacklist fake-ip-filter: - '*.lan' # fake-ip-ttl: 1 nameserver-policy: '+.arpa': '10.0.0.1' 'rule-set:cn': - https://doh.pub/dns-query - https://dns.alidns.com/dns-query nameserver: - https://doh.pub/dns-query - https://dns.alidns.com/dns-query fallback: - tls://8.8.4.4 - tls://1.1.1.1 proxy-server-nameserver: - https://doh.pub/dns-query proxy-server-nameserver-policy: 'www.yournode.com': '114.114.114.114' fallback-filter: geoip: true geoip-code: CN geosite: - gfw ipcidr: - 240.0.0.0/4 domain: - '+.google.com' - '+.facebook.com' - '+.youtube.com' ``` -------------------------------- ### NTP Configuration Example Source: https://wiki.metacubex.one/en/config/ntp Example configuration for enabling the NTP service, setting the server, port, and synchronization interval. Requires root or administrator privileges if 'write-to-system' is enabled. ```yaml ntp: enable: true write-to-system: true server: time.apple.com port: 123 interval: 30 # dialer-proxy: DIRECT ``` -------------------------------- ### TUN Configuration Example Source: https://wiki.metacubex.one/en/config/inbound/tun A comprehensive example of TUN configuration settings. This includes enabling the TUN, selecting the network stack, and defining various routing and network parameters. ```yaml tun: enable: true stack: system auto-route: true auto-redirect: true auto-detect-interface: true dns-hijack: - any:53 - tcp://any:53 device: utun0 mtu: 9000 strict-route: true gso: true gso-max-size: 65536 inet6-address: "fdfe:dcba:9876::1/126" udp-timeout: 300 iproute2-table-index: 2022 iproute2-rule-index: 9000 endpoint-independent-nat: false route-address-set: - ruleset-1 route-exclude-address-set: - ruleset-2 route-address: - 0.0.0.0/1 - 128.0.0.0/1 - "::/1" - "8000::/1" route-exclude-address: - 192.168.0.0/16 - fc00::/7 include-interface: - eth0 exclude-interface: - eth1 include-uid: - 0 include-uid-range: - 1000:9999 exclude-uid: - 1000 exclude-uid-range: - 1000:9999 include-android-user: - 0 - 10 include-package: - com.android.chrome exclude-package: - com.android.captiveportallogin ``` -------------------------------- ### Proxy Group Configuration Example Source: https://wiki.metacubex.one/en/config/proxy-groups A comprehensive example demonstrating the configuration of a 'proxy' group, including health check settings, filtering, and interface options. ```yaml proxy-groups: - name: "proxy" type: select proxies: - DIRECT - ss use: - provider1 - provider1 url: 'https://www.gstatic.com/generate_204' interval: 300 lazy: true empty-fallback: COMPATIBLE timeout: 5000 max-failed-times: 5 disable-udp: true interface-name: en0 routing-mark: 11451 include-all: false include-all-proxies: false include-all-providers: false filter: "(?i)港|hk|hongkong|hong kong" exclude-filter: "美|日" exclude-type: "Shadowsocks|Http" expected-status: 204 hidden: true icon: xxx ``` -------------------------------- ### API Request Example Source: https://wiki.metacubex.one/en/api Example of a PUT request to update a configuration. Ensure the API key and controller address are correctly set in the configuration. ```bash curl -H 'Authorization: Bearer ${secret}' http://${controller-api}/configs?force=true -d '{"path": "", "payload": ""}' -X PUT ``` -------------------------------- ### Example DNS Configuration Source: https://wiki.metacubex.one/en/config/dns This example demonstrates a DNS configuration with a nameserver that uses a proxy and specifies ECS settings. It also includes a proxy definition. ```yaml dns: nameserver: - 'https://8.8.8.8/dns-query#proxy&ecs=1.1.1.1/24&ecs-override=true' proxies: - name: proxy type: ss ``` -------------------------------- ### Sudoku Proxy Configuration Example Source: https://wiki.metacubex.one/en/config/proxies/sudoku This is a complete example of a Sudoku proxy configuration. It includes server details, encryption method, padding, and HTTP masking settings. ```yaml proxies: - name: sudoku type: sudoku server: 1.2.3.4 port: 443 key: "" aead-method: chacha20-poly1305 padding-min: 2 padding-max: 7 table-type: prefer_ascii # custom-table: xpxvvpvv # custom-tables: ["xpxvvpvv", "vxpvxvvp"] httpmask: disable: false mode: legacy tls: true mask-host: "" path-root: "" multiplex: off enable-pure-downlink: false ``` -------------------------------- ### Retrieve Real-time Logs Source: https://wiki.metacubex.one/en/api Example of retrieving real-time logs using GET or WS. Logs can be filtered by level and formatted as structured output. ```bash GET /logs WS /logs ``` -------------------------------- ### Snell Listener Configuration Example Source: https://wiki.metacubex.one/en/config/inbound/listeners/snell Example configuration for a Snell listener. Ensure 'psk' is set to a strong, unique password. The 'version' parameter supports only 4 or 5. ```yaml listeners: - name: snell-in-1 type: snell port: 10815 # Supports ports format, e.g., 200,302 or 200,204,401-429,501-503 listen: 0.0.0.0 psk: your-password version: 4 # Only supports 4/5 udp: true # UDP over TCP tunnel, default is true # obfs-opts: # mode: http # Optional: http / tls # host: bing.com # rule: sub-rule-name1 # Uses global rules by default; if the sub-rule is not found, it falls back to global rules directly # proxy: proxy # If not empty, the inbound traffic will be handed over to the specified proxy directly (when not empty, the proxy name must be valid, otherwise an error will occur) ``` -------------------------------- ### VLESS Proxy Configuration Example Source: https://wiki.metacubex.one/en/config/proxies/vless A comprehensive example of a VLESS proxy configuration, demonstrating various parameters including server details, UUID, flow control, packet encoding, TLS settings, and network transport. ```yaml proxies: - name: "vless" type: vless server: server port: 443 udp: true uuid: uuid flow: xtls-rprx-vision packet-encoding: xudp tls: true servername: example.com alpn: - h2 - http/1.1 fingerprint: xxxx client-fingerprint: chrome skip-cert-verify: true reality-opts: public-key: xxxx short-id: xxxx encryption: "" network: tcp smux: enabled: false ``` -------------------------------- ### Basic Numbering Example Source: https://wiki.metacubex.one/en/config/proxy-groups/select A simple example demonstrating a sequence of numbers. ```plaintext 1 2 3 4 5 6 7 8 ``` -------------------------------- ### Trojan Proxy Configuration Example Source: https://wiki.metacubex.one/en/config/proxies/trojan A comprehensive example of a Trojan proxy configuration, demonstrating common fields, TLS settings, and advanced options like Shadowsocks and REALITY. ```yaml proxies: - name: "trojan" type: trojan server: server port: 443 password: yourpsk udp: true sni: example.com alpn: - h2 - http/1.1 client-fingerprint: random fingerprint: xxxx skip-cert-verify: true ss-opts: enabled: false method: aes-128-gcm password: "example" reality-opts: public-key: xxxx short-id: xxxx network: tcp smux: enabled: false ``` -------------------------------- ### Basic Dialer Proxy Setup Source: https://wiki.metacubex.one/en/config/proxies/dialer-proxy Establishes network connections through a specified proxy group. In this example, 'ss1' connects through the 'dialer' proxy group, which in turn uses 'ss2'. ```yaml proxies: - name: "ss1" dialer-proxy: dialer ... - name: "ss2" ... proxy-groups: - name: dialer type: select proxies: - ss2 rules: - MATCH,ss1 ``` -------------------------------- ### Direct Proxy Configuration Example Source: https://wiki.metacubex.one/en/config/proxies/direct Configure a direct proxy with specified UDP, IP version, interface, and routing mark. ```yaml proxies: - name: "direct" type: direct udp: true ip-version: ipv4 interface-name: eth0 routing-mark: 1234 ``` -------------------------------- ### Snell Proxy Configuration Example Source: https://wiki.metacubex.one/en/config/proxies/snell Example configuration for a Snell proxy. Ensure the 'psk' is kept secret and matches the server's configuration. UDP is only supported on Snell versions 3, 4, and 5. ```yaml proxies: - name: "snell" type: snell server: server port: 44046 psk: yourpsk # version: 4 # udp: true # reuse: false # obfs-opts: # mode: http # host: bing.com ``` -------------------------------- ### GET /configs Source: https://wiki.metacubex.one/en/api Retrieve basic configuration details. ```APIDOC ## GET /configs ### Description Retrieve basic configuration. ### Method GET ### Endpoint /configs ### Response #### Success Response (200) - **Response fields**: JSON object of the current running configuration, including `port`, `socks-port`, `mixed-port`, `mode`, `log-level`, `allow-lan`, `ipv6`, `tun`, and other fields ``` -------------------------------- ### Tailscale Proxy Configuration Example Source: https://wiki.metacubex.one/en/config/proxies/tailscale This is a complete example of a Tailscale proxy configuration. It specifies the proxy name, type, Tailscale device hostname, authentication key, control server URL, state directory, and various network and routing options. ```yaml proxies: - name: "tailscale" type: tailscale hostname: mihomo auth-key: tskey-auth-xxxx control-url: https://controlplane.tailscale.com state-dir: ./tailscale ephemeral: false udp: true accept-routes: true exit-node: 100.64.0.1 exit-node-allow-lan-access: true dialer-proxy: "ss1" interface-name: "WLAN" routing-mark: 6666 ip-version: ipv4-prefer ``` -------------------------------- ### Hosts Configuration Example Source: https://wiki.metacubex.one/en/config/dns/hosts Defines domain mappings to IP addresses or other domains. Supports wildcards and multiple IP addresses for a single domain. ```yaml hosts: '*.clash.dev': 127.0.0.1 'alpha.clash.dev': '::1' test.com: [1.1.1.1, 2.2.2.2] baidu.com: google.com ``` -------------------------------- ### Shadowsocks Proxy Configuration Source: https://wiki.metacubex.one/en/config/proxies/ss Example configuration for a Shadowsocks proxy, including server, port, cipher, and plugin options. ```yaml proxies: - name: "ss1" type: ss server: server port: 443 cipher: aes-128-gcm password: "password" udp: true udp-over-tcp: false udp-over-tcp-version: 2 ip-version: ipv4 plugin: obfs plugin-opts: mode: tls smux: enabled: false ``` -------------------------------- ### AnyTLS Listener Configuration Example Source: https://wiki.metacubex.one/en/config/inbound/listeners/anytls This is a basic configuration for an AnyTLS listener. It requires certificate and private key paths for TLS encryption. User credentials can be defined for authentication. ```yaml listeners: - name: anytls-in-1 type: anytls port: 10818 listen: 0.0.0.0 users: username1: password1 username2: password2 certificate: ./server.crt # 证书 PEM 格式,或者 证书的路径 private-key: ./server.key # 证书对应的私钥 PEM 格式,或者私钥路径 # 下面两项为mTLS配置项,如果client-auth-type设置为 "verify-if-given" 或 "require-and-verify" 则client-auth-cert必须不为空 # client-auth-type: "" # 可选值:""、"request"、"require-any"、"verify-if-given"、"require-and-verify" # client-auth-cert: string # 证书 PEM 格式,或者 证书的路径 # 如果填写则开启ech(可由 mihomo generate ech-keypair <明文域名> 生成) # ech-key: | # -----BEGIN ECH KEYS----- # ACATwY30o/RKgD6hgeQxwrSiApLaCgU+HKh7B6SUrAHaDwBD/g0APwAAIAAgHjzK # madSJjYQIf9o1N5GXjkW4DEEeb17qMxHdwMdNnwADAABAAEAAQACAAEAAwAIdGVz # dC5jb20AAA== # -----END ECH KEYS----- ### 注意,anytls listener, 如果 "allow-insecure" 不为 true, 必须填写 “certificate和private-key” ### # allow-insecure: false # 是否允许不开启tls加密(注意:仅用于有 nginx, caddy 前置的情况) padding-scheme: "" # https://github.com/anytls/anytls-go/blob/main/docs/protocol.md#cmdupdatepaddingscheme ``` -------------------------------- ### Example TLS Proxy Configuration Source: https://wiki.metacubex.one/en/config/proxies/tls This YAML snippet demonstrates a proxy configuration with TLS enabled, including SNI, certificate fingerprint, ALPN, and REALITY options. ```yaml proxies: - name: "tls-example" tls: true sni: example.com servername: example.com fingerprint: xxx alpn: - h2 - http/1.1 skip-cert-verify: true # certificate: xxxx # private-key: xxx client-fingerprint: chrome reality-opts: public-key: xxxx short-id: xxxx support-x25519mlkem768: true ech-opts: enable: true config: base64_encoded_config # query-server-name: xxx.com ``` -------------------------------- ### GET /version Source: https://wiki.metacubex.one/en/api Retrieve the Clash version information. ```APIDOC ## GET /version ### Description Retrieve the Clash version. ### Method GET ### Endpoint /version ### Response #### Success Response (200) - **meta** (boolean) - whether this is a Meta build - **version** (string) - version string ``` -------------------------------- ### Manage systemd service Source: https://wiki.metacubex.one/en/startup/service Standard systemctl commands to reload, enable, start, reload, and check the status of the Mihomo service. ```bash systemctl daemon-reload ``` ```bash systemctl enable mihomo ``` ```bash systemctl start mihomo ``` ```bash systemctl reload mihomo ``` ```bash systemctl status mihomo ``` -------------------------------- ### Hysteria2 Proxy Configuration Source: https://wiki.metacubex.one/en/config/proxies/hysteria2 Example configuration for a Hysteria2 proxy, demonstrating essential fields such as server, port, authentication, and obfuscation. ```yaml proxies: - name: "hysteria2" type: hysteria2 server: server.com port: 443 ports: 443-8443 hop-interval: 30 password: yourpassword up: "30 Mbps" down: "200 Mbps" # bbr-profile: "" # Available: "standard", "conservative", "aggressive". Default: "standard" obfs: salamander # Default is empty; if filled, obfs is enabled. Currently, only salamander is supported. obfs-password: yourpassword sni: server.com skip-cert-verify: false fingerprint: xxxx alpn: - h3 # realm-opts: # enable: true # Must be turned on manually # server-url: https://realm.hy2.io # token: public # realm-id: my-cabin-1f3a8c2e9b # stun-servers: # - stun.nextcloud.com:3478 # - stun.sip.us:3478 # - global.stun.twilio.com:3478 # # The following supports entering TLS configuration for the server-url (sni, skip-cert-verify, fingerprint, certificate, private-key, alpn) # # skip-cert-verify: false # # ...... ``` -------------------------------- ### TrustTunnel Proxy Configuration Example Source: https://wiki.metacubex.one/en/config/proxies/trusttunnel Configure a TrustTunnel proxy with server details, authentication, and enable UDP and health checks. Optional settings for client fingerprint, SNI, and ALPN are commented out. ```yaml proxies: - name: trusttunnel type: trusttunnel server: 1.2.3.4 port: 443 username: username password: password # client-fingerprint: chrome health-check: true udp: true # sni: "example.com" # alpn: # - h2 # skip-cert-verify: true ### quic options # quic: true # congestion-controller: bbr # bbr-profile: "" # Available: "standard", "conservative", "aggressive". Default: "standard" ### reuse options # max-connections: 8 # min-streams: 5 # max-streams: 0 ``` -------------------------------- ### AnyTLS Proxy Configuration Example Source: https://wiki.metacubex.one/en/config/proxies/anytls Configure an AnyTLS proxy with common and TLS-specific settings. Ensure the password is kept secure. The client-fingerprint helps mimic legitimate browser traffic. ```yaml proxies: - name: anytls type: anytls server: 1.2.3.4 port: 443 password: "" client-fingerprint: chrome udp: true idle-session-check-interval: 30 idle-session-timeout: 30 min-idle-session: 0 sni: "example.com" alpn: - h2 - http/1.1 skip-cert-verify: true ``` -------------------------------- ### OpenVPN Proxy Configuration Source: https://wiki.metacubex.one/en/config/proxies/openvpn Example configuration for an OpenVPN proxy using username and password authentication. Ensure to replace placeholders with your actual credentials and server details. ```yaml proxies: - name: "openvpn" type: openvpn server: vpn.example.com port: 1194 proto: udp # auth-user-pass mode username: "user" password: "pass" # Certificate mode (Alternative to the above) # cert: | # -----BEGIN CERTIFICATE----- # ... # -----END CERTIFICATE----- # key: | # -----BEGIN PRIVATE KEY----- # ... # -----END PRIVATE KEY----- ca: | -----BEGIN CERTIFICATE----- MIIB...example -----END CERTIFICATE----- # tls-crypt: | # -----BEGIN OpenVPN Static key V1----- # ... # -----END OpenVPN Static key V1----- # ping: 10 # ping-restart: 60 # dev: tun # cipher: AES-128-GCM # auth: SHA256 # comp-lzo: "no" udp: true # mtu: 1500 # dialer-proxy: "ss1" # remote-dns-resolve: true # dns: [ 1.1.1.1, 8.8.8.8 ] ``` -------------------------------- ### VMess Proxy Configuration Source: https://wiki.metacubex.one/en/config/proxies/vmess Example configuration for a VMess proxy, including server details, security settings, and transport options. ```yaml proxies: - name: "vmess" type: vmess server: server port: 443 udp: true uuid: uuid alterId: 0 cipher: auto packet-encoding: packetaddr global-padding: false authenticated-length: false tls: true servername: example.com alpn: - h2 - http/1.1 fingerprint: xxxx client-fingerprint: chrome skip-cert-verify: true reality-opts: public-key: xxxx short-id: xxxx network: tcp smux: enabled: false ``` -------------------------------- ### SSH Proxy Configuration Example Source: https://wiki.metacubex.one/en/config/proxies/ssh Configure an SSH proxy with server address, port, username, password, and private key details. Host key validation can be enabled or disabled. ```yaml proxies: - name: "ssh-out" type: ssh server: 127.0.0.1 port: 22 username: root password: password private-key: key private-key-passphrase: key_password host-key: - "ssh-rsa AAAAB3NzaC1yc2EAA..." host-key-algorithms: - rsa ``` -------------------------------- ### TUIC Proxy Configuration Example Source: https://wiki.metacubex.one/en/config/proxies/tuic Example configuration for a TUIC proxy. Ensure 'token' is used for V4 and 'uuid'/'password' for V5. Other fields like 'ip', 'heartbeat-interval', 'alpn', 'disable-sni', 'reduce-rtt', 'request-timeout', 'udp-relay-mode', 'congestion-controller', 'max-udp-relay-packet-size', 'fast-open', 'skip-cert-verify', 'max-open-streams', and 'sni' can be uncommented and adjusted as needed. ```yaml proxies: - name: tuic server: www.example.com port: 10443 type: tuic token: TOKEN uuid: 00000000-0000-0000-0000-000000000001 password: PASSWORD_1 # ip: 127.0.0.1 # heartbeat-interval: 10000 # alpn: [h3] disable-sni: true reduce-rtt: true request-timeout: 8000 udp-relay-mode: native # congestion-controller: bbr # bbr-profile: "" # Available: "standard", "conservative", "aggressive". Default: "standard" # max-udp-relay-packet-size: 1500 # fast-open: true # skip-cert-verify: true # max-open-streams: 20 # sni: example.com ``` -------------------------------- ### SOCKS5 Proxy Configuration Example Source: https://wiki.metacubex.one/en/config/proxies/socks Configure a SOCKS5 proxy with server, port, and optional authentication or TLS settings. This is useful for routing network traffic through a SOCKS5 proxy. ```yaml proxies: - name: "socks" type: socks5 server: server port: 443 # username: username # password: password # tls: true # fingerprint: xxxx # skip-cert-verify: true # udp: true # ip-version: ipv6 ``` -------------------------------- ### Retrieve Structured Logs Source: https://wiki.metacubex.one/en/api Example of retrieving logs in a structured format. The `format=structured` parameter enables output with time, level, message, and fields. ```bash GET /logs?format=structured ``` -------------------------------- ### Configure a SOCKS5 Proxy Node Source: https://wiki.metacubex.one/en/config/proxies Example configuration for a SOCKS5 proxy node with specific settings for UDP, interface, routing mark, TFO, MPTCP, and smux. ```yaml proxies: - name: "ss" type: ss server: server port: 443 ip-version: ipv4 udp: true interface-name: eth0 routing-mark: 1234 tfo: false mptcp: false dialer-proxy: ss1 smux: enabled: true protocol: smux max-connections: 4 min-streams: 4 max-streams: 0 statistic: false only-tcp: false padding: true brutal-opts: enabled: true up: 50 down: 100 ``` -------------------------------- ### HTTP Rule Provider Configuration Source: https://wiki.metacubex.one/en/config/rule-providers Example configuration for an HTTP-based rule provider. This is used to fetch rulesets from a remote URL. Ensure the URL is accessible and the format matches the specified behavior. ```yaml rule-providers: google: type: http path: ./rule1.yaml url: "https://raw.githubusercontent.com/../Google.yaml" interval: 600 proxy: DIRECT behavior: classical format: yaml # path-in-bundle: "geo/geosite/cn.mrs" size-limit: 0 header: User-Agent: - "mihomo/1.18.3" Authorization: - 'token 1231231' payload: - 'DOMAIN-SUFFIX,google.com' ``` -------------------------------- ### Configure HTTP Proxy Source: https://wiki.metacubex.one/en/config/proxies/http Defines an HTTP proxy with server, port, and optional authentication and TLS settings. Use this for basic HTTP proxy setup. ```yaml proxies: - name: "http" type: http server: server port: 443 # username: username # password: password # tls: true # https # skip-cert-verify: true # sni: custom.com # fingerprint: xxxx # Uses the sha256 fingerprint like experimental.fingerprints. If configured, protocol-specific fingerprints ignore experimental.fingerprints # ip-version: dual headers: ``` -------------------------------- ### TrustTunnel Listener Configuration Source: https://wiki.metacubex.one/en/config/inbound/listeners/trusttunnel Example configuration for a TrustTunnel listener. Requires certificate and private key. Network can be 'tcp' or 'tcp' and 'udp' for HTTP3 support. Congestion controller can be set to 'bbr'. ```yaml listeners: - name: trusttunnel-in-1 type: trusttunnel port: 10821 listen: 0.0.0.0 # rule: sub-rule-name1 # 默认使用 rules,如果未找到 sub-rule 则直接使用 rules # proxy: proxy # 如果不为空则直接将该入站流量交由指定 proxy 处理 (当 proxy 不为空时,这里的 proxy 名称必须合法,否则会出错) users: - username: 1 password: 9d0cb9d0-964f-4ef6-897d-6c6b3ccf9e68 certificate: ./server.crt # 证书 PEM 格式,或者 证书的路径 private-key: ./server.key # 证书对应的私钥 PEM 格式,或者私钥路径 network: ["tcp", "udp"] # http2+http3 congestion-controller: bbr # bbr-profile: "" # Available: "standard", "conservative", "aggressive". Default: "standard" # 下面两项为mTLS配置项,如果client-auth-type设置为 "verify-if-given" 或 "require-and-verify" 则client-auth-cert必须不为空 # client-auth-type: "" # 可选值:""、"request"、"require-any"、"verify-if-given"、"require-and-verify" # client-auth-cert: string # 证书 PEM 格式,或者 证书的路径 # 如果填写则开启ech(可由 mihomo generate ech-keypair <明文域名> 生成) # ech-key: | # -----BEGIN ECH KEYS----- # ACATwY30o/RKgD6hgeQxwrSiApLaCgU+HKh7B6SUrAHaDwBD/g0APwAAIAAgHjzK # madSJjYQIf9o1N5GXjkW4DEEeb17qMxHdwMdNnwADAABAAEAAQACAAEAAwAIdGVz # dC5jb20AAA== # -----END ECH KEYS----- ``` -------------------------------- ### Hysteria Proxy Configuration Example Source: https://wiki.metacubex.one/en/config/proxies/hysteria This snippet shows a basic Hysteria proxy configuration. Ensure 'server' and 'port' are set, and 'auth-str' is provided for authentication. The 'protocol' can be set to udp, wechat-video, or faketcp. ```yaml proxies: - name: "hysteria" type: hysteria server: server.com port: 443 # ports: 1000,2000-3000,4000 # port cannot be omitted auth-str: yourpassword # obfs: obfs_str # alpn: # - h3 protocol: udp # Supports udp/wechat-video/faketcp up: "30 Mbps" # Defaults to Mbps when the unit is omitted down: "200 Mbps" # Defaults to Mbps when the unit is omitted # sni: server.com # skip-cert-verify: false # recv-window-conn: 12582912 # recv-window: 52428800 # disable_mtu_discovery: false # fingerprint: xxxx # Configuring a fingerprint enables SSL pinning. You can get it with openssl x509 -noout -fingerprint -sha256 -inform pem -in yourcert.pem # fast-open: true # Enables Fast Open to reduce connection setup latency. Default: false ``` -------------------------------- ### Copy binary and configuration files Source: https://wiki.metacubex.one/en/startup/service Move the Mihomo binary to the system path and the configuration file to the designated directory. ```bash cp mihomo /usr/local/bin cp config.yaml /etc/mihomo ``` -------------------------------- ### YAML Comment Syntax Source: https://wiki.metacubex.one/en/handbook/syntax Comments start with '#' and must be at the start of a line or preceded by a space. ```yaml port: 7890 # HTTP proxy port socks-port: 7891 # SOCKS proxy port ``` -------------------------------- ### Health Check URL Example Source: https://wiki.metacubex.one/en/config/proxy-providers Example of a health check URL for proxy providers. This URL is used to test the availability and latency of a proxy server. ```text https://www.gstatic.com/generate_204 ``` -------------------------------- ### POST /restart Source: https://wiki.metacubex.one/en/api Restart the kernel. ```APIDOC ## POST /restart ### Description Restart the kernel. ### Method POST ### Endpoint /restart ### Request Body - **Data** (string) - JSON object with `path` and `payload` fields, e.g., `'{"path": "", "payload": ""}'` ### Response #### Success Response (204) - Response: none (HTTP 204) ``` -------------------------------- ### Experimental Configuration Settings Source: https://wiki.metacubex.one/en/config/experimental Configure experimental features like disabling GSO and ECN for QUIC, and enabling IP4P address conversion. ```yaml experimental: quic-go-disable-gso: false quic-go-disable-ecn: false ``` -------------------------------- ### View Graphical Allocs Report Source: https://wiki.metacubex.one/en/api Use the 'go tool pprof' command to visualize the allocs memory allocation report. Install Graphviz to view graphical debug information. Access the report via HTTP on port 8080. ```bash go tool pprof -http=:8080 http://127.0.0.1:xxxx/debug/pprof/allocs ``` -------------------------------- ### GET /group Source: https://wiki.metacubex.one/en/api Retrieves information about all policy groups. ```APIDOC ## GET /group ### Description Retrieve policy group information. ### Method GET ### Endpoint /group ### Response #### Success Response (200) - **proxies** (array) - Array of policy group objects, each in the same format as `/proxies/proxies_name`. ``` -------------------------------- ### Mieru Listener Configuration Example Source: https://wiki.metacubex.one/en/config/inbound/listeners/mieru Configure a Mieru listener with a specific port, transport protocol, and user credentials. Supports TCP or UDP. User authentication is handled via username and password. ```yaml listeners: - name: mieru-in-1 type: mieru port: 10818 listen: 0.0.0.0 transport: TCP # 支持 TCP 或者 UDP users: username1: password1 username2: password2 # 一个 base64 字符串用于微调网络行为 # traffic-pattern: "" # 如果开启, 且客户端不发送用户提示, 代理服务器将拒绝连接 # user-hint-is-mandatory: false ``` -------------------------------- ### Numeric Sequence Example Source: https://wiki.metacubex.one/en/config/proxy-groups/fallback A simple numeric sequence block. ```text 1 2 3 4 5 6 7 8 9 ``` -------------------------------- ### GET /proxies Source: https://wiki.metacubex.one/en/api Retrieves information about all proxies and policy groups. ```APIDOC ## GET /proxies ### Description Retrieve proxy information. ### Method GET ### Endpoint /proxies ### Response #### Success Response (200) - **proxies** (object) - Object keyed by proxy/group name. Each entry shares common fields: - **name** (string) - Proxy or group name. - **type** (string) - Type (e.g., `Shadowsocks`, `VMess`, `DIRECT`, `Selector`, `URLTest`, `Fallback`, `LoadBalance`, etc.). - **udp** (boolean) - Whether UDP is supported. - **uot** (boolean) - Whether UDP over TCP is supported. - **xudp** (boolean) - Whether XUDP is supported. - **tfo** (boolean) - Whether TCP Fast Open is enabled. - **mptcp** (boolean) - Whether MPTCP is enabled. - **smux** (boolean) - Whether stream multiplexing is enabled. - **alive** (boolean) - Whether the proxy is currently alive. - **history** (array) - Array of delay history entries, each with `time` and `delay` (ms). - **extra** (object) - Extra delay histories grouped by test URL. - **interface** (string) - Bound network interface name. - **routing-mark** (string) - Routing mark value. - **provider-name** (string) - Name of the proxy provider this proxy belongs to. - **dialer-proxy** (string) - Underlying dialer proxy name. - Policy groups (`Selector`, `URLTest`, `Fallback`, `LoadBalance`) additionally include: - **now** (string) - Currently selected node name (absent for `LoadBalance`). - **all** (array) - Array of all node/group names in the group. - **testUrl** (string) - Health check URL. - **hidden** (boolean) - Whether the group is hidden in the dashboard. - **icon** (string) - Icon URL. - **emptyFallback** (string) - Fallback node name used when all members are unavailable. - **expectedStatus** (integer) - Expected HTTP response status code for health checks (absent for `Selector`). - **fixed** (string) - Currently pinned node name (only `URLTest` and `Fallback`). ``` -------------------------------- ### Line Numbers Example Source: https://wiki.metacubex.one/en/config/inbound/listeners/mixed A simple sequence of numbers used for reference. ```text 1 2 3 4 5 6 7 8 9 10 11 ``` -------------------------------- ### GET /group/{group_name} Source: https://wiki.metacubex.one/en/api Retrieves information for a specific policy group. ```APIDOC ## GET /group/{group_name} ### Description Retrieve specific policy group information. ### Method GET ### Endpoint /group/{group_name} ### Response #### Success Response (200) - Policy group object, same format as `/proxies/proxies_name`. ``` -------------------------------- ### GET /memory Source: https://wiki.metacubex.one/en/api Retrieve real-time memory usage, measured in bytes. ```APIDOC ## GET /memory ### Description Retrieve real-time memory usage, measured in bytes. ### Method GET / WS ### Endpoint /memory ### Response #### Success Response (200) - **inuse** (bytes) - current memory in use - **oslimit** (bytes) - OS memory limit (always `0`) ``` -------------------------------- ### POST /upgrade Source: https://wiki.metacubex.one/en/api Initiates a system kernel upgrade. Allows specifying an update channel and forcing the update. ```APIDOC ## POST /upgrade ### Description Update the kernel. ### Method POST ### Endpoint /upgrade ### Parameters #### Query Parameters - **channel** (string) - Optional - Specifies the update channel. - **force** (boolean) - Optional - Forces the update. #### Request Body - **path** (string) - Optional - Path for the upgrade. - **payload** (string) - Optional - Payload for the upgrade. ### Response #### Success Response (200) - **status** (string) - Fixed value "ok". ``` -------------------------------- ### GET /proxies/{proxies_name} Source: https://wiki.metacubex.one/en/api Retrieves information for a specific proxy or policy group. ```APIDOC ## GET /proxies/{proxies_name} ### Description Retrieve specific proxy information. ### Method GET ### Endpoint /proxies/{proxies_name} ### Response #### Success Response (200) - Proxy or group object, same fields as a single entry under `/proxies` (regular proxies have only the common fields; policy groups additionally include `now`, `all`, etc.). ``` -------------------------------- ### GET /proxies/{proxies_name}/delay Source: https://wiki.metacubex.one/en/api Tests a specified proxy and returns its delay information. ```APIDOC ## GET /proxies/{proxies_name}/delay ### Description Test a specified proxy and return new delay information. ### Method GET ### Endpoint /proxies/{proxies_name}/delay ### Parameters #### Query Parameters - **url** (string) - Required - The URL to test against. - **timeout** (integer) - Required - The timeout in milliseconds. - **expected** (string) - Optional - The expected HTTP response status code. Supports ranges (e.g., `200/204`, `200-299`). ### Response #### Success Response (200) - **delay** (uint16) - Measured latency in milliseconds. ``` -------------------------------- ### GET /storage/key Source: https://wiki.metacubex.one/en/api Retrieve the storage value for the specified key. Returns `null` if the key does not exist. ```APIDOC ## GET /storage/key ### Description Retrieve the storage value for the specified key. Returns `null` if the key does not exist. ### Method GET ### Endpoint /storage/key ### Parameters #### Query Parameters - **key** (string) - Required - The key to retrieve the storage value for. ### Response #### Success Response (200) - **value** (any) - The stored value or `null` if the key does not exist. ``` -------------------------------- ### View Graphical Heap Report Source: https://wiki.metacubex.one/en/api Use the 'go tool pprof' command to visualize the heap memory allocation report. Install Graphviz to view graphical debug information. Access the report via HTTP on port 8080. ```bash go tool pprof -http=:8080 http://127.0.0.1:xxxx/debug/pprof/heap ``` -------------------------------- ### GET /providers/proxies/providers_name Source: https://wiki.metacubex.one/en/api Retrieve information for a specific proxy set. This includes configuration metadata and a list of proxies. ```APIDOC ## GET /providers/proxies/providers_name ### Description Retrieve information for a specific proxy set. ### Method GET ### Endpoint /providers/proxies/providers_name ### Response #### Success Response (200) - **proxy provider object** - including configuration metadata and a `proxies` list ``` -------------------------------- ### WireGuard Configuration File Source: https://wiki.metacubex.one/en/config/proxies/wg A standard WireGuard configuration file format. ```ini [Interface] Address = ListenPort = PrivateKey = DNS = MTU = [Peer] AllowedIPs = Endpoint = : PublicKey = ``` -------------------------------- ### GET /traffic Source: https://wiki.metacubex.one/en/api Retrieve real-time traffic information, including current upload/download rates and cumulative bytes transferred. ```APIDOC ## GET /traffic ### Description Retrieve real-time traffic information. `up`/`down` are in bytes/s, `upTotal`/`downTotal` are in bytes. ### Method GET / WS ### Endpoint /traffic ### Response #### Success Response (200) - **up** (bytes/s) - current upload rate - **down** (bytes/s) - current download rate - **upTotal** (bytes) - cumulative uploaded bytes - **downTotal** (bytes) - cumulative downloaded bytes ``` -------------------------------- ### Full JSON Configuration Source: https://wiki.metacubex.one/en/handbook/syntax Complete JSON object structure for configuration. ```json { "tun": { "enable": true, "stack": "system", "auto-route": true, "auto-detect-interface": true } } ``` -------------------------------- ### Basic Trojan Listener Configuration Source: https://wiki.metacubex.one/en/config/inbound/listeners/trojan Configure a basic Trojan listener with essential parameters like name, type, port, listen address, and user credentials. This is the minimum required setup for a Trojan listener. ```yaml listeners: - name: trojan-in-1 type: trojan port: 10819 # 支持使用ports格式,例如200,302 or 200,204,401-429,501-503 listen: 0.0.0.0 # rule: sub-rule-name1 # 默认使用 rules,如果未找到 sub-rule 则直接使用 rules # proxy: proxy # 如果不为空则直接将该入站流量交由指定 proxy 处理 (当 proxy 不为空时,这里的 proxy 名称必须合法,否则会出错) users: - username: 1 password: 9d0cb9d0-964f-4ef6-897d-6c6b3ccf9e68 # ws-path: "/" # 如果不为空则开启 websocket 传输层 # grpc-service-name: "GunService" # 如果不为空则开启 grpc 传输层 ```