diff --git a/.github/sower.hcl b/.github/sower.hcl deleted file mode 100644 index 89d6337..0000000 --- a/.github/sower.hcl +++ /dev/null @@ -1,100 +0,0 @@ -# 远程、上游连接方式 -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" - # serve6 = "" - # 监听的网络接口 - # serve_iface = "lo" - # 必填,优先使用 DHCP 中的 DNS 服务器,如果没有则使用该地址 - fallback = "223.5.5.5" -} - -socks_5 { - disable = false - # 不写 IP 则监听所有 IP - addr = "127.0.0.1:1080" -} - -# 路由规则,各规则优先级: -# 禁止访问规则 > 直接访问规则 > 代理访问规则 > GEOIP 规则 -# file 字段可填 URL 或本地文件路径,URL 将通过代理请求 - -# 禁止访问规则。被命中的请求,将被禁止访问。可用于广告过滤之类的目的 -router "block" { - file = "https://raw.githubusercontent.com/pexcn/daily/gh-pages/adlist/adlist.txt" - rules = [] -} - -# 直接访问规则。被命中的请求,将被直接访问,不再通过代理 -router "direct" { - file = "https://raw.githubusercontent.com/pexcn/daily/gh-pages/chinalist/chinalist.txt" - rules = [ - "imap.*.*", - "imap.*.*.*", - "smtp.*.*", - "smtp.*.*.*", - "pop.*.*", - "pop.*.*.*", - "pop3.*.*", - "pop3.*.*.*", - "**.cn", - ] -} - -# 代理访问规则。被命中的请求,将通过代理进行转发 -router "proxy" { - 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", - ] -} diff --git a/.github/sower.plist b/.github/sower.plist index 1b67460..62aa98b 100644 --- a/.github/sower.plist +++ b/.github/sower.plist @@ -7,8 +7,8 @@ ProgramArguments /usr/local/bin/sower - -f - /usr/local/etc/sower/sower.hcl + -c + /usr/local/etc/sower/sower.toml KeepAlive @@ -17,4 +17,4 @@ WorkingDirectory /usr/local/etc/sower - \ No newline at end of file + diff --git a/.github/sower.service b/.github/sower.service index 1db9446..a464b15 100644 --- a/.github/sower.service +++ b/.github/sower.service @@ -5,9 +5,9 @@ After=network.target [Service] Type=simple WorkingDirectory=/etc/sower -ExecStart=/usr/local/bin/sower -c /etc/sower/sower.hcl +ExecStart=/usr/local/bin/sower -c /etc/sower/sower.toml Restart=on-failure RestartSec=1min [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target diff --git a/.github/sower.toml b/.github/sower.toml index 7c4da8a..f43a49e 100644 --- a/.github/sower.toml +++ b/.github/sower.toml @@ -1,36 +1,32 @@ -[remote] # 远程、上游连接方式 +# Remote upstream connection. +[remote] type = "sower" -addr = "proxy.com" -password = "I_am_Passw0rd" -# type: "socks5" -# addr: "127.0.0.1:7890" +addr = "proxy.example.com" +password = "your_secure_password" +# type = "socks5" +# addr = "127.0.0.1:7890" [dns] disable = false -# 监听该 IP 的 UDP(53)、TCP(80、443) 端口,DNS 会将请求导向这个地址 +# DNS replies for proxied A/AAAA records point clients to this address. serve = "127.0.0.1" -# serve6 = -# 监听的网络接口 +# serve_6 = "::1" # serve_iface = "lo" - -# 必填,优先使用 DHCP 中的 DNS 服务器,如果没有则使用该地址 fallback = "223.5.5.5" [socks_5] disable = false -# 不写 IP 则监听所有 IP addr = "127.0.0.1:1080" -# 路由规则,各规则优先级: -# 禁止访问规则 > 直接访问规则 > 代理访问规则 > GEOIP 规则 -# file 字段可填 URL 或本地文件路径,URL 将通过代理请求 - -# 禁止访问规则。被命中的请求,将被禁止访问。可用于广告过滤之类的目的 +# Routing priority: +# block > direct > proxy > geo. [router.block] file = "https://raw.githubusercontent.com/pexcn/daily/gh-pages/adlist/adlist.txt" +file_skip_rules = [ + "t.co", +] rules = [] -# 直接访问规则。被命中的请求,将被直接访问,不再通过代理 [router.direct] file = "https://raw.githubusercontent.com/pexcn/daily/gh-pages/chinalist/chinalist.txt" rules = [ @@ -45,7 +41,6 @@ rules = [ "**.cn", ] -# 代理访问规则。被命中的请求,将通过代理进行转发 [router.proxy] file = "https://raw.githubusercontent.com/pexcn/daily/gh-pages/gfwlist/gfwlist.txt" rules = [ @@ -69,17 +64,22 @@ rules = [ "*.cloudfront.net", "**.amazon.com", "**.amazonaws.com", - "*.githubusercontent.com", - "*.githubassets.com", - "*.github.*", + "**.github.com", + "**.githubusercontent.com", + "**.githubassets.com", + "**.githubcopilot.com", + "t.co", "lookup-api.apple.com", + "**.openai.com", + "**.chatgpt.com", + "**.oaistatic.com", + "**.oaiusercontent.com", + "platform.api.openai.org", ] -# GEOIP 规则。大陆境内的 IP,将直接访问。 -# 非大陆境内的 IP,将通过另一套检测逻辑,确定是否需要进行代理。 -# 为避免误伤一些非标页面端口(除 80/443 外),该规则只在 Socks5 模式下生效 [router.country] -mmdb = "Country.mmdb" # https://github.com/alecthw/mmdb_china_ip_list +# mmdb is optional. Leave it empty or unset to disable GeoIP lookup and use CIDR rules only. +# mmdb = "Country.mmdb" file = "https://raw.githubusercontent.com/pexcn/daily/gh-pages/chnroute/chnroute.txt" rules = [ "127.0.0.0/8", diff --git a/.github/sower.yaml b/.github/sower.yaml index f4d0fbb..d1870b0 100644 --- a/.github/sower.yaml +++ b/.github/sower.yaml @@ -1,35 +1,28 @@ -remote: # 远程、上游连接方式 +remote: type: "sower" - addr: "proxy.com" - password: "I_am_Passw0rd" + addr: "proxy.example.com" + password: "your_secure_password" # type: "socks5" # addr: "127.0.0.1:7890" dns: disable: false - # 监听该 IP 的 UDP(53)、TCP(80、443) 端口,DNS 会将请求导向这个地址 serve: "127.0.0.1" - # serve6: - # 监听的网络接口 + # serve_6: "::1" # serve_iface: "lo" - # 必填,优先使用 DHCP 中的 DNS 服务器,如果没有则使用该地址 fallback: "223.5.5.5" socks_5: disable: false - # 不写 IP 则监听所有 IP addr: "127.0.0.1:1080" -# 路由规则,各规则优先级: -# 禁止访问规则 > 直接访问规则 > 代理访问规则 > GEOIP 规则 -# file 字段可填 URL 或本地文件路径,URL 将通过代理请求 router: - # 禁止访问规则。被命中的请求,将被禁止访问。可用于广告过滤之类的目的 block: file: "https://raw.githubusercontent.com/pexcn/daily/gh-pages/adlist/adlist.txt" + file_skip_rules: + - "t.co" rules: [] - # 直接访问规则。被命中的请求,将被直接访问,不再通过代理 direct: file: "https://raw.githubusercontent.com/pexcn/daily/gh-pages/chinalist/chinalist.txt" rules: @@ -43,7 +36,6 @@ router: - "pop3.*.*.*" - "**.cn" - # 代理访问规则。被命中的请求,将通过代理进行转发 proxy: file: "https://raw.githubusercontent.com/pexcn/daily/gh-pages/gfwlist/gfwlist.txt" rules: @@ -67,16 +59,21 @@ router: - "*.cloudfront.net" - "**.amazon.com" - "**.amazonaws.com" - - "*.githubusercontent.com" - - "*.githubassets.com" - - "*.github.*" + - "**.github.com" + - "**.githubusercontent.com" + - "**.githubassets.com" + - "**.githubcopilot.com" + - "t.co" - "lookup-api.apple.com" + - "**.openai.com" + - "**.chatgpt.com" + - "**.oaistatic.com" + - "**.oaiusercontent.com" + - "platform.api.openai.org" - # GEOIP 规则。大陆境内的 IP,将直接访问。 - # 非大陆境内的 IP,将通过另一套检测逻辑,确定是否需要进行代理。 - # 为避免误伤一些非标页面端口(除 80/443 外),该规则只在 Socks5 模式下生效 country: - mmdb: "Country.mmdb" # https://github.com/alecthw/mmdb_china_ip_list + # mmdb is optional. Leave it empty or unset to disable GeoIP lookup and use CIDR rules only. + # mmdb: "Country.mmdb" file: "https://raw.githubusercontent.com/pexcn/daily/gh-pages/chnroute/chnroute.txt" rules: - "127.0.0.0/8" diff --git a/.github/sower_run.vbs b/.github/sower_run.vbs index 528edda..07eac83 100644 --- a/.github/sower_run.vbs +++ b/.github/sower_run.vbs @@ -1 +1 @@ -CreateObject("WScript.Shell").Run "C:\Software\Sower\sower.exe -f sower.hcl",0 \ No newline at end of file +CreateObject("WScript.Shell").Run "C:\Software\Sower\sower.exe -c sower.toml",0 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e98aa6c..fa63148 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,32 +18,32 @@ jobs: mv .github/* . || true make build GO='GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go' - tar czvf sower-linux-amd64.tar.gz sower sowerd sower.hcl sower.yaml sower.toml sower.service sowerd.service + tar czvf sower-linux-amd64.tar.gz sower sowerd sower.toml sower.yaml sower.service sowerd.service make clean make build GO='GOOS=linux GOARCH=arm CGO_ENABLED=0 go' - tar czvf sower-linux-arm.tar.gz sower sowerd sower.hcl sower.yaml sower.toml sower.service sowerd.service + tar czvf sower-linux-arm.tar.gz sower sowerd sower.toml sower.yaml sower.service sowerd.service make clean make build GO='GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go' - tar czvf sower-linux-arm64.tar.gz sower sowerd sower.hcl sower.yaml sower.toml sower.service sowerd.service + tar czvf sower-linux-arm64.tar.gz sower sowerd sower.toml sower.yaml sower.service sowerd.service make clean make build GO='GOOS=linux GOARCH=mips CGO_ENABLED=0 go' - tar czvf sower-linux-mips.tar.gz sower sowerd sower.hcl sower.yaml sower.toml sower.service sowerd.service + tar czvf sower-linux-mips.tar.gz sower sowerd sower.toml sower.yaml sower.service sowerd.service make clean make build GO='GOOS=linux GOARCH=mipsle CGO_ENABLED=0 go' - tar czvf sower-linux-mipsle.tar.gz sower sowerd sower.hcl sower.yaml sower.toml sower.service sowerd.service + tar czvf sower-linux-mipsle.tar.gz sower sowerd sower.toml sower.yaml sower.service sowerd.service make clean make build GO='GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go' - tar czvf sower-darwin-amd64.tar.gz sower sowerd sower.hcl sower.yaml sower.toml sower.plist + tar czvf sower-darwin-amd64.tar.gz sower sowerd sower.toml sower.yaml sower.plist make clean make build GO='GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go' - tar czvf sower-darwin-arm64.tar.gz sower sowerd sower.hcl sower.yaml sower.toml sower.plist + tar czvf sower-darwin-arm64.tar.gz sower sowerd sower.toml sower.yaml sower.plist make clean make build GO='GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go' mv sower sower.exe mv sowerd sowerd.exe - tar czvf sower-windows-amd64.tar.gz sower.exe sowerd.exe sower.hcl sower.yaml sower.toml sower_run.vbs + tar czvf sower-windows-amd64.tar.gz sower.exe sowerd.exe sower.toml sower.yaml sower_run.vbs make clean - uses: ncipollo/release-action@v1