Skip to content

Commit b807e7b

Browse files
feat: ✨ BingAI Proxy
0 parents  commit b807e7b

File tree

19 files changed

+1223
-0
lines changed

19 files changed

+1223
-0
lines changed

.github/workflows/build.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Build Go-Proxy-BingAI
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
upload_url: ${{ steps.create_release.outputs.upload_url }}
12+
steps:
13+
- name: Create Release
14+
id: create_release
15+
uses: actions/create-release@v1
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
18+
with:
19+
tag_name: ${{ github.ref }}
20+
release_name: ${{ github.ref }}
21+
draft: false
22+
prerelease: false
23+
24+
linuxamd64build:
25+
name: build amd64 version
26+
needs: release
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v2
30+
- name: Set up Go
31+
uses: actions/setup-go@v4
32+
- name: build linux amd64 version
33+
run: |
34+
go build -ldflags="-s -w" -tags netgo -trimpath -o go-proxy-bingai main.go
35+
36+
- name: package
37+
run: tar -zcvf go-proxy-bingai-linux-amd64.tar.gz go-proxy-bingai
38+
- name: upload
39+
uses: actions/upload-release-asset@v1
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
42+
with:
43+
upload_url: ${{ needs.release.outputs.upload_url }}
44+
asset_path: go-proxy-bingai-linux-amd64.tar.gz
45+
asset_name: go-proxy-bingai-linux-amd64.tar.gz
46+
asset_content_type: application/gzip
47+
48+
linuxarm64build:
49+
name: build arm64 version
50+
needs: release
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v2
54+
- name: Set up Go
55+
uses: actions/setup-go@v4
56+
- name: build linux arm64 version
57+
run: |
58+
go build -ldflags="-s -w" -tags netgo -trimpath -o go-proxy-bingai main.go
59+
60+
- name: package
61+
run: tar -zcvf go-proxy-bingai-linux-arm64.tar.gz go-proxy-bingai
62+
- name: upload
63+
uses: actions/upload-release-asset@v1
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
66+
with:
67+
upload_url: ${{ needs.release.outputs.upload_url }}
68+
asset_path: go-proxy-bingai-linux-arm64.tar.gz
69+
asset_name: go-proxy-bingai-linux-arm64.tar.gz
70+
asset_content_type: application/gzip
71+
72+
docker-build:
73+
runs-on: ubuntu-latest
74+
75+
permissions:
76+
packages: write
77+
contents: read
78+
79+
steps:
80+
- uses: actions/checkout@v3
81+
82+
- name: Setup timezone
83+
uses: zcong1993/setup-timezone@master
84+
with:
85+
timezone: Asia/Shanghai
86+
87+
- name: Login to GHCR
88+
uses: docker/login-action@v2
89+
with:
90+
registry: ghcr.io
91+
username: ${{ github.repository_owner }}
92+
password: ${{ secrets.GH_TOKEN }}
93+
94+
- name: Set up QEMU
95+
uses: docker/setup-qemu-action@v2
96+
97+
- name: Set up Docker Buildx
98+
uses: docker/setup-buildx-action@v2
99+
100+
- name: Login to Docker Hub
101+
uses: docker/login-action@v2
102+
with:
103+
username: ${{ secrets.DOCKERHUB_USERNAME }}
104+
password: ${{ secrets.DOCKERHUB_TOKEN }}
105+
106+
- name: Build and push
107+
uses: docker/build-push-action@v4
108+
with:
109+
platforms: linux/amd64,linux/arm64
110+
context: .
111+
file: ./docker/Dockerfile
112+
push: true
113+
tags: |
114+
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
115+
ghcr.io/${{ github.repository }}:latest
116+
docker.io/${{ github.repository }}:${{ github.ref_name }}
117+
docker.io/${{ github.repository }}:latest
118+
cache-from: type=registry,ref=${{ github.repository }}:cache
119+
cache-to: type=registry,ref=${{ github.repository }}:cache,mode=max

.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// 使用 IntelliSense 了解相关属性。
3+
// 悬停以查看现有属性的描述。
4+
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch Package",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "auto",
12+
"program": "${workspaceFolder}",
13+
}
14+
]
15+
}

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# go-proxy-bing
2+
3+
一个用 GO 写的微软 Bing AI 的代理服务。 使用微软原始页面简单定制,基本兼容微软 Bing AI 所有功能。
4+
5+
- 电脑端已登录状态
6+
7+
![电脑已登录](./docs/img/1.png)
8+
9+
- 电脑端未登录状态
10+
11+
![电脑未登录](./docs/img/2.png)
12+
13+
- 手机端已登录状态
14+
15+
![手机已登录](./docs/img/3.png)
16+
17+
- 手机端未登录状态
18+
19+
![手机未登录](./docs/img/4.png)
20+
21+
### 演示站点:
22+
23+
> 甲骨文小鸡仔,轻虐
24+
25+
- https://bing.vcanbb.top
26+
27+
### 获取cookies
28+
29+
- 访问 https://www.bing.com/https://cn.bing.com/ ,登录
30+
31+
- F12 或 Ctrl + Shift + I 打开控制台
32+
33+
- 拿到 Cookie 后,在网站设置用户Cookie弹窗填入即可。
34+
35+
![获取Cookie](./docs/img/5.png)
36+
37+
### 部署
38+
39+
> 需 https 域名
40+
41+
- docker 部署 , 参考 [Dockerfile](./docker/Dockerfile)[docker-compose.yml](./docker/docker-compose.yml)

docker/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM golang:alpine AS builder
2+
WORKDIR /app
3+
COPY . .
4+
RUN go build -ldflags="-s -w" -tags netgo -trimpath -o go-proxy-bingai main.go
5+
6+
FROM alpine
7+
WORKDIR /app
8+
COPY --from=builder /app/go-proxy-bingai .
9+
10+
EXPOSE 8080
11+
CMD ["/app/go-proxy-bingai"]

docker/docker-compose.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: '3'
2+
3+
services:
4+
go-proxy-bingai:
5+
# 镜像名称
6+
image: adams549659584/go-proxy-bingai
7+
# 容器名称
8+
container_name: go-proxy-bingai
9+
# 自启动
10+
restart: unless-stopped
11+
ports:
12+
- 8080:8080
13+
14+
# go-proxy-bingai:
15+
# # 镜像名称
16+
# image: adams549659584/go-proxy-bingai
17+
# # 容器名称
18+
# container_name: go-proxy-bingai
19+
# build:
20+
# context: ../
21+
# dockerfile: docker/Dockerfile
22+
# # 自启动
23+
# restart: unless-stopped
24+
# # 加入指定网络
25+
# networks:
26+
# - MyNetwork
27+
# ports:
28+
# - 8888:8080
29+
30+
# networks:
31+
# MyNetwork:
32+
# external: true
33+

docs/img/1.png

170 KB
Loading

docs/img/2.png

137 KB
Loading

docs/img/3.png

86 KB
Loading

docs/img/4.png

63.9 KB
Loading

docs/img/5.png

312 KB
Loading

go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module adams549659584/go-proxy-bingai
2+
3+
go 1.20
4+
5+
require github.com/andybalholm/brotli v1.0.5

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
2+
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=

0 commit comments

Comments
 (0)