Files
wweir d0031e4106 fix(sower): keep the soft heap limit above the live rule heap
The default 128 MiB soft memory limit sits below the ~105 MB live heap the
full pexcn rule sets build, so the GC goal gets pinned to the live heap and
every allocation triggers a full-heap mark: measured 39% CPU on an otherwise
idle gateway with a GC cycle every 300-500 ms.

Raise the default to 512 MiB, resolve the limit in a testable helper that
covers GOMEMLIMIT/override/disable precedence, and declare the same value in
the packaged service plus the example configs so a deployment can tune it
without a rebuild.
2026-09-18 22:37:03 +08:00

102 lines
2.3 KiB
TOML

# Sower client configuration packaged with releases.
#
# The binary caps its Go heap with a 512 MiB soft memory limit by default; that
# limit has to stay well above the ~105MB live rule heap, because a limit at
# that level pins the GC goal to the live heap and burns CPU on every
# allocation. Override it with SOWER_MEMORY_LIMIT_MB in the service environment
# (0 disables the soft limit), not with a TOML field.
# Remote upstream connection.
[remote]
type = "sower"
addr = "proxy.example.com"
password = "your_secure_password"
# type = "socks5"
# addr = "127.0.0.1:7890"
[dns]
disable = false
# DNS replies for proxied A/AAAA records point clients to this address.
serve = "127.0.0.1"
# serve_6 = "::1"
# serve_iface = "lo"
fallback = "223.5.5.5"
[socks_5]
disable = false
addr = "127.0.0.1:1080"
# 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 = [
"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",
"**.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",
]
[router.country]
# 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",
"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",
]