{ "routing": { "domainStrategy": "IPIfNonMatch", {% if xray_outbounds | length > 1 %} "balancers": [ { "tag": "balancer-vless", "selector": ["vless-"], "strategy": { "type": "leastLoad", "settings": { "costs": [ {% for item in xray_outbounds %} { "match": "vless-{{ item.tag }}", "value": {{ item.value }} }{{ "," if not loop.last else "" }} {% endfor %} ] } } } ], {% endif %} "rules": [ { "type": "field", "protocol": ["bittorrent"], "outboundTag": "direct" }, { "type": "field", "inboundTag": [ "tproxy", "socks-in" ], "balancerTag": "{{ 'balancer-vless' if xray_outbounds | length > 1 else 'vless-' ~ xray_outbounds[0].tag }}" } ] } }