Writing Efficient Configuration Files
The Stash network extension has a memory limit of 15 MB on iOS 14 and 50 MB on iOS 15 and later. If a configuration exceeds that limit, iOS may stop the extension.
Configure Reasonable DNS Servers
Stash will query all DNS servers simultaneously and cache the query results. On mobile devices, configuring 1 to 2 DNS servers should meet your needs.
- Using DoH, DoT, DoQ consumes more resources and generally has higher latency compared to traditional UDP-based queries.
- Stash uses Fake IP to avoid local DNS queries for requests that need to go through a proxy. For users in China, domestic DNS servers are recommended. Configuring foreign DNS services such as 8.8.8.8 / 1.1.1.1 does not provide practical benefits.
Use Rule Sets
When you need many rules for ad blocking or routing by IP geolocation, use rule sets of type domain or ipcidr to reduce memory use and speed up matching.
Stash checks the rules in classical rule sets sequentially. Using many of these rule sets increases matching time and memory use.
Disable QUIC When Forwarding Through a Proxy
HTTP/3 uses QUIC over UDP. Some proxy protocols forward UDP less efficiently. The following script shortcut rejects UDP traffic on port 443 that would otherwise go through the proxy.
script:
shortcuts:
quic: network == 'udp' and dst_port == 443
rules:
- GEOIP,CN,DIRECT
- SCRIPT,quic,REJECT
- MATCH,PROXY