@@ -351,7 +351,114 @@ routing {
351351
352352 # Network managers in localhost should be direct to avoid false negative network connectivity check when binding to
353353 # WAN.
354- pname(git, telegram-desktop) -> proxy
354+ pname(NetworkManager, systemd-resolved, dnsmasq, mihomo, netbird, zerotier-one, tailscaled, nekobox_core, sing-box, proxychains4, gg) -> must_direct
355+
356+ # Put it in the front to prevent broadcast, multicast and other packets that should be sent to the LAN from being
357+ # forwarded by the proxy.
358+ # "dip" means destination IP.
359+ dip(224.0.0.0/3, 'ff00::/8') -> direct
360+
361+ # This line allows you to access private addresses directly instead of via your proxy. If you really want to access
362+ # private addresses in your proxy host network, modify the below line.
363+ dip(geoip:private) -> direct
364+
365+ ### Write your rules below.
366+
367+ # --- Core rules ---#
368+
369+ # Disable HTTP3(QUIC) because it usually consumes too much cpu/mem resources.
370+ l4proto(udp) && dport(443) -> block
371+
372+ # Direct access to all Chinese mainland-related IP addresses
373+ dip(geoip:cn) -> direct
374+ domain(geosite:cn) -> direct
375+
376+ ### Direct
377+ domain(regex:'.+\.edu\.cn$') -> direct
378+ domain(keyword:'baidu') -> direct
379+ domain(keyword:'bilibili') -> direct
380+ domain(keyword:'taobao') -> direct
381+ domain(keyword:'alibabadns') -> direct
382+ domain(keyword:'alicdn') -> direct
383+ domain(keyword:'tbcache') -> direct
384+ domain(keyword:'zhihu') -> direct
385+ domain(keyword:'douyu') -> direct
386+ domain(geosite:cloudflare-cn) -> direct
387+
388+ # Block ads
389+ domain(full:analytics.google.com) -> proxy # do not block google analytics(console)
390+ domain(geosite:category-ads) -> block
391+ domain(geosite:category-ads-all) -> block
392+
393+ # DNS
394+ dip(8.8.8.8, 8.8.4.4) -> proxy
395+ dip(223.5.5.5, 223.6.6.6) -> direct
396+ domain(full:dns.alidns.com) -> direct
397+ domain(full:dns.googledns.com) -> proxy
398+ domain(full:dns.opendns.com) -> proxy
399+
400+ # --- Rules for other commonly used sites ---#
401+
402+ # SSH - tcp port 22 is blocked by many proxy servers.
403+ dport(22) && !dip(geoip:cn) && !domain(geosite:cn) -> ssh-proxy
404+
405+ ### GitHub / Docker Hub
406+ ### randomly select a node from the group for every connection
407+ ### to avoid the rate limit of GitHub API and Docker Hub API
408+ domain(geosite:github) -> proxy-avoid-rate-limits
409+ domain(geosite:docker) -> proxy-avoid-rate-limits
410+
411+ ### OpenAI
412+ domain(geosite:openai) -> proxy
413+ domain(regex:'.+\.openai$') -> proxy
414+ #domain(geosite:openai) -> sg
415+ #domain(regex:'.+\.openai$') -> sg
416+
417+ ### Gemini
418+ domain(suffix: gemini.google.com, suffix: bard.google.com, suffix: ai.google.dev) -> gemini
419+
420+ # Steam
421+ # from https://hky.moe/archives/471/
422+ domain(suffix: steamserver.net) -> direct
423+ domain(suffix: steamcontent.com) -> direct
424+ domain(store.steampowered.com, api.steampowered.com) -> proxy
425+ domain(suffix: steampowered.com) -> direct
426+ domain(geosite:steam@cn) -> direct
427+ domain(geosite:steam) -> proxy
428+
429+ ### Media
430+ domain(geosite:netflix) -> media
431+ domain(geosite:youtube) -> media
432+
433+ ### Proxy
434+ domain(suffix: linkedin.com) -> proxy
435+ domain(keyword:'linkedin') -> proxy
436+ domain(regex:'.+\.linkedin\.com$') -> proxy
437+ domain(regex:'.+\.quay\.io$') -> proxy
438+ domain(regex:'.+\.notion\.so$') -> proxy
439+ domain(regex:'.+\.amazon\.com$') -> proxy
440+ domain(regex:'.+\.oracle\.com$') -> proxy
441+ domain(regex:'.+\.docker\.com$') -> proxy
442+ domain(regex:'.+\.kubernetes\.io$') -> proxy
443+ domain(regex:'.+\.nixos\.org$') -> proxy
444+
445+ domain(geosite:microsoft) -> proxy
446+ domain(bing.com) -> proxy
447+ domain(geosite:linkedin) -> proxy
448+ domain(geosite:twitter) -> proxy
449+ domain(geosite:telegram) -> proxy
450+ domain(geosite:google) -> proxy
451+ domain(geosite:apple) -> proxy
452+ domain(geosite:category-container) -> proxy
453+ domain(geosite:category-dev) -> proxy
454+ domain(geosite:google-scholar) -> proxy
455+ domain(geosite:category-scholar-!cn) -> proxy
456+
457+ # --- Fallback rules ---#
458+
459+ # Access all other foreign sites
460+ domain(geosite:geolocation-!cn) -> proxy
461+ !dip(geoip:cn) -> proxy
355462
356463 fallback: direct
357464}
0 commit comments