Skip to content

Instantly share code, notes, and snippets.

@imagelife
Forked from janlay/README.md
Created September 22, 2016 01:47
Show Gist options
  • Save imagelife/acce3799355b3d93370a41ae8377f06b to your computer and use it in GitHub Desktop.
Save imagelife/acce3799355b3d93370a41ae8377f06b to your computer and use it in GitHub Desktop.
Yet another config for Surge.app

Install

  1. Modify index.txt with your output path and proxy info
  2. Use Text Builder to build configuration for Surge: $ text-builder -index /path/to/index.txt Or run $ sh build-all to build all your index files.
  3. Import configuration via AirDrop/iTunes/Dropbox/iCloud

本人不提供任何保证和技术支持,使用者自负风险。
There are no guarantees, no any support. Use it at your own risk.

#!/usr/bin/env sh
# Written by janlay, [email protected]
for file in ./index-*.txt
do
echo "Building file $file..."
text-builder -index $file
done
[General]
# used by Surge for Mac
interface = 127.0.0.1
port = 8800
loglevel = warning
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.0.0.0/8, 100.64.0.0/10
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.0.0.0/8, 100.64.0.0/10, localhost, *.local, e.crashlytics.com
dns-server = system, 223.5.5.5, 8.8.8.8, 8.8.4.4
[Host]
api.smoot.apple.com.cn = api.smoot.apple.com
[URL Rewrite]
^http://www.google.cn http://www.google.com
^http://mp.weixin.qq.com/mp/report reject
[Proxy]
#include proxy.txt
# Surge config index file for iOS 9+
#output 🚦 Auto.conf
#include https://gist.github.com/janlay/b57476c72a93b7e622a6/raw/config.txt
[Rule]
#include https://gist.github.com/janlay/b57476c72a93b7e622a6/raw/rules-app-blockers.txt
#include https://gist.github.com/janlay/b57476c72a93b7e622a6/raw/rules-main.txt
# Surge config index file for Mac OS X 10.11+
# !Use your username here
#output /Users/janlay/.surge.conf
#include https://gist.github.com/janlay/b57476c72a93b7e622a6/raw/config.txt
[Rule]
#include https://gist.github.com/janlay/b57476c72a93b7e622a6/raw/rules-intranet.txt
#include https://gist.github.com/janlay/b57476c72a93b7e622a6/raw/rules-mac-blockers.txt
#include https://gist.github.com/janlay/b57476c72a93b7e622a6/raw/rules-main.txt
💊 Play with GFW = direct
🇯🇵 SSLedge TYO1 = custom <<<
[Proxy Group]
Proxy = select, 💊 Play with GFW, 🇯🇵 SSLedge TYO1
# Block privacy tracker within apps
DOMAIN, ads.mopub.com, REJECT
DOMAIN, cpro.baidu.com, REJECT
DOMAIN, hm.baidu.com, REJECT
DOMAIN, hmma.baidu.com, REJECT
DOMAIN, monitor.uu.qq.com, REJECT
DOMAIN, pagead2.googlesyndication.com, REJECT
DOMAIN, pgdt.gtimg.cn, REJECT
DOMAIN, pingma.qq.com, REJECT
DOMAIN, stat.m.jd.com, REJECT
DOMAIN-KEYWORD, analytics, REJECT
DOMAIN-KEYWORD, cnzz, REJECT
DOMAIN-KEYWORD, flurry.co, REJECT
DOMAIN-KEYWORD, umeng.co, REJECT
DOMAIN-SUFFIX, 127.net, REJECT
DOMAIN-SUFFIX, amazon-adsystem.com, REJECT
DOMAIN-SUFFIX, applovin.com, REJECT
DOMAIN-SUFFIX, beacon.qq.com, REJECT
DOMAIN-SUFFIX, doubleclick.net, REJECT
DOMAIN-SUFFIX, mmstat.com, REJECT
DOMAIN-SUFFIX, mob.com, REJECT
DOMAIN-SUFFIX, sponsorpay.com, REJECT
DOMAIN-SUFFIX, youmi.net, REJECT
# Prevent stream services from displaying ads
DOMAIN, ad.api.3g.youku.com, REJECT
DOMAIN, agn.aty.sohu.com, REJECT
DOMAIN, ark.letv.com, REJECT
DOMAIN, asimgs.pplive.cn, REJECT
DOMAIN, atm.youku.com, REJECT
DOMAIN, lives.l.qq.com, REJECT
# Disable customized fonts
DOMAIN, fonts.googleapis.com, REJECT
# Awful ads served by China Telecom
DOMAIN, 61.160.200.252, REJECT
# Prevent sniffer from a public WiFi
DOMAIN, init.icloud-analysis.com, REJECT
# Special rules for your intranet
DOMAIN, order.mi.com, Proxy
DOMAIN, pan.baidu.com, Proxy
DOMAIN-SUFFIX, 115.com, Proxy
# Block privacy tracker within apps
DOMAIN, ads.mopub.com, REJECT
DOMAIN, cpro.baidu.com, REJECT
DOMAIN, monitor.uu.qq.com, REJECT
DOMAIN, pagead2.googlesyndication.com, REJECT
DOMAIN, pingma.qq.com, REJECT
DOMAIN-KEYWORD, cnzz, REJECT
DOMAIN-KEYWORD, flurry.co, REJECT
DOMAIN-KEYWORD, umeng.co, REJECT
DOMAIN-SUFFIX, applovin.com, REJECT
DOMAIN-SUFFIX, beacon.qq.com, REJECT
DOMAIN-SUFFIX, doubleclick.net, REJECT
DOMAIN-SUFFIX, mmstat.com, REJECT
DOMAIN-SUFFIX, mob.com, REJECT
DOMAIN-SUFFIX, sponsorpay.com, REJECT
DOMAIN-SUFFIX, youmi.net, REJECT
# Disable customized fonts
DOMAIN, fonts.googleapis.com, REJECT
# Prevent sniffer from a public WiFi
DOMAIN, init.icloud-analysis.com, REJECT
DOMAIN-SUFFIX, cn, DIRECT
DOMAIN-KEYWORD, ali, DIRECT
DOMAIN-KEYWORD, taobao, DIRECT
DOMAIN-KEYWORD, 360, DIRECT
DOMAIN-KEYWORD, baidu, DIRECT
DOMAIN-SUFFIX, 126.net, DIRECT
DOMAIN-SUFFIX, 163.com, DIRECT
DOMAIN-SUFFIX, gtimg.com, DIRECT
DOMAIN-SUFFIX, jd.com, DIRECT
DOMAIN-SUFFIX, netease.com, DIRECT
DOMAIN-SUFFIX, qq.com, DIRECT
# Wi-Fi Authentication
DOMAIN, captive.apple.com, DIRECT
# Some services are available locally
DOMAIN-SUFFIX, ls.apple.com, DIRECT
# Apple services
DOMAIN-SUFFIX, apple.com, Proxy
DOMAIN-SUFFIX, icloud.com, Proxy
DOMAIN-SUFFIX, mzstatic.com, Proxy
DOMAIN-KEYWORD, aka, Proxy
# Streaming services, comment out if you don't need
DOMAIN-KEYWORD, qiyi, DIRECT
DOMAIN-KEYWORD, sohu, DIRECT
# Force some domains which are fucked by GFW while resolving DNS
DOMAIN-KEYWORD, facebook, Proxy, force-remote-dns
DOMAIN-KEYWORD, gmail, Proxy, force-remote-dns
DOMAIN-KEYWORD, google, Proxy, force-remote-dns
DOMAIN-KEYWORD, youtube, Proxy, force-remote-dns
DOMAIN-SUFFIX, fbcdn.net, Proxy, force-remote-dns
DOMAIN-SUFFIX, twitter.com, Proxy, force-remote-dns
DOMAIN-SUFFIX, twimg.com, Proxy, force-remote-dns
DOMAIN-SUFFIX, github.com, Proxy, force-remote-dns
# Workaround for some apps
# Instagram
DOMAIN-KEYWORD, instagram, Proxy, force-remote-dns
# SeekingAlpha
DOMAIN-SUFFIX, seekingalpha.com, DIRECT
# Telegram
IP-CIDR, 109.239.140.0/24, Proxy, no-resolve
IP-CIDR, 149.154.160.0/20, Proxy, no-resolve
IP-CIDR, 91.108.4.0/22, Proxy, no-resolve
IP-CIDR, 91.108.56.0/22, Proxy, no-resolve
# Reserved networks, debugging rules should place above this line
IP-CIDR, 10.0.0.0/8, DIRECT
IP-CIDR, 100.64.0.0/10, DIRECT
IP-CIDR, 127.0.0.0/8, DIRECT
IP-CIDR, 172.0.0.0/8, DIRECT
IP-CIDR, 192.168.0.0/16, DIRECT
# Detect local network
GEOIP, CN, DIRECT
# Use proxy for all others
FINAL, Proxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment