[优化] 目录调整

This commit is contained in:
ryan
2026-06-06 16:08:40 +08:00
parent 314229b7ee
commit 959b134d67
230 changed files with 468 additions and 296 deletions
+2 -3
View File
@@ -135,7 +135,6 @@ jobs:
go-version-file: go.mod
- name: Build Server
working-directory: openflare-server
env:
CGO_ENABLED: 0
GOOS: ${{ matrix.goos }}
@@ -144,8 +143,8 @@ jobs:
VERSION: ${{ needs.prepare.outputs.version }}
run: |
go mod download
mkdir -p ../dist
go build -trimpath -ldflags "-s -w -X 'github.com/rain-kl/openflare/openflare-server/common.Version=$VERSION'" -o "../dist/$ASSET_NAME" .
mkdir -p dist
go build -trimpath -ldflags "-s -w -X 'github.com/rain-kl/openflare/openflare-server/internal/common.Version=$VERSION'" -o "dist/$ASSET_NAME" ./openflare-server/cmd/server
- name: Upload Binary Artifact
uses: actions/upload-artifact@v4
+3
View File
@@ -16,6 +16,9 @@ sidebar: false
## [Unreleased]
### 变更
- 标准化 Server Go 目录结构,引入 `cmd/server`、`openflare-server/internal` 与根级 `pkg` 分层,并拆分原 `utils` 公共能力包。
## [v2.3.3] - 2026-06-06
+1
View File
@@ -82,6 +82,7 @@ OpenResty (Agent, TLS/WAF)
* 包含配置编译器(Compiler),将数据库中的规则、证书与全局参数统一编译为不可变的配置快照及 OpenResty 物理配置文件文本。
* 存储 Pages 部署 ZIP 包于本地 Artifacts 目录,并向 Agent 提供受控的下载接口。
* 后台集成 Uptime Kuma 监控同步服务,自动为可用站点维护 HTTP 探测任务。
* Go 物理结构采用 `cmd/server` 启动入口、`internal` 私有应用层与根级 `pkg` 共享能力包,跨组件协议类型统一放在 `pkg/protocol`。
* *详细设计请参阅:[Agent 与发布模型设计](./agent-design.md) 以及 [Uptime Kuma 监控同步设计](./kuma-design.md)*
### 2. Agent (配置落地端)
+20 -15
View File
@@ -68,6 +68,7 @@ OpenFlare 适合需要统一管理多台 OpenResty 代理节点的团队,具
| ---------------------- | ---------------------------------------------------- |
| `openflare-server` | Gin + GORM + SQLite/PostgreSQL 单体控制面 |
| `openflare-server/web` | Next.js 15 App Router 管理端前端,由 Go Server 托管 |
| `pkg` | 跨组件复用的协议类型与通用工具包 |
| `openflare-agent` | Go 单体 Agent,运行在节点侧 |
| `openflare-relay` | Tunnel 中继代理,运行在公网边缘管理 frps 进程 |
| `openflared` | Tunnel 客户端,运行在内网服务器侧管理 frpc 进程 |
@@ -77,21 +78,25 @@ OpenFlare 适合需要统一管理多台 OpenResty 代理节点的团队,具
### 1. Server 分层 (`openflare-server/`)
| 目录 | 职责 |
| ------------- | ------------------------------------------------ |
| `controller/` | 参数解析、调用 service、返回响应 |
| `service/` | 业务逻辑、校验、事务编排、配置渲染 |
| `model/` | 纯净实体模型类定义、旧迁移框架兼容与上下文注入 |
| `model/goose/` | goose 迁移提供者、桥接逻辑、注册入口与具体迁移文件 |
| `router/` | 路由注册 |
| `middleware/` | 认证、鉴权、限流、CORS、Turnstile 验证等横切逻辑 |
| `common/` | 配置、全局状态与初始化入口 |
| `utils/` | 纯工具函数与通用 helper |
| `job/` | 定时任务(各业务定时逻辑在独立文件中定义,cron.go 仅用于初始化调度) |
| `upload/` | 运行时本地临时文件上传目录(在 .gitignore 中忽略) |
| `logs/` | 运行时本地日志输出目录(在 .gitignore 中忽略) |
| `docs/` | API 文档(Swagger) |
| `data/` | 静态数据(如 GeoIP 数据库) |
| 目录 | 职责 |
| ----------------------- | ------------------------------------------------ |
| `cmd/server/` | Server 命令行启动入口及主函数 |
| `internal/controller/` | 参数解析、调用 service、返回响应 |
| `internal/service/` | 业务逻辑、校验、事务编排、配置渲染 |
| `internal/model/` | 纯净实体模型类定义、旧迁移框架兼容与上下文注入 |
| `internal/model/goose/` | goose 迁移提供者、桥接逻辑、注册入口与具体迁移文件 |
| `internal/router/` | 路由注册 |
| `internal/middleware/` | 认证、鉴权、限流、CORS、Turnstile 验证等横切逻辑 |
| `internal/common/` | 配置、全局状态与初始化入口 |
| `internal/job/` | 定时任务(各业务定时逻辑在独立文件中定义,cron.go 仅用于初始化调度) |
| `internal/utils/` | 仅 Server 内部使用的基础能力包,如 ACME、限流、验证码、邮件、安全校验等 |
| `pkg/protocol/` | Server、Relay、OpenFlared 之间共享的 HTTP/WS 协议结构 |
| `pkg/utils/` | 跨组件可复用的纯工具函数 |
| `pkg/geoip`、`pkg/render`、`pkg/wsclient` | 被多个组件复用的 GeoIP、OpenResty 配置渲染与 WebSocket 客户端能力 |
| `upload/` | 运行时本地临时文件上传目录(在 .gitignore 中忽略) |
| `logs/` | 运行时本地日志输出目录(在 .gitignore 中忽略) |
| `docs/` | API 文档(Swagger) |
| `data/` | 静态数据(如 GeoIP 数据库) |
### 2. Agent 模块 (`openflare-agent/`)
+5 -5
View File
@@ -76,20 +76,20 @@ Frontend:
任何涉及表结构、索引、列类型、分表规则或内部持久化元数据的修改,都必须同步提升数据库版本号。
数据库版本号定义在 `openflare-server/model`,不得只依赖 `AutoMigrate` 隐式升级存量数据库。
数据库版本号定义在 `openflare-server/internal/model`,不得只依赖 `AutoMigrate` 隐式升级存量数据库。
每次提升数据库版本号时,必须补充从上一版本升级到新版本的显式迁移方法。迁移方法必须包含升级后的校验逻辑;只有校验通过,才能写入新的数据库版本记录。
数据库升级统一使用 goose。新的 goose provider、桥接逻辑、注册入口和具体迁移文件必须全部放在 `openflare-server/model/goose` 包下,`openflare-server/model` 根包只保留纯净实体类、旧框架兼容适配和必要的上下文注入。每次新增数据库升级都必须新建一个单独的 Go 文件,文件名使用 `openflare-server/model/goose/goose_<timestamp>_<description>.go`,例如 `openflare-server/model/goose/goose_202606020001_add_node_capabilities_json.go`。迁移文件必须同时包含该版本的 goose migration 构造函数、升级逻辑和校验逻辑;`model/goose/migrations.go` 只能作为注册入口和公共构造工具,禁止把具体迁移逻辑集中堆放在该文件中。
数据库升级统一使用 goose。新的 goose provider、桥接逻辑、注册入口和具体迁移文件必须全部放在 `openflare-server/internal/model/goose` 包下,`openflare-server/internal/model` 根包只保留纯净实体类、旧框架兼容适配和必要的上下文注入。每次新增数据库升级都必须新建一个单独的 Go 文件,文件名使用 `openflare-server/internal/model/goose/goose_<timestamp>_<description>.go`,例如 `openflare-server/internal/model/goose/goose_202606020001_add_node_capabilities_json.go`。迁移文件必须同时包含该版本的 goose migration 构造函数、升级逻辑和校验逻辑;`model/goose/migrations.go` 只能作为注册入口和公共构造工具,禁止把具体迁移逻辑集中堆放在该文件中。
执行数据库升级时必须按以下步骤完成:
1. 判断是否需要升级数据库版本:凡是新增/删除/重命名表、字段、索引、约束、列类型、分表规则,或改变持久化数据语义,都必须升级。
2. 新增 `openflare-server/model/goose/goose_<timestamp>_<description>.go`,其中 `<timestamp>` 为 goose 版本号。文件头部或迁移构造函数附近必须包含注释,说明本次升级了什么内容,以及为什么需要升级。
3. 在该文件中实现独立迁移构造函数,并返回通过 `newGORMMigration(...)` 创建的 migration;随后只在 `openflare-server/model/goose/migrations.go` 的 `registeredMigrations(...)` 中新增一条注册项。
2. 新增 `openflare-server/internal/model/goose/goose_<timestamp>_<description>.go`,其中 `<timestamp>` 为 goose 版本号。文件头部或迁移构造函数附近必须包含注释,说明本次升级了什么内容,以及为什么需要升级。
3. 在该文件中实现独立迁移构造函数,并返回通过 `newGORMMigration(...)` 创建的 migration;随后只在 `openflare-server/internal/model/goose/migrations.go` 的 `registeredMigrations(...)` 中新增一条注册项。
4. 在同一个单独迁移文件中写入升级逻辑。可通过 goose `Context` 调用 `ApplyCurrentSchema`、历史 backfill、默认数据初始化等公共能力;复杂数据修复必须显式处理,不得只依赖 `AutoMigrate`。
5. 在同一个单独迁移文件中写入升级后的校验逻辑。校验至少要覆盖新增表/字段/索引是否存在、关键默认数据是否存在、必要的数据回填是否成功。
6. 如果新迁移需要新的公共 backfill 或校验辅助函数,优先放在该迁移文件中;只有多个迁移共同复用时,才放到 `openflare-server/model/goose` 包内的公共文件中。不要把新 goose 框架代码放回 `openflare-server/model` 根包。
6. 如果新迁移需要新的公共 backfill 或校验辅助函数,优先放在该迁移文件中;只有多个迁移共同复用时,才放到 `openflare-server/internal/model/goose` 包内的公共文件中。不要把新 goose 框架代码放回 `openflare-server/internal/model` 根包。
7. 补充迁移测试:至少覆盖从旧框架终点或上一 goose 版本升级后 schema version、字段/表结构、关键数据回填和校验结果。还应保留旧库从 v15/v17 桥接到 goose 的回归覆盖。
新包启动后必须先检查数据库当前版本,再按顺序逐步升级到目标版本;禁止跳过中间升级步骤直接写目标版本。
+1 -1
View File
@@ -28,5 +28,5 @@
## 4. 下一步行动指南 (Next Steps)
新接手 AI 进来后应当立即执行的前 3 步命令或编辑操作:
1. **第一步**:执行 `go test ./controller/...` 确认环境并复现 Fail 异常。
2. **第二步**:修改 `openflare-server/controller/xxx.go` 中的逻辑以修复该 Fail。
2. **第二步**:修改 `openflare-server/internal/controller/xxx.go` 中的逻辑以修复该 Fail。
3. **第三步**:在管理端前端页面调试 xxx 表单的提交是否正常。
+2 -2
View File
@@ -22,9 +22,9 @@
按模块或组件列出需要修改的物理文件路径及修改点:
### 后端 Server
* #### [NEW] `openflare-server/model/entity.go`
* #### [NEW] `openflare-server/internal/model/entity.go`
* 职责:...
* #### [MODIFY] `openflare-server/service/feature.go`
* #### [MODIFY] `openflare-server/internal/service/feature.go`
* 职责:...
### 边缘 Agent 与 OpenResty
+1 -1
View File
@@ -18,6 +18,7 @@ RUN --mount=type=cache,target=/go/pkg/mod \
COPY openflare-server ./openflare-server
COPY openflare-agent ./openflare-agent
COPY pkg ./pkg
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go build -trimpath -ldflags "-s -w -X 'github.com/rain-kl/openflare/openflare-agent/internal/config.Version=$VERSION'" -o /build/bin/openflare-agent ./openflare-agent/cmd/agent
@@ -37,4 +38,3 @@ COPY --from=builder /build/bin/openflare-agent /usr/local/bin/openflare-agent
EXPOSE 80 443 18081
ENTRYPOINT ["/usr/local/bin/openflare-agent"]
CMD ["-config", "/etc/openflare/agent.json"]
+3 -3
View File
@@ -13,9 +13,9 @@ import (
"strings"
"time"
"github.com/rain-kl/openflare/openflare-server/utils"
"github.com/rain-kl/openflare/openflare-server/utils/geoip"
"github.com/rain-kl/openflare/openflare-server/utils/geoip/iputil"
"github.com/rain-kl/openflare/pkg/geoip"
"github.com/rain-kl/openflare/pkg/geoip/iputil"
"github.com/rain-kl/openflare/pkg/utils"
)
const (
@@ -10,7 +10,7 @@ import (
"testing"
"time"
"github.com/rain-kl/openflare/openflare-server/utils/geoip"
"github.com/rain-kl/openflare/pkg/geoip"
)
func TestLoadDefaultsToManagedBinaryPaths(t *testing.T) {
@@ -10,7 +10,7 @@ import (
"time"
"github.com/rain-kl/openflare/openflare-agent/internal/geoipdata"
"github.com/rain-kl/openflare/openflare-server/utils/geoip"
"github.com/rain-kl/openflare/pkg/geoip"
)
type Updater struct {
+2 -2
View File
@@ -20,8 +20,8 @@ import (
"strings"
"time"
"github.com/rain-kl/openflare/openflare-server/utils"
openrestyrender "github.com/rain-kl/openflare/openflare-server/utils/render/openresty"
openrestyrender "github.com/rain-kl/openflare/pkg/render/openresty"
"github.com/rain-kl/openflare/pkg/utils"
"github.com/rain-kl/openflare/openflare-agent/internal/protocol"
)
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"sort"
"strings"
openrestyrender "github.com/rain-kl/openflare/openflare-server/utils/render/openresty"
openrestyrender "github.com/rain-kl/openflare/pkg/render/openresty"
"github.com/rain-kl/openflare/openflare-agent/internal/nginx"
"github.com/rain-kl/openflare/openflare-agent/internal/protocol"
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"strings"
"time"
"github.com/rain-kl/openflare/openflare-server/utils"
"github.com/rain-kl/openflare/pkg/utils"
"github.com/rain-kl/openflare/openflare-agent/internal/agent"
"github.com/rain-kl/openflare/openflare-agent/internal/config"
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"time"
"github.com/rain-kl/openflare/openflare-agent/internal/protocol"
shared "github.com/rain-kl/openflare/openflare-server/utils/wsclient"
shared "github.com/rain-kl/openflare/pkg/wsclient"
)
type WSMessage = shared.WSMessage
+1 -1
View File
@@ -12,6 +12,7 @@ RUN --mount=type=cache,target=/go/pkg/mod \
COPY openflare-server ./openflare-server
COPY openflare-relay ./openflare-relay
COPY pkg ./pkg
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags "-s -w -X 'github.com/rain-kl/openflare/openflare-relay/internal/config.Version=$VERSION'" -o /build/bin/openflare-relay ./openflare-relay/cmd/relay
@@ -30,4 +31,3 @@ ENV OPENFLARE_FRPS_PATH=/usr/bin/frps
ENV OPENFLARE_DATA_DIR=/app/data
ENTRYPOINT ["/app/openflare-relay"]
+2 -2
View File
@@ -10,8 +10,8 @@ import (
"strings"
"time"
"github.com/rain-kl/openflare/openflare-server/utils/geoip"
"github.com/rain-kl/openflare/openflare-server/utils/geoip/iputil"
"github.com/rain-kl/openflare/pkg/geoip"
"github.com/rain-kl/openflare/pkg/geoip/iputil"
)
type MillisecondDuration time.Duration
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"sync"
"time"
"github.com/rain-kl/openflare/openflare-server/service"
service "github.com/rain-kl/openflare/pkg/protocol"
)
type Manager struct {
@@ -10,7 +10,7 @@ import (
"testing"
"time"
"github.com/rain-kl/openflare/openflare-server/service"
service "github.com/rain-kl/openflare/pkg/protocol"
)
// Helper to write control file for the dummy script
@@ -11,7 +11,7 @@ import (
"github.com/rain-kl/openflare/openflare-relay/internal/observability"
"github.com/rain-kl/openflare/openflare-relay/internal/state"
"github.com/rain-kl/openflare/openflare-relay/internal/updater"
"github.com/rain-kl/openflare/openflare-server/service"
service "github.com/rain-kl/openflare/pkg/protocol"
)
type Service struct {
@@ -11,7 +11,7 @@ import (
"strings"
"time"
"github.com/rain-kl/openflare/openflare-server/service"
service "github.com/rain-kl/openflare/pkg/protocol"
)
type APIResponse[T any] struct {
@@ -16,7 +16,7 @@ import (
"github.com/rain-kl/openflare/openflare-relay/internal/config"
"github.com/rain-kl/openflare/openflare-relay/internal/frps"
"github.com/rain-kl/openflare/openflare-relay/internal/state"
"github.com/rain-kl/openflare/openflare-server/service"
service "github.com/rain-kl/openflare/pkg/protocol"
)
func BuildProfile(cfg *config.Config, stateStore *state.Store) *service.AgentNodeSystemProfile {
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"github.com/rain-kl/openflare/openflare-relay/internal/httpclient"
"github.com/rain-kl/openflare/openflare-relay/internal/state"
"github.com/rain-kl/openflare/openflare-relay/internal/wsclient"
"github.com/rain-kl/openflare/openflare-server/service"
service "github.com/rain-kl/openflare/pkg/protocol"
)
type Runner struct {
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"strings"
"time"
"github.com/rain-kl/openflare/openflare-server/utils"
"github.com/rain-kl/openflare/pkg/utils"
"github.com/rain-kl/openflare/openflare-relay/internal/config"
)
+2 -2
View File
@@ -5,8 +5,8 @@ import (
"encoding/json"
"time"
"github.com/rain-kl/openflare/openflare-server/service"
shared "github.com/rain-kl/openflare/openflare-server/utils/wsclient"
service "github.com/rain-kl/openflare/pkg/protocol"
shared "github.com/rain-kl/openflare/pkg/wsclient"
)
type WSMessage = shared.WSMessage
+3 -2
View File
@@ -21,12 +21,13 @@ COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
COPY openflare-server ./openflare-server
COPY pkg ./pkg
COPY --from=web-builder /build/build ./openflare-server/web/build
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go build -trimpath \
-ldflags "-s -w -X 'github.com/rain-kl/openflare/openflare-server/common.Version=$VERSION'" \
-o openflare ./openflare-server
-ldflags "-s -w -X 'github.com/rain-kl/openflare/openflare-server/internal/common.Version=$VERSION'" \
-o openflare ./openflare-server/cmd/server
FROM alpine:latest
RUN apk add --no-cache ca-certificates tzdata \
+7
View File
@@ -0,0 +1,7 @@
package main
import server "github.com/rain-kl/openflare/openflare-server"
func main() {
server.Run()
}
@@ -3,9 +3,9 @@ package controller
import (
"strconv"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
)
@@ -1,8 +1,8 @@
package controller
import (
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/model"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/model"
"github.com/gin-gonic/gin"
)
@@ -7,11 +7,11 @@ import (
"strconv"
"time"
"github.com/rain-kl/openflare/openflare-server/common"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/model"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/model"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
"golang.org/x/net/websocket"
@@ -7,11 +7,11 @@ import (
"strconv"
"strings"
"github.com/rain-kl/openflare/openflare-server/common"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/model"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/model"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
@@ -8,7 +8,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
)
// DecodeJSONBody decodes JSON reader to target
@@ -4,9 +4,9 @@ import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/utils/cap"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/rain-kl/openflare/openflare-server/internal/utils/cap"
)
// GetCapChallenge generates a new CAPTCHA challenge
@@ -1,9 +1,9 @@
package controller
import (
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
)
@@ -1,8 +1,8 @@
package controller
import (
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
)
@@ -1,9 +1,9 @@
package controller
import (
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
)
@@ -1,9 +1,9 @@
package controller
import (
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/model"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/model"
"github.com/gin-gonic/gin"
)
@@ -5,11 +5,11 @@ import (
"net"
"time"
"github.com/rain-kl/openflare/openflare-server/common"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/model"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/model"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
"golang.org/x/net/websocket"
@@ -1,9 +1,9 @@
package controller
import (
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
)
@@ -9,9 +9,9 @@ import (
"net/http"
"time"
"github.com/rain-kl/openflare/openflare-server/common"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/model"
"github.com/rain-kl/openflare/openflare-server/internal/common"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/model"
"github.com/gin-gonic/gin"
)
@@ -3,9 +3,9 @@ package controller
import (
"strings"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
)
@@ -3,14 +3,14 @@ package controller
import (
"fmt"
"github.com/rain-kl/openflare/openflare-server/common"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/model"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/utils/mail"
"github.com/rain-kl/openflare/openflare-server/utils/security"
"github.com/rain-kl/openflare/openflare-server/utils/validation"
"github.com/rain-kl/openflare/openflare-server/internal/common"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/model"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/rain-kl/openflare/openflare-server/internal/utils/mail"
"github.com/rain-kl/openflare/openflare-server/internal/utils/security"
"github.com/rain-kl/openflare/openflare-server/internal/utils/validation"
"github.com/gin-gonic/gin"
)
@@ -1,9 +1,9 @@
package controller
import (
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
)
@@ -6,13 +6,13 @@ import (
"strconv"
"strings"
"github.com/rain-kl/openflare/openflare-server/common"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/model"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/utils"
"github.com/rain-kl/openflare/openflare-server/utils/geoip"
"github.com/rain-kl/openflare/openflare-server/internal/common"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/model"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/rain-kl/openflare/pkg/geoip"
"github.com/rain-kl/openflare/pkg/utils"
"github.com/gin-gonic/gin"
)
@@ -1,9 +1,9 @@
package controller
import (
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
)
@@ -1,9 +1,9 @@
package controller
import (
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
)
@@ -1,9 +1,9 @@
package controller
import (
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
)
@@ -5,10 +5,10 @@ import (
"net"
"time"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/model"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/model"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
"golang.org/x/net/websocket"
@@ -1,9 +1,9 @@
package controller
import (
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
)
@@ -3,9 +3,9 @@ package controller
import (
"time"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
"golang.org/x/net/websocket"
@@ -1,8 +1,8 @@
package controller
import (
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
)
@@ -3,13 +3,13 @@ package controller
import (
"strconv"
"github.com/rain-kl/openflare/openflare-server/common"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/middleware"
"github.com/rain-kl/openflare/openflare-server/model"
"github.com/rain-kl/openflare/openflare-server/utils/security"
"github.com/rain-kl/openflare/openflare-server/utils/validation"
"github.com/rain-kl/openflare/openflare-server/internal/common"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/middleware"
"github.com/rain-kl/openflare/openflare-server/internal/model"
"github.com/rain-kl/openflare/openflare-server/internal/utils/security"
"github.com/rain-kl/openflare/openflare-server/internal/utils/validation"
"github.com/gin-gonic/gin"
)
@@ -3,9 +3,9 @@ package controller
import (
"strconv"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/controller/bind"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/controller/bind"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
)
@@ -9,9 +9,9 @@ import (
"net/http"
"time"
"github.com/rain-kl/openflare/openflare-server/common"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/model"
"github.com/rain-kl/openflare/openflare-server/internal/common"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/model"
"github.com/gin-gonic/gin"
)
@@ -4,8 +4,8 @@ import (
"log/slog"
"time"
"github.com/rain-kl/openflare/openflare-server/model"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/model"
"github.com/rain-kl/openflare/openflare-server/internal/service"
)
type SSLRenewJob struct {
@@ -5,8 +5,8 @@ import (
"sync"
"time"
"github.com/rain-kl/openflare/openflare-server/common"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common"
"github.com/rain-kl/openflare/openflare-server/internal/service"
)
var lastUptimeKumaSyncTime time.Time
@@ -3,7 +3,7 @@ package job
import (
"log/slog"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/service"
)
type WAFIPGroupSyncJob struct{}
@@ -2,8 +2,8 @@ package middleware
import (
"github.com/gin-gonic/gin"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/service"
)
func AgentAuth() func(c *gin.Context) {
@@ -1,9 +1,9 @@
package middleware
import (
"github.com/rain-kl/openflare/openflare-server/common"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/model"
"github.com/rain-kl/openflare/openflare-server/internal/common"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/model"
jwt "github.com/appleboy/gin-jwt/v2"
"github.com/gin-gonic/gin"
@@ -2,8 +2,8 @@ package middleware
import (
"github.com/gin-gonic/gin"
"github.com/rain-kl/openflare/openflare-server/common"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common"
"github.com/rain-kl/openflare/openflare-server/internal/service"
)
// CapAuth wraps the core Cap middleware with OpenFlare's dynamic CapLoginEnabled configuration switch
@@ -3,7 +3,7 @@ package middleware
import (
"strings"
"github.com/rain-kl/openflare/openflare-server/common"
"github.com/rain-kl/openflare/openflare-server/internal/common"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
@@ -4,9 +4,9 @@ import (
"log"
"time"
"github.com/rain-kl/openflare/openflare-server/common"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/model"
"github.com/rain-kl/openflare/openflare-server/internal/common"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/model"
jwt "github.com/appleboy/gin-jwt/v2"
"github.com/gin-gonic/gin"
@@ -6,8 +6,8 @@ import (
"net/http"
"time"
"github.com/rain-kl/openflare/openflare-server/common"
"github.com/rain-kl/openflare/openflare-server/utils/ratelimit"
"github.com/rain-kl/openflare/openflare-server/internal/common"
"github.com/rain-kl/openflare/openflare-server/internal/utils/ratelimit"
"github.com/gin-gonic/gin"
)
@@ -2,8 +2,8 @@ package middleware
import (
"github.com/gin-gonic/gin"
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/service"
)
// RelayAuth authenticates Relay requests using the shared agent token,
@@ -1,8 +1,8 @@
package middleware
import (
"github.com/rain-kl/openflare/openflare-server/common/response"
"github.com/rain-kl/openflare/openflare-server/service"
"github.com/rain-kl/openflare/openflare-server/internal/common/response"
"github.com/rain-kl/openflare/openflare-server/internal/service"
"github.com/gin-gonic/gin"
)
@@ -6,7 +6,7 @@ import (
"strings"
"time"
"github.com/rain-kl/openflare/openflare-server/utils"
"github.com/rain-kl/openflare/pkg/utils"
"gorm.io/gorm"
)
@@ -3,7 +3,7 @@ package model
import (
"time"
"github.com/rain-kl/openflare/openflare-server/model/migrate"
"github.com/rain-kl/openflare/openflare-server/internal/model/migrate"
)
const (
@@ -8,8 +8,8 @@ import (
"strings"
"sync"
"github.com/rain-kl/openflare/openflare-server/common"
"github.com/rain-kl/openflare/openflare-server/utils/security"
"github.com/rain-kl/openflare/openflare-server/internal/common"
"github.com/rain-kl/openflare/openflare-server/internal/utils/security"
"github.com/glebarez/sqlite"
"gorm.io/driver/postgres"

Some files were not shown because too many files have changed in this diff Show More