Skip to content

Commit 568b99e

Browse files
committed
[Fix] 🐛 NewBing Proxy Error
1 parent fbe4d52 commit 568b99e

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ Go_Proxy_BingAI_SOCKS_URL=192.168.0.88:1070
110110
# Socks 账号、密码 可选
111111
Go_Proxy_BingAI_SOCKS_USER=xxx
112112
Go_Proxy_BingAI_SOCKS_PWD=xxx
113+
# KievRPSSecAuth Cookie的值
114+
USER_KievRPSSecAuth=xxx
113115
# 默认用户 Cookie 设置,可选,不推荐使用,固定前缀 Go_Proxy_BingAI_USER_TOKEN 可设置多个,未登录用户将随机使用,多人共用将很快触发图形验证,并很快达到该账号的24小时限制
114116
Go_Proxy_BingAI_USER_TOKEN_1=xxx
115117
Go_Proxy_BingAI_USER_TOKEN_2=xxx

common/env.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ var (
1515
// user token
1616
USER_TOKEN_ENV_NAME_PREFIX = "Go_Proxy_BingAI_USER_TOKEN"
1717
USER_TOKEN_LIST []string
18+
// KievRPSSecAuth Cookie
19+
USER_KievRPSSecAuth string
1820
// 访问权限密钥,可选
1921
AUTH_KEY string
2022
AUTH_KEY_COOKIE_NAME = "BingAI_Auth_Key"
@@ -34,6 +36,8 @@ func initEnv() {
3436
SOCKS_PWD = os.Getenv("Go_Proxy_BingAI_SOCKS_PWD")
3537
// auth
3638
AUTH_KEY = os.Getenv("Go_Proxy_BingAI_AUTH_KEY")
39+
// KievRPSSecAuth Cookie
40+
USER_KievRPSSecAuth = os.Getenv("USER_KievRPSSecAuth")
3741
}
3842

3943
func initUserToken() {

common/proxy.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ func NewSingleHostReverseProxy(target *url.URL) *httputil.ReverseProxy {
9191
}
9292
req.Header.Set("X-Forwarded-For", randIP)
9393

94+
if USER_KievRPSSecAuth != "" {
95+
// 添加 KievRPSSecAuth Cookie
96+
req.AddCookie(&http.Cookie{
97+
Name: "KievRPSSecAuth",
98+
Value: USER_KievRPSSecAuth,
99+
})
100+
}
101+
94102
// 未登录用户
95103
ckUserToken, _ := req.Cookie(USER_TOKEN_COOKIE_NAME)
96104
if ckUserToken == nil || ckUserToken.Value == "" {

docker/docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ services:
1313
- $PWD/go-proxy-bingai:/app/go-proxy-bingai
1414
ports:
1515
- 8080:8080
16-
# environment:
16+
environment:
17+
- USER_KievRPSSecAuth=xxx
1718
# - Go_Proxy_BingAI_SOCKS_URL=192.168.0.88:1070
1819
# - Go_Proxy_BingAI_SOCKS_USER=xxx
1920
# - Go_Proxy_BingAI_SOCKS_PWD=xxx

0 commit comments

Comments
 (0)