Skip to content

Commit

Permalink
feat: add yaml example config
Browse files Browse the repository at this point in the history
  • Loading branch information
wweir committed Jun 3, 2022
1 parent b85c3a6 commit 2948ffb
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 10 deletions.
18 changes: 17 additions & 1 deletion .github/sower.hcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# 远程、上游连接方式
remote {
type = "sower"
addr = "proxy.com"
Expand All @@ -7,19 +8,30 @@ remote {
}

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 则监听所有 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 = [
Expand All @@ -35,6 +47,7 @@ router "direct" {
]
}

# 代理访问规则。被命中的请求,将通过代理进行转发
router "proxy" {
file = "https://raw.githubusercontent.com/pexcn/daily/gh-pages/gfwlist/gfwlist.txt"
rules = [
Expand Down Expand Up @@ -65,8 +78,11 @@ router "proxy" {
]
}

# GEOIP 规则。大陆境内的 IP,将直接访问。
# 非大陆境内的 IP,将通过另一套检测逻辑,确定是否需要进行代理。
# 为避免误伤一些非标页面端口(除 80/443 外),该规则只在 Socks5 模式下生效
router "country" {
mmdb = "Country.mmdb" # https://github.com/alecthw/mmdb_china_ip_list
// 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",
Expand Down
86 changes: 86 additions & 0 deletions .github/sower.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
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 则监听所有 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: []

# 直接访问规则。被命中的请求,将被直接访问,不再通过代理
direct:
file: "https://raw.githubusercontent.com/pexcn/daily/gh-pages/chinalist/chinalist.txt"
rules:
- "imap.*.*"
- "imap.*.*.*"
- "smtp.*.*"
- "smtp.*.*.*"
- "pop.*.*"
- "pop.*.*.*"
- "pop3.*.*"
- "pop3.*.*.*"
- "**.cn"

# 代理访问规则。被命中的请求,将通过代理进行转发
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 模式下生效
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"
18 changes: 9 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,40 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: ^1.17
go-version: ^1.18
- uses: actions/checkout@v2

- name: build matrix
run: |
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.service sowerd.service
tar czvf sower-linux-amd64.tar.gz sower sowerd sower.hcl 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.service sowerd.service
tar czvf sower-linux-arm.tar.gz sower sowerd sower.hcl 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.service sowerd.service
tar czvf sower-linux-arm64.tar.gz sower sowerd sower.hcl 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.service sowerd.service
tar czvf sower-linux-mips.tar.gz sower sowerd sower.hcl 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.service sowerd.service
tar czvf sower-linux-mipsle.tar.gz sower sowerd sower.hcl 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.plist
tar czvf sower-darwin-amd64.tar.gz sower sowerd sower.hcl 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.plist
tar czvf sower-darwin-arm64.tar.gz sower sowerd sower.hcl 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_run.vbs
tar czvf sower-windows-amd64.tar.gz sower.exe sowerd.exe sower.hcl sower.yaml sower_run.vbs
make clean
- uses: ncipollo/release-action@v1
Expand Down

0 comments on commit 2948ffb

Please sign in to comment.