mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-08 16:46:37 +08:00
[优化] 更新包名
This commit is contained in:
@@ -42,7 +42,7 @@ jobs:
|
|||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
justsong/gin-template
|
ghcr.io/rain-kl/atsflare
|
||||||
ghcr.io/${{ github.repository }}
|
ghcr.io/${{ github.repository }}
|
||||||
|
|
||||||
- name: Build and push Docker images
|
- name: Build and push Docker images
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ jobs:
|
|||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
justsong/gin-template
|
ghcr.io/rain-kl/atsflare
|
||||||
ghcr.io/${{ github.repository }}
|
ghcr.io/${{ github.repository }}
|
||||||
|
|
||||||
- name: Build and push Docker images
|
- name: Build and push Docker images
|
||||||
|
|||||||
@@ -33,21 +33,21 @@ jobs:
|
|||||||
- name: Build Backend (amd64)
|
- name: Build Backend (amd64)
|
||||||
run: |
|
run: |
|
||||||
go mod download
|
go mod download
|
||||||
go build -ldflags "-s -w -X 'gin-template/common.Version=$(git describe --tags)' -extldflags '-static'" -o gin-template
|
go build -ldflags "-s -w -X 'atsflare/common.Version=$(git describe --tags)' -extldflags '-static'" -o atsflare
|
||||||
|
|
||||||
- name: Build Backend (arm64)
|
- name: Build Backend (arm64)
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install gcc-aarch64-linux-gnu
|
sudo apt-get install gcc-aarch64-linux-gnu
|
||||||
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'gin-template/common.Version=$(git describe --tags)' -extldflags '-static'" -o gin-template-arm64
|
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'atsflare/common.Version=$(git describe --tags)' -extldflags '-static'" -o atsflare-arm64
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
gin-template
|
atsflare
|
||||||
gin-template-arm64
|
atsflare-arm64
|
||||||
draft: false
|
draft: false
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -33,12 +33,12 @@ jobs:
|
|||||||
- name: Build Backend
|
- name: Build Backend
|
||||||
run: |
|
run: |
|
||||||
go mod download
|
go mod download
|
||||||
go build -ldflags "-X 'gin-template/common.Version=$(git describe --tags)'" -o gin-template-macos
|
go build -ldflags "-X 'atsflare/common.Version=$(git describe --tags)'" -o atsflare-macos
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
files: gin-template-macos
|
files: atsflare-macos
|
||||||
draft: false
|
draft: false
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -36,12 +36,12 @@ jobs:
|
|||||||
- name: Build Backend
|
- name: Build Backend
|
||||||
run: |
|
run: |
|
||||||
go mod download
|
go mod download
|
||||||
go build -ldflags "-s -w -X 'gin-template/common.Version=$(git describe --tags)'" -o gin-template.exe
|
go build -ldflags "-s -w -X 'atsflare/common.Version=$(git describe --tags)'" -o atsflare.exe
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
files: gin-template.exe
|
files: atsflare.exe
|
||||||
draft: false
|
draft: false
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
env:
|
env:
|
||||||
|
|||||||
+22
-27
@@ -3,43 +3,38 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://github.com/songquanpeng/gin-template"><img src="https://raw.githubusercontent.com/songquanpeng/gin-template/main/web/public/logo.png" width="150" height="150" alt="gin-template logo"></a>
|
<a href="https://github.com/Rain-kl/ATSFlare"><img src="https://raw.githubusercontent.com/Rain-kl/ATSFlare/main/atsf_server/web/public/logo.png" width="150" height="150" alt="ATSFlare logo"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
# Gin Template
|
# ATSFlare
|
||||||
|
|
||||||
_✨ Template for Gin & React projects ✨_
|
_✨ Internal Nginx control plane for reverse proxy management ✨_
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://raw.githubusercontent.com/songquanpeng/gin-template/main/LICENSE">
|
<a href="https://raw.githubusercontent.com/Rain-kl/ATSFlare/main/LICENSE">
|
||||||
<img src="https://img.shields.io/github/license/songquanpeng/gin-template?color=brightgreen" alt="license">
|
<img src="https://img.shields.io/github/license/Rain-kl/ATSFlare?color=brightgreen" alt="license">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/songquanpeng/gin-template/releases/latest">
|
<a href="https://github.com/Rain-kl/ATSFlare/releases/latest">
|
||||||
<img src="https://img.shields.io/github/v/release/songquanpeng/gin-template?color=brightgreen&include_prereleases" alt="release">
|
<img src="https://img.shields.io/github/v/release/Rain-kl/ATSFlare?color=brightgreen&include_prereleases" alt="release">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://hub.docker.com/repository/docker/justsong/gin-template">
|
<a href="https://github.com/Rain-kl/ATSFlare/releases/latest">
|
||||||
<img src="https://img.shields.io/docker/pulls/justsong/gin-template?color=brightgreen" alt="docker pull">
|
<img src="https://img.shields.io/github/downloads/Rain-kl/ATSFlare/total?color=brightgreen&include_prereleases" alt="release">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/songquanpeng/gin-template/releases/latest">
|
<a href="https://goreportcard.com/report/github.com/Rain-kl/ATSFlare">
|
||||||
<img src="https://img.shields.io/github/downloads/songquanpeng/gin-template/total?color=brightgreen&include_prereleases" alt="release">
|
<img src="https://goreportcard.com/badge/github.com/Rain-kl/ATSFlare" alt="GoReportCard">
|
||||||
</a>
|
|
||||||
<a href="https://goreportcard.com/report/github.com/songquanpeng/go-file">
|
|
||||||
<img src="https://goreportcard.com/badge/github.com/songquanpeng/gin-template" alt="GoReportCard">
|
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://github.com/songquanpeng/gin-template/releases">Download</a>
|
<a href="https://github.com/Rain-kl/ATSFlare/releases">Download</a>
|
||||||
·
|
·
|
||||||
<a href="https://github.com/songquanpeng/gin-template/blob/main/README.en.md#deployment">Tutorial</a>
|
<a href="https://github.com/Rain-kl/ATSFlare/blob/main/README.en.md#deployment">Tutorial</a>
|
||||||
·
|
·
|
||||||
<a href="https://github.com/songquanpeng/gin-template/issues">Feedback</a>
|
<a href="https://github.com/Rain-kl/ATSFlare/issues">Feedback</a>
|
||||||
·
|
|
||||||
<a href="https://gin-template.vercel.app/">Demo</a>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
@@ -57,23 +52,23 @@ _✨ Template for Gin & React projects ✨_
|
|||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
### Manual deployment
|
### Manual deployment
|
||||||
1. Download built binary from [GitHub Releases](https://github.com/songquanpeng/gin-template/releases/latest) or build from source:
|
1. Download built binary from [GitHub Releases](https://github.com/Rain-kl/ATSFlare/releases/latest) or build from source:
|
||||||
```shell
|
```shell
|
||||||
git clone https://github.com/songquanpeng/gin-template.git
|
git clone https://github.com/Rain-kl/ATSFlare.git
|
||||||
go mod download
|
go mod download
|
||||||
go build -ldflags "-s -w" -o gin-template
|
go build -ldflags "-s -w" -o atsflare
|
||||||
````
|
````
|
||||||
2. Run it:
|
2. Run it:
|
||||||
```shell
|
```shell
|
||||||
chmod u+x gin-template
|
chmod u+x atsflare
|
||||||
./gin-template --port 3000 --log-dir ./logs
|
./atsflare --port 3000 --log-dir ./logs
|
||||||
```
|
```
|
||||||
3. Visit [http://localhost:3000/](http://localhost:3000/) and login. The username for the initial account is `root` and the password is `123456`.
|
3. Visit [http://localhost:3000/](http://localhost:3000/) and login. The username for the initial account is `root` and the password is `123456`.
|
||||||
|
|
||||||
### Deploy with Docker
|
### Deploy with Docker
|
||||||
Execute: `docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/gin-template:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/gin-template`
|
Execute: `docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/atsflare:/data -v /etc/ssl/certs:/etc/ssl/certs:ro ghcr.io/rain-kl/atsflare`
|
||||||
|
|
||||||
Data will be saved in `/home/ubuntu/data/gin-template`.
|
Data will be saved in `/home/ubuntu/data/atsflare`.
|
||||||
|
|
||||||
## Configurations
|
## Configurations
|
||||||
The system works out of the box.
|
The system works out of the box.
|
||||||
@@ -88,7 +83,7 @@ After the system starts, use `root` user to log in to the system and do further
|
|||||||
2. `SESSION_SECRET`: when set, a fixed session key will be used so that the logged-in users' cookie remains valid across system reboots.
|
2. `SESSION_SECRET`: when set, a fixed session key will be used so that the logged-in users' cookie remains valid across system reboots.
|
||||||
+ Example: `SESSION_SECRET=random_string`
|
+ Example: `SESSION_SECRET=random_string`
|
||||||
3. `SQL_DSN`: when set, the target SQL database will be used instead of SQLite.
|
3. `SQL_DSN`: when set, the target SQL database will be used instead of SQLite.
|
||||||
+ Example: `SQL_DSN=root:123456@tcp(localhost:3306)/gin-template`
|
+ Example: `SQL_DSN=root:123456@tcp(localhost:3306)/atsflare`
|
||||||
|
|
||||||
### Command line Arguments
|
### Command line Arguments
|
||||||
1. `--port <port_number>`: specify the port number, the default value is `3000`.
|
1. `--port <port_number>`: specify the port number, the default value is `3000`.
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ WORKDIR /build
|
|||||||
COPY . .
|
COPY . .
|
||||||
COPY --from=builder /build/build ./web/build
|
COPY --from=builder /build/build ./web/build
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
RUN go build -ldflags "-s -w -X 'gin-template/common.Version=$(cat VERSION)' -extldflags '-static'" -o gin-template
|
RUN go build -ldflags "-s -w -X 'atsflare/common.Version=$(cat VERSION)' -extldflags '-static'" -o atsflare
|
||||||
|
|
||||||
FROM alpine
|
FROM alpine
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ RUN apk update \
|
|||||||
&& apk add --no-cache ca-certificates tzdata \
|
&& apk add --no-cache ca-certificates tzdata \
|
||||||
&& update-ca-certificates 2>/dev/null || true
|
&& update-ca-certificates 2>/dev/null || true
|
||||||
ENV PORT=3000
|
ENV PORT=3000
|
||||||
COPY --from=builder2 /build/gin-template /
|
COPY --from=builder2 /build/atsflare /
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
WORKDIR /data
|
WORKDIR /data
|
||||||
ENTRYPOINT ["/gin-template"]
|
ENTRYPOINT ["/atsflare"]
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ var (
|
|||||||
var UploadPath = "upload"
|
var UploadPath = "upload"
|
||||||
|
|
||||||
func printHelp() {
|
func printHelp() {
|
||||||
fmt.Println("Gin Template " + Version + " - Your next project starts from here.")
|
fmt.Println("ATSFlare " + Version + " - Internal Nginx Control Plane.")
|
||||||
fmt.Println("Copyright (C) 2023 JustSong. All rights reserved.")
|
fmt.Println("Copyright (C) 2023 JustSong. All rights reserved.")
|
||||||
fmt.Println("GitHub: https://github.com/songquanpeng/gin-template")
|
fmt.Println("GitHub: https://github.com/Rain-kl/ATSFlare")
|
||||||
fmt.Println("Usage: gin-template [--port <port>] [--log-dir <log directory>] [--version] [--help]")
|
fmt.Println("Usage: atsflare [--port <port>] [--log-dir <log directory>] [--version] [--help]")
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/model"
|
||||||
|
"atsflare/service"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gin-template/model"
|
|
||||||
"gin-template/service"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gin-template/service"
|
"atsflare/service"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/common"
|
||||||
|
"atsflare/model"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gin-template/common"
|
|
||||||
"gin-template/model"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/common"
|
||||||
|
"atsflare/model"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gin-template/common"
|
|
||||||
"gin-template/model"
|
|
||||||
"github.com/gin-contrib/sessions"
|
"github.com/gin-contrib/sessions"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/service"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gin-template/service"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/common"
|
||||||
|
"atsflare/model"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gin-template/common"
|
|
||||||
"gin-template/model"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/service"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gin-template/service"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/common"
|
||||||
|
"atsflare/model"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gin-template/common"
|
|
||||||
"gin-template/model"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/service"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gin-template/service"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/service"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gin-template/service"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/common"
|
||||||
|
"atsflare/model"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gin-template/common"
|
|
||||||
"gin-template/model"
|
|
||||||
"github.com/gin-contrib/sessions"
|
"github.com/gin-contrib/sessions"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/common"
|
||||||
|
"atsflare/model"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gin-template/common"
|
|
||||||
"gin-template/model"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
module gin-template
|
module atsflare
|
||||||
|
|
||||||
// +heroku goVersion go1.18
|
// +heroku goVersion go1.18
|
||||||
go 1.18
|
go 1.18
|
||||||
|
|||||||
+5
-5
@@ -1,12 +1,12 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/common"
|
||||||
|
"atsflare/middleware"
|
||||||
|
"atsflare/model"
|
||||||
|
"atsflare/router"
|
||||||
"embed"
|
"embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gin-template/common"
|
|
||||||
"gin-template/middleware"
|
|
||||||
"gin-template/model"
|
|
||||||
"gin-template/router"
|
|
||||||
"github.com/gin-contrib/sessions"
|
"github.com/gin-contrib/sessions"
|
||||||
"github.com/gin-contrib/sessions/cookie"
|
"github.com/gin-contrib/sessions/cookie"
|
||||||
"github.com/gin-contrib/sessions/redis"
|
"github.com/gin-contrib/sessions/redis"
|
||||||
@@ -24,7 +24,7 @@ var indexPage []byte
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
common.SetupGinLog()
|
common.SetupGinLog()
|
||||||
common.SysLog("Gin Template " + common.Version + " started")
|
common.SysLog("ATSFlare " + common.Version + " started")
|
||||||
if os.Getenv("GIN_MODE") != "debug" {
|
if os.Getenv("GIN_MODE") != "debug" {
|
||||||
gin.SetMode(gin.ReleaseMode)
|
gin.SetMode(gin.ReleaseMode)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package middleware
|
package middleware
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gin-template/service"
|
"atsflare/service"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package middleware
|
package middleware
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gin-template/common"
|
"atsflare/common"
|
||||||
"gin-template/model"
|
"atsflare/model"
|
||||||
"github.com/gin-contrib/sessions"
|
"github.com/gin-contrib/sessions"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ import (
|
|||||||
|
|
||||||
func CORS() gin.HandlerFunc {
|
func CORS() gin.HandlerFunc {
|
||||||
config := cors.DefaultConfig()
|
config := cors.DefaultConfig()
|
||||||
config.AllowOrigins = []string{"https://gin-template.vercel.app", "http://localhost:3000/"}
|
config.AllowOrigins = []string{"https://atsflare.vercel.app", "http://localhost:3000/"}
|
||||||
return cors.New(config)
|
return cors.New(config)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package middleware
|
package middleware
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/common"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gin-template/common"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package middleware
|
package middleware
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/common"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gin-template/common"
|
|
||||||
"github.com/gin-contrib/sessions"
|
"github.com/gin-contrib/sessions"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gin-template/common"
|
"atsflare/common"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gin-template/common"
|
"atsflare/common"
|
||||||
"github.com/glebarez/sqlite"
|
"github.com/glebarez/sqlite"
|
||||||
"gorm.io/driver/mysql"
|
"gorm.io/driver/mysql"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gin-template/common"
|
"atsflare/common"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/common"
|
||||||
"errors"
|
"errors"
|
||||||
"gin-template/common"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package router
|
package router
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gin-template/controller"
|
"atsflare/controller"
|
||||||
"gin-template/middleware"
|
"atsflare/middleware"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package router_test
|
package router_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/common"
|
||||||
|
"atsflare/model"
|
||||||
|
"atsflare/router"
|
||||||
|
"atsflare/service"
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/rsa"
|
"crypto/rsa"
|
||||||
@@ -8,10 +12,6 @@ import (
|
|||||||
"crypto/x509/pkix"
|
"crypto/x509/pkix"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"gin-template/common"
|
|
||||||
"gin-template/model"
|
|
||||||
"gin-template/router"
|
|
||||||
"gin-template/service"
|
|
||||||
"github.com/gin-contrib/sessions"
|
"github.com/gin-contrib/sessions"
|
||||||
"github.com/gin-contrib/sessions/cookie"
|
"github.com/gin-contrib/sessions/cookie"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package router_test
|
package router_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gin-template/common"
|
"atsflare/common"
|
||||||
"gin-template/router"
|
"atsflare/router"
|
||||||
"github.com/gin-contrib/sessions"
|
"github.com/gin-contrib/sessions"
|
||||||
"github.com/gin-contrib/sessions/cookie"
|
"github.com/gin-contrib/sessions/cookie"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package router_test
|
package router_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/common"
|
||||||
|
"atsflare/model"
|
||||||
|
"atsflare/router"
|
||||||
|
"atsflare/service"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"gin-template/common"
|
|
||||||
"gin-template/model"
|
|
||||||
"gin-template/router"
|
|
||||||
"gin-template/service"
|
|
||||||
"github.com/gin-contrib/sessions"
|
"github.com/gin-contrib/sessions"
|
||||||
"github.com/gin-contrib/sessions/cookie"
|
"github.com/gin-contrib/sessions/cookie"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package router
|
package router
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/common"
|
||||||
|
"atsflare/controller"
|
||||||
|
"atsflare/middleware"
|
||||||
"embed"
|
"embed"
|
||||||
"gin-template/common"
|
|
||||||
"gin-template/controller"
|
|
||||||
"gin-template/middleware"
|
|
||||||
"github.com/gin-contrib/static"
|
"github.com/gin-contrib/static"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/common"
|
||||||
|
"atsflare/model"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"gin-template/common"
|
|
||||||
"gin-template/model"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/model"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gin-template/model"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/common"
|
||||||
|
"atsflare/model"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/rsa"
|
"crypto/rsa"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"crypto/x509/pkix"
|
"crypto/x509/pkix"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"gin-template/common"
|
|
||||||
"gin-template/model"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/model"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gin-template/model"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/common"
|
||||||
|
"atsflare/model"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"gin-template/common"
|
|
||||||
"gin-template/model"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/model"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"gin-template/model"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"atsflare/model"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"gin-template/model"
|
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -41,9 +41,7 @@ function App() {
|
|||||||
const res = await API.get('/api/status');
|
const res = await API.get('/api/status');
|
||||||
const { success, data } = res.data;
|
const { success, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
console.log(
|
console.log(`GitHub 仓库地址:https://github.com/Rain-kl/ATSFlare`);
|
||||||
`GitHub 仓库地址:https://github.com/songquanpeng/gin-template`
|
|
||||||
);
|
|
||||||
localStorage.setItem('status', JSON.stringify(data));
|
localStorage.setItem('status', JSON.stringify(data));
|
||||||
statusDispatch({ type: 'set', payload: data });
|
statusDispatch({ type: 'set', payload: data });
|
||||||
localStorage.setItem('system_name', data.system_name);
|
localStorage.setItem('system_name', data.system_name);
|
||||||
|
|||||||
@@ -18,16 +18,13 @@ const Footer = () => {
|
|||||||
) : (
|
) : (
|
||||||
<div className='custom-footer'>
|
<div className='custom-footer'>
|
||||||
<a
|
<a
|
||||||
href='https://github.com/songquanpeng/gin-template'
|
href='https://github.com/Rain-kl/ATSFlare'
|
||||||
target='_blank'
|
target='_blank'
|
||||||
|
rel='noreferrer'
|
||||||
>
|
>
|
||||||
{systemName} {process.env.REACT_APP_VERSION}{' '}
|
{systemName} {process.env.REACT_APP_VERSION}{' '}
|
||||||
</a>
|
</a>
|
||||||
由{' '}
|
开源于 GitHub,源代码遵循{' '}
|
||||||
<a href='https://github.com/songquanpeng' target='_blank'>
|
|
||||||
JustSong
|
|
||||||
</a>{' '}
|
|
||||||
构建,源代码遵循{' '}
|
|
||||||
<a href='https://opensource.org/licenses/mit-license.php'>
|
<a href='https://opensource.org/licenses/mit-license.php'>
|
||||||
MIT 协议
|
MIT 协议
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -78,13 +78,12 @@ const OtherSetting = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const openGitHubRelease = () => {
|
const openGitHubRelease = () => {
|
||||||
window.location =
|
window.location = 'https://github.com/Rain-kl/ATSFlare/releases/latest';
|
||||||
'https://github.com/songquanpeng/gin-template/releases/latest';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkUpdate = async () => {
|
const checkUpdate = async () => {
|
||||||
const res = await API.get(
|
const res = await API.get(
|
||||||
'https://api.github.com/repos/songquanpeng/gin-template/releases/latest'
|
'https://api.github.com/repos/Rain-kl/ATSFlare/releases/latest'
|
||||||
);
|
);
|
||||||
const { tag_name, body } = res.data;
|
const { tag_name, body } = res.data;
|
||||||
if (tag_name === process.env.REACT_APP_VERSION) {
|
if (tag_name === process.env.REACT_APP_VERSION) {
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ const About = () => {
|
|||||||
<Header as='h3'>关于</Header>
|
<Header as='h3'>关于</Header>
|
||||||
<p>可在设置页面设置关于内容,支持 HTML & Markdown</p>
|
<p>可在设置页面设置关于内容,支持 HTML & Markdown</p>
|
||||||
项目仓库地址:
|
项目仓库地址:
|
||||||
<a href='https://github.com/songquanpeng/gin-template'>
|
<a href='https://github.com/Rain-kl/ATSFlare'>
|
||||||
https://github.com/songquanpeng/gin-template
|
https://github.com/Rain-kl/ATSFlare
|
||||||
</a>
|
</a>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -54,10 +54,10 @@ const Home = () => {
|
|||||||
<p>
|
<p>
|
||||||
源码:
|
源码:
|
||||||
<a
|
<a
|
||||||
href='https://github.com/songquanpeng/gin-template'
|
href='https://github.com/Rain-kl/ATSFlare'
|
||||||
target='_blank'
|
target='_blank'
|
||||||
>
|
>
|
||||||
https://github.com/songquanpeng/gin-template
|
https://github.com/Rain-kl/ATSFlare
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<p>启动时间:{getStartTimeString()}</p>
|
<p>启动时间:{getStartTimeString()}</p>
|
||||||
|
|||||||
+2
-2
@@ -40,13 +40,13 @@ npm run build
|
|||||||
```bash
|
```bash
|
||||||
cd atsf_server
|
cd atsf_server
|
||||||
export SESSION_SECRET='replace-with-random-string'
|
export SESSION_SECRET='replace-with-random-string'
|
||||||
export SQLITE_PATH='./gin-template.db'
|
export SQLITE_PATH='./atsflare.db'
|
||||||
go run .
|
go run .
|
||||||
```
|
```
|
||||||
|
|
||||||
说明:
|
说明:
|
||||||
|
|
||||||
- 如果未设置 `SQLITE_PATH`,默认也会落到 `atsf_server/gin-template.db`
|
- 如果未设置 `SQLITE_PATH`,默认也会落到 `atsf_server/atsflare.db`
|
||||||
- 当前不再依赖全局 `AGENT_TOKEN` 环境变量
|
- 当前不再依赖全局 `AGENT_TOKEN` 环境变量
|
||||||
- 节点接入凭证改由数据库保存:节点专属 `agent_token` + 系统级 `discovery token`
|
- 节点接入凭证改由数据库保存:节点专属 `agent_token` + 系统级 `discovery token`
|
||||||
- 当前默认监听端口为 `3000`
|
- 当前默认监听端口为 `3000`
|
||||||
|
|||||||
+5
-5
@@ -94,12 +94,12 @@
|
|||||||
|
|
||||||
### Server
|
### Server
|
||||||
|
|
||||||
控制中心直接基于现有 `atsf_server` 的 `gin-template` 工程开发:
|
控制中心直接基于现有 `atsf_server` 的 `ATSFlare` 工程开发:
|
||||||
|
|
||||||
* Web 框架:Gin
|
* Web 框架:Gin
|
||||||
* ORM:GORM
|
* ORM:GORM
|
||||||
* 前端:沿用现有 web 管理端
|
* 前端:沿用现有 web 管理端
|
||||||
* 鉴权:沿用 gin-template 登录体系
|
* 鉴权:沿用 ATSFlare 登录体系
|
||||||
|
|
||||||
### 数据库
|
### 数据库
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ Agent 使用 Go 单体程序:
|
|||||||
```text
|
```text
|
||||||
┌────────────────────────────┐
|
┌────────────────────────────┐
|
||||||
│ ATSFlare Server │
|
│ ATSFlare Server │
|
||||||
│ gin-template + SQLite │
|
│ ATSFlare + SQLite │
|
||||||
│ Admin UI + Admin API │
|
│ Admin UI + Admin API │
|
||||||
└──────────────┬─────────────┘
|
└──────────────┬─────────────┘
|
||||||
│
|
│
|
||||||
@@ -548,7 +548,7 @@ Agent 每次上报:
|
|||||||
|
|
||||||
管理端:
|
管理端:
|
||||||
|
|
||||||
* 直接沿用 gin-template 的登录态
|
* 直接沿用 ATSFlare 的登录态
|
||||||
|
|
||||||
Agent(第一版):
|
Agent(第一版):
|
||||||
|
|
||||||
@@ -567,7 +567,7 @@ Agent(第二版):
|
|||||||
|
|
||||||
### 12.1 登录页
|
### 12.1 登录页
|
||||||
|
|
||||||
沿用 gin-template 现有登录。
|
沿用 ATSFlare 现有登录。
|
||||||
|
|
||||||
### 12.2 反代规则页(第一版,已实现)
|
### 12.2 反代规则页(第一版,已实现)
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
* ORM:GORM
|
* ORM:GORM
|
||||||
* 数据库:SQLite
|
* 数据库:SQLite
|
||||||
* 前端:现有 `atsf_server/web`
|
* 前端:现有 `atsf_server/web`
|
||||||
* 登录体系:沿用 gin-template 现有能力
|
* 登录体系:沿用 ATSFlare 现有能力
|
||||||
|
|
||||||
约束:
|
约束:
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ Agent 放在 `atsf_agent`,使用 Go 单体程序开发。
|
|||||||
* 所有发布都是"新版本激活",不是在线覆盖编辑。
|
* 所有发布都是"新版本激活",不是在线覆盖编辑。
|
||||||
* 第一版与第二版:所有节点默认拉同一份全量配置,不做节点分组差异化下发。
|
* 第一版与第二版:所有节点默认拉同一份全量配置,不做节点分组差异化下发。
|
||||||
* 能用 SQLite 解决的问题,不引入额外中间件。
|
* 能用 SQLite 解决的问题,不引入额外中间件。
|
||||||
* 新功能优先复用现有 gin-template 结构,不平行造第二套框架。
|
* 新功能优先复用现有 ATSFlare 结构,不平行造第二套框架。
|
||||||
|
|
||||||
## 5. 数据模型规范
|
## 5. 数据模型规范
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ Server 代码按以下职责拆分:
|
|||||||
|
|
||||||
管理端:
|
管理端:
|
||||||
|
|
||||||
* 继续复用 gin-template 的登录、角色和 session 体系
|
* 继续复用 ATSFlare 的登录、角色和 session 体系
|
||||||
|
|
||||||
Agent(第一版):
|
Agent(第一版):
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ MVP 已于第一版完成。当前进入第二版迭代。
|
|||||||
* 节点配置文件填写节点专属 `agent_token` 时,可直接上线;若 `agent_token` 为空且填写全局 discovery token,则会自动注册并完成 token 置换
|
* 节点配置文件填写节点专属 `agent_token` 时,可直接上线;若 `agent_token` 为空且填写全局 discovery token,则会自动注册并完成 token 置换
|
||||||
|
|
||||||
|
|
||||||
### V2 Phase 4: 路由自定义头
|
### V2 Phase 4: 路由自定义头 ✅
|
||||||
|
|
||||||
目标:
|
目标:
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ MVP 已于第一版完成。当前进入第二版迭代。
|
|||||||
* 路由配置自定义头后发布,渲染结果包含对应 `proxy_set_header` 指令
|
* 路由配置自定义头后发布,渲染结果包含对应 `proxy_set_header` 指令
|
||||||
* 不配置自定义头的路由渲染行为与之前保持一致
|
* 不配置自定义头的路由渲染行为与之前保持一致
|
||||||
|
|
||||||
### V2 Phase 5: 配置预览与变更摘要
|
### V2 Phase 5: 配置预览与变更摘要 ✅
|
||||||
|
|
||||||
目标:
|
目标:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user