Skip to content
wweir edited this page Jun 3, 2022 · 4 revisions
# 远程、上游连接方式
remote {
    type = "sower"
    addr = "proxy.com"
    password = "I_am_Passw0rd"
    # type="socks5"
    # addr="127.0.0.1:7890"
}

dns {
    disable = false
    # 必填,监听该 IP 的 UDP(53)、TCP(80、443) 端口,DNS 会将请求导向这个地址
    serve = "127.0.0.1"
    # 必填,优先使用 DHCP 中的 DNS 服务器,如果没有则使用该地址
    fallback = "223.5.5.5"
}

socks_5 {
    disable = false
    # 必填,监听该 IP 的 TCP(80、443) 端口,SOCKS 会将请求导向这个地址
    addr = "127.0.0.1:1080"
}

# 路由规则,各规则优先级:
# 禁止访问规则 > 直接访问规则 > 代理访问规则 > GEOIP 规则

# 禁止访问规则。被命中的请求,将被禁止访问。可用于广告过滤之类的目的
router "block" {
    # URL 或本地文件路径,URL 将通过代理请求
    file = "https://raw.githubusercontent.com/pexcn/daily/gh-pages/adlist/adlist.txt"
    rules = []
}

# 直接访问规则。被命中的请求,将被直接访问,不再通过代理
router "direct" {
    # URL 或本地文件路径,URL 将通过代理请求
    file = "https://raw.githubusercontent.com/pexcn/daily/gh-pages/chinalist/chinalist.txt"
    rules = [
      "imap.*.*",
      "imap.*.*.*",
      "smtp.*.*",
      "smtp.*.*.*",
      "pop.*.*",
      "pop.*.*.*",
      "pop3.*.*",
      "pop3.*.*.*",
      "**.cn",
      ]
}

# 代理访问规则。被命中的请求,将通过代理进行转发
router "proxy" {
    # URL 或本地文件路径,URL 将通过代理请求
    file = "https://raw.githubusercontent.com/pexcn/daily/gh-pages/gfwlist/gfwlist.txt"
    rules = [
      "**.google.*",
      "**.goo.gl",
      "**.googleusercontent.com",
      "**.googleapis.com",
      "*.googlesource.com",
      "**.youtube.com",
      "**.ytimg.com",
      "**.ggpht.com",
      "**.googlevideo.com",
      "**.facebook.com",
      "**.fbcdn.net",
      "**.twitter.com",
      "**.twimg.com",
      "**.blogspot.com",
      "**.appspot.com",
      "**.wikipedia.org",
      "**.wikimedia.org",
      "*.cloudfront.net",
      "**.amazon.com",
      "**.amazonaws.com",
      "*.githubusercontent.com",
      "*.githubassets.com",
      "*.github.*",
      "lookup-api.apple.com",
    ]
}

# GEOIP 规则。大陆境内的 IP,将直接访问。
# 非大陆境内的 IP,将通过另一套检测逻辑,确定是否需要进行代理。
# 为避免误伤一些非标页面端口(除 80/443 外),该规则只在 Socks5 模式下生效
router "country" {
    // mmdb = "Country.mmdb"  # https://github.com/alecthw/mmdb_china_ip_list
    file = "https://raw.githubusercontent.com/pexcn/daily/gh-pages/chnroute/chnroute.txt"
    rules = [
        "127.0.0.0/8",
        "172.16.0.0/12",
        "192.168.0.0/16",
        "10.0.0.0/8",
        "17.0.0.0/8",
        "100.64.0.0/10",
        "224.0.0.0/4",
        "fe80::/10",
    ]
}
Clone this wiki locally