Give each Neko lane its own proxy exit to fix Google login cancel.
Shared proxycheap IP caused lane2 sign-in to be cancelled while lane1 kept an existing session; support per-instance NEKO_BROWSER_PROXY_N and harden Chrome WebRTC IP handling behind HTTP proxy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
0517be0ce2
commit
39497fa29a
@ -59,6 +59,13 @@ ENABLE_NEKO_BROWSER_PROXY=0
|
||||
# Neko 专用 ShellCrash mixed listener(与 FFmpeg 的 7890/tuic3 出口隔离;仅 ENABLE_NEKO_BROWSER_PROXY=1 时生效)
|
||||
NEKO_SHELLCRASH_PROXY_PORT=7894
|
||||
SHELLCRASH_NEKO_PROXY_NODE=proxycheap
|
||||
# 多开 Neko 时务必给每条线路独立出口,否则 Google 会把同 IP 第二账号登录判为“登录取消”。
|
||||
# 方式 A:总开关,自动用 7894、7895、7896...
|
||||
# NEKO_BROWSER_PROXY_PER_INSTANCE=1
|
||||
# 方式 B:显式指定(推荐)
|
||||
# NEKO_SHELLCRASH_PROXY_PORT_1=7894
|
||||
# NEKO_SHELLCRASH_PROXY_PORT_2=7895
|
||||
# NEKO_BROWSER_PROXY_2=http://172.19.0.1:7895
|
||||
# 留空则自动使用 http://host.docker.internal:${NEKO_SHELLCRASH_PROXY_PORT}
|
||||
# NEKO_BROWSER_PROXY=
|
||||
NETWORK_PROBE_GOOGLE_URL=https://www.google.com/generate_204
|
||||
|
||||
@ -266,7 +266,8 @@ case "${NEKO_BROWSER_PROXY:-}" in
|
||||
http://*|https://*)
|
||||
proxy_bypass="${NEKO_BROWSER_PROXY_BYPASS:-<-loopback>;localhost;127.0.0.1;::1;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.*;*.local;host.docker.internal}"
|
||||
proxy_flags="--proxy-server=${NEKO_BROWSER_PROXY} --proxy-bypass-list=${proxy_bypass}"
|
||||
quic_flags="--disable-quic"
|
||||
# Avoid Google login cancel when HTTP goes via proxy but WebRTC STUN leaks LAN/Docker IP.
|
||||
quic_flags="--disable-quic --force-webrtc-ip-handling-policy=disable_non_proxied_udp --disable-features=WebRtcAllowInputVolumeAdjustment"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
@ -101,6 +101,10 @@ def render(count: int) -> str:
|
||||
"172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;"
|
||||
"172.31.*;192.168.*;*.local;host.docker.internal",
|
||||
)
|
||||
# Optional: give each instance its own ShellCrash mixed port / proxy URL so Google
|
||||
# does not see multiple accounts logging in from one shared exit IP (proxycheap).
|
||||
per_instance_proxy = env_enabled("NEKO_BROWSER_PROXY_PER_INSTANCE", False)
|
||||
proxy_port_base = int(env("NEKO_SHELLCRASH_PROXY_PORT", "7894") or "7894")
|
||||
extra_hosts_line = f' - "{neko_extra_hosts_mapping(docker_host_ip)}"'
|
||||
supervisor_conf = env("NEKO_BROWSER_SUPERVISOR_CONF", "chromium.conf")
|
||||
tampermonkey_repair = env("NEKO_TAMPERMONKEY_REPAIR", "1")
|
||||
@ -134,6 +138,19 @@ def render(count: int) -> str:
|
||||
udp_range = instance_value("NEKO_WEBRTC_UDP_RANGE", idx, default_udp_range(idx))
|
||||
epr = instance_value("NEKO_WEBRTC_EPR", idx, udp_range)
|
||||
profile = instance_value("NEKO_PROFILE_HOST_DIR", idx, base_profile if idx == 1 else f"{base_profile}-{idx}")
|
||||
inst_proxy = sanitize_neko_browser_proxy(instance_value("NEKO_BROWSER_PROXY", idx, ""))
|
||||
inst_proxy_port = instance_value("NEKO_SHELLCRASH_PROXY_PORT", idx, "")
|
||||
if inst_proxy:
|
||||
browser_proxy_i = inst_proxy
|
||||
elif inst_proxy_port:
|
||||
browser_proxy_i = build_neko_browser_proxy_url(docker_host_ip, inst_proxy_port)
|
||||
elif per_instance_proxy and env_enabled("ENABLE_NEKO_BROWSER_PROXY", False):
|
||||
browser_proxy_i = build_neko_browser_proxy_url(
|
||||
docker_host_ip,
|
||||
str(proxy_port_base + idx - 1),
|
||||
)
|
||||
else:
|
||||
browser_proxy_i = browser_proxy
|
||||
lines.extend(
|
||||
[
|
||||
f" neko{idx}:",
|
||||
@ -169,7 +186,7 @@ def render(count: int) -> str:
|
||||
' NEKO_PLUGINS_DIR: "/etc/neko/plugins/"',
|
||||
f" NEKO_START_URL: {q(start_url)}",
|
||||
f" NEKO_BROWSER_RENDER_MODE: {q(render_mode)}",
|
||||
f" NEKO_BROWSER_PROXY: {q(browser_proxy)}",
|
||||
f" NEKO_BROWSER_PROXY: {q(browser_proxy_i)}",
|
||||
f" NEKO_BROWSER_PROXY_BYPASS: {q(browser_proxy_bypass)}",
|
||||
f" NEKO_MANAGED_POLICIES: {q('1' if managed_policies else '0')}",
|
||||
f" NEKO_TAMPERMONKEY_REPAIR: {q(tampermonkey_repair)}",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user