Clash rules explained: how ChocLite routes traffic

Every connection your device opens ends up in one of three places: straight out (DIRECT), through a proxy server, or blocked (REJECT). In ChocLite, the routing mode and the rules in your configuration decide which.

  1. Pick a routing mode

    On Home, the path reads Config, Routing, Tunnel. Tap Routing and choose a mode; you can switch while connected. Smart routes traffic by the rules in the configuration. Simple sends all traffic through the one server you choose. Bypass sends all traffic direct, without any proxy. Most subscriptions are written for Smart.

  2. Read the rules

    A rule is one line: a type, what to match, and a policy. ChocLite checks the rules from the top and the first rule that matches wins, so order matters. The last line, MATCH, catches everything else. A policy is DIRECT, REJECT, or the name of a proxy or proxy group, such as Proxy below.

    rules:
      - DOMAIN-SUFFIX,example.com,DIRECT
      - DOMAIN-KEYWORD,analytics,REJECT
      - IP-CIDR,192.168.0.0/16,DIRECT,no-resolve
      - RULE-SET,streaming,Proxy
      - MATCH,Proxy
  3. Use rule sets for long lists

    A RULE-SET rule points to a rule provider: a long list kept in a separate file that the core downloads and refreshes on a schedule. Its behavior says what the list holds: domain, ipcidr or classical (full rules). The name after RULE-SET must match the provider’s name.

    rule-providers:
      streaming:
        type: http
        behavior: domain
        url: https://example.com/streaming.yaml
        path: ./ruleset/streaming.yaml
        interval: 86400
  4. Let proxy groups choose the server

    A policy usually names a proxy group rather than one server. A select group lets you choose the server yourself. A url-test group tests its servers and uses the fastest; fallback uses the first one that works; load-balance spreads connections across them. Groups can contain other groups and DIRECT.

    proxy-groups:
      - name: Proxy
        type: select
        proxies: [Auto, HK-01, JP-01, DIRECT]
      - name: Auto
        type: url-test
        proxies: [HK-01, JP-01]
        url: https://www.gstatic.com/generate_204
        interval: 300
  5. See what the app is doing

    With ChocLite connected, Home → Current route opens Outbound Groups in Smart mode, or Outbound Server in Simple mode: change a server there, and use the gauge on a group to test its latency. Bypass mode has no groups. In the Dashboard, Rules lists every static rule with its type, matching content and policy, searchable, with your rule sets under Rule Providers. Expand a rule set, type a domain or IP into the tester and tap Test to see Matched or No match. Connections shows the Rule and the Chain each connection used.

  6. Add your own rule

    To add a rule without touching your subscription, use an override: it is merged into every configuration. Open Configurations, tap More (the ellipsis) → Overrides, tap Add → New Override, and write YAML such as the lines below. prepend-rules puts your rules first, so they win. An override takes effect the next time you connect, and stays when subscriptions update.

    prepend-rules:
      - DOMAIN-SUFFIX,example.com,DIRECT

Good to know

Rules, Outbound Groups, Connections and the rule tester are part of the Dashboard, ChocLite’s optional paid add-on. Routing modes work without it.

Rule sets that are fetched from a URL only show their contents once you are connected. Some kinds of rule set cannot list their entries; use the tester instead.