Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
railway-bot committed Dec 12, 2023
0 parents commit 1b1bb27
Show file tree
Hide file tree
Showing 128 changed files with 21,078 additions and 0 deletions.
156 changes: 156 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: Build Go-Proxy-BingAI
on:
push:
tags:
- v*

jobs:
release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false

amd64build:
name: build amd64 version
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v4

- name: build linux amd64 version
run: |
go build -ldflags="-s -w" -tags netgo -trimpath -o go-proxy-bingai main.go
- name: package linux amd64
run: tar -zcvf go-proxy-bingai-linux-amd64.tar.gz go-proxy-bingai

- name: upload linux amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: go-proxy-bingai-linux-amd64.tar.gz
asset_name: go-proxy-bingai-linux-amd64.tar.gz
asset_content_type: application/gzip

- name: build windows amd64 version
run: |
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -tags netgo -trimpath -o go-proxy-bingai.exe main.go
- name: package windows amd64
run: tar -zcvf go-proxy-bingai-windows-amd64.tar.gz go-proxy-bingai.exe

- name: upload windows amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: go-proxy-bingai-windows-amd64.tar.gz
asset_name: go-proxy-bingai-windows-amd64.tar.gz
asset_content_type: application/gzip

arm64build:
name: build arm64 version
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v4
- name: build linux arm64 version
run: |
go build -ldflags="-s -w" -tags netgo -trimpath -o go-proxy-bingai main.go
- name: package linux arm64
run: tar -zcvf go-proxy-bingai-linux-arm64.tar.gz go-proxy-bingai

- name: upload linux arm64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: go-proxy-bingai-linux-arm64.tar.gz
asset_name: go-proxy-bingai-linux-arm64.tar.gz
asset_content_type: application/gzip

- name: build windows amd64 version
run: |
GOOS=windows GOARCH=arm64 go build -ldflags="-s -w" -tags netgo -trimpath -o go-proxy-bingai.exe main.go
- name: package windows arm64
run: tar -zcvf go-proxy-bingai-windows-arm64.tar.gz go-proxy-bingai.exe

- name: upload windows arm64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: go-proxy-bingai-windows-arm64.tar.gz
asset_name: go-proxy-bingai-windows-arm64.tar.gz
asset_content_type: application/gzip

docker-build:
runs-on: ubuntu-latest

permissions:
packages: write
contents: read

steps:
- uses: actions/checkout@v3

- name: Setup timezone
uses: zcong1993/setup-timezone@master
with:
timezone: Asia/Shanghai

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
context: .
file: ./docker/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
ghcr.io/${{ github.repository }}:latest
docker.io/${{ github.repository }}:${{ github.ref_name }}
docker.io/${{ github.repository }}:latest
cache-from: type=registry,ref=${{ github.repository }}:cache
cache-to: type=registry,ref=${{ github.repository }}:cache,mode=max
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Editor directories and files
.vscode/*
!.vscode/extensions.json
!.vscode/launch.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

.DS_Store

release
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"golang.go"
]
}
25 changes: 25 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"env": {
"PORT": "8899",
"Go_Proxy_BingAI_Debug": "true",
"Go_Proxy_BingAI_SOCKS_URL": "192.168.0.88:1070",
// "Go_Proxy_BingAI_SOCKS_USER": "xxx",
// "Go_Proxy_BingAI_SOCKS_PWD": "xxx",
// "Go_Proxy_BingAI_USER_TOKEN_1": "xxx",
// "Go_Proxy_BingAI_USER_TOKEN_2": "xxx"
// "Go_Proxy_BingAI_AUTH_KEY": "xxx",
}
}
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License Copyright (c) 2023 adams549659584

Permission is hereby granted, free
of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the
following conditions:

The above copyright notice and this permission notice
(including the next paragraph) shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading

0 comments on commit 1b1bb27

Please sign in to comment.