diff --git a/authserver/go.mod b/authserver/go.mod deleted file mode 100644 index 16af137..0000000 --- a/authserver/go.mod +++ /dev/null @@ -1,48 +0,0 @@ -module authserver - -go 1.26 - -require ( - github.com/gin-gonic/gin v1.11.0 - github.com/golang-jwt/jwt/v5 v5.3.0 - golang.org/x/crypto v0.40.0 - gorm.io/driver/mysql v1.6.0 - gorm.io/gorm v1.30.1 -) - -require ( - filippo.io/edwards25519 v1.1.0 // indirect - github.com/bytedance/sonic v1.14.0 // indirect - github.com/bytedance/sonic/loader v0.3.0 // indirect - github.com/cloudwego/base64x v0.1.6 // indirect - github.com/gabriel-vasile/mimetype v1.4.8 // indirect - github.com/gin-contrib/sse v1.1.0 // indirect - github.com/go-playground/locales v0.14.1 // indirect - github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.27.0 // indirect - github.com/go-sql-driver/mysql v1.8.1 // indirect - github.com/goccy/go-json v0.10.2 // indirect - github.com/goccy/go-yaml v1.18.0 // indirect - github.com/jinzhu/inflection v1.0.0 // indirect - github.com/jinzhu/now v1.1.5 // indirect - github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/cpuid/v2 v2.3.0 // indirect - github.com/leodido/go-urn v1.4.0 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect - github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/pelletier/go-toml/v2 v2.2.4 // indirect - github.com/quic-go/qpack v0.5.1 // indirect - github.com/quic-go/quic-go v0.54.0 // indirect - github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.3.0 // indirect - go.uber.org/mock v0.5.0 // indirect - golang.org/x/arch v0.20.0 // indirect - golang.org/x/mod v0.25.0 // indirect - golang.org/x/net v0.42.0 // indirect - golang.org/x/sync v0.16.0 // indirect - golang.org/x/sys v0.35.0 // indirect - golang.org/x/text v0.27.0 // indirect - golang.org/x/tools v0.34.0 // indirect - google.golang.org/protobuf v1.36.9 // indirect -) diff --git a/authserver/go.sum b/authserver/go.sum deleted file mode 100644 index d4f772e..0000000 --- a/authserver/go.sum +++ /dev/null @@ -1,102 +0,0 @@ -filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= -filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= -github.com/bytedance/sonic v1.14.0 h1:/OfKt8HFw0kh2rj8N0F6C/qPGRESq0BbaNZgcNXXzQQ= -github.com/bytedance/sonic v1.14.0/go.mod h1:WoEbx8WTcFJfzCe0hbmyTGrfjt8PzNEBdxlNUO24NhA= -github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA= -github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= -github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M= -github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM= -github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8= -github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= -github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= -github.com/gin-gonic/gin v1.11.0 h1:OW/6PLjyusp2PPXtyxKHU0RbX6I/l28FTdDlae5ueWk= -github.com/gin-gonic/gin v1.11.0/go.mod h1:+iq/FyxlGzII0KHiBGjuNn4UNENUlKbGlNmc+W50Dls= -github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= -github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= -github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= -github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= -github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.27.0 h1:w8+XrWVMhGkxOaaowyKH35gFydVHOvC0/uWoy2Fzwn4= -github.com/go-playground/validator/v10 v10.27.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= -github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= -github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= -github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= -github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw= -github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= -github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= -github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= -github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= -github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= -github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= -github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= -github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= -github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= -github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= -github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= -github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI= -github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg= -github.com/quic-go/quic-go v0.54.0 h1:6s1YB9QotYI6Ospeiguknbp2Znb/jZYjZLRXn9kMQBg= -github.com/quic-go/quic-go v0.54.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= -github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= -github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA= -github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4= -go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= -go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= -golang.org/x/arch v0.20.0 h1:dx1zTU0MAE98U+TQ8BLl7XsJbgze2WnNKF/8tGp/Q6c= -golang.org/x/arch v0.20.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= -golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= -golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= -golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= -golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= -golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= -golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= -golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= -golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= -golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= -google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= -google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gorm.io/driver/mysql v1.6.0 h1:eNbLmNTpPpTOVZi8MMxCi2aaIm0ZpInbORNXDwyLGvg= -gorm.io/driver/mysql v1.6.0/go.mod h1:D/oCC2GWK3M/dqoLxnOlaNKmXz8WNTfcS9y5ovaSqKo= -gorm.io/gorm v1.30.1 h1:lSHg33jJTBxs2mgJRfRZeLDG+WZaHYCk3Wtfl6Ngzo4= -gorm.io/gorm v1.30.1/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE= diff --git a/frontend/src/types/api.ts b/frontend/src/types/api.ts index 3ff1886..880d985 100644 --- a/frontend/src/types/api.ts +++ b/frontend/src/types/api.ts @@ -1,6 +1,6 @@ /** * 后端统一响应格式类型定义 - * 对应 server/internal/handler/response.go + * 对应 server/internal/response/response.go */ /** 统一 JSON 响应信封 */ diff --git a/authserver/.dockerignore b/server/.dockerignore similarity index 100% rename from authserver/.dockerignore rename to server/.dockerignore diff --git a/authserver/.env.example b/server/.env.example similarity index 100% rename from authserver/.env.example rename to server/.env.example diff --git a/authserver/.gitignore b/server/.gitignore similarity index 93% rename from authserver/.gitignore rename to server/.gitignore index eca0741..6097006 100644 --- a/authserver/.gitignore +++ b/server/.gitignore @@ -5,7 +5,7 @@ .DS_Store *.tar bin/ -server +/server web/node_modules/ web/dist/ certs/ diff --git a/authserver/Dockerfile.backend b/server/Dockerfile.backend similarity index 100% rename from authserver/Dockerfile.backend rename to server/Dockerfile.backend diff --git a/authserver/README.md b/server/README.md similarity index 100% rename from authserver/README.md rename to server/README.md diff --git a/server/cmd/server/.gitkeep b/server/cmd/server/.gitkeep deleted file mode 100644 index efbb44f..0000000 --- a/server/cmd/server/.gitkeep +++ /dev/null @@ -1,4 +0,0 @@ -# 服务启动入口 - -存放 Go 程序入口文件: -- main.go: 服务启动入口,初始化配置、数据库、路由,启动 HTTP 服务 diff --git a/server/cmd/server/main.go b/server/cmd/server/main.go index b13787d..d7db5b6 100644 --- a/server/cmd/server/main.go +++ b/server/cmd/server/main.go @@ -1,90 +1,37 @@ package main import ( - "fmt" - "net/http" - "strconv" - "time" + "log" - "github.com/1024XEngineer/xinfra/server/internal/handler" - "github.com/1024XEngineer/xinfra/server/internal/middleware" - "github.com/gin-gonic/gin" + "github.com/1024XEngineer/xinfra/server/internal/config" + "github.com/1024XEngineer/xinfra/server/internal/database" + "github.com/1024XEngineer/xinfra/server/internal/router" ) func main() { - r := gin.Default() + cfg := config.Load() - // 加载中间件 - r.Use(middleware.Logger()) - r.Use(middleware.Recovery()) + db, err := database.Open(cfg.MySQLDSN) + if err != nil { + log.Fatalf("open database: %v", err) + } - // 健康检查 - r.GET("/api/v1/ping", func(c *gin.Context) { - handler.Success(c, gin.H{"time": time.Now().Format(time.RFC3339)}) + if cfg.AutoMigrate { + if err := database.AutoMigrate(db); err != nil { + log.Fatalf("auto migrate: %v", err) + } + } + if err := database.SeedDefaults(db, cfg); err != nil { + log.Fatalf("seed defaults: %v", err) + } + + r := router.New(router.Dependencies{ + Config: cfg, + DB: db, }) - // 测试路由组 — 用于验证统一响应格式 - testGroup := r.Group("/api/v1/test") - { - // 成功响应 - testGroup.GET("/success", func(c *gin.Context) { - handler.Success(c, gin.H{ - "username": "testuser", - "role": "admin", - }) - }) - - // 业务错误 — 传入错误码 - // GET /api/v1/test/error/10001 → LDAP 认证失败 - // GET /api/v1/test/error/10002 → 用户名或密码错误 - // GET /api/v1/test/error/10003 → Token 已过期 - // GET /api/v1/test/error/20001 → 任务创建失败 - // GET /api/v1/test/error/20002 → 任务执行超时 - testGroup.GET("/error/:code", func(c *gin.Context) { - codeStr := c.Param("code") - code, err := strconv.Atoi(codeStr) - if err != nil { - handler.BadRequest(c, "错误码必须是数字") - return - } - details := fmt.Sprintf("这是错误码 %d 的测试响应", code) - handler.Error(c, http.StatusOK, code, details) - }) - - // HTTP 500 错误 - testGroup.GET("/500", func(c *gin.Context) { - handler.InternalError(c, "模拟服务器内部错误") - }) - - // HTTP 401 未授权 - testGroup.GET("/401", func(c *gin.Context) { - handler.Unauthorized(c, "模拟 Token 过期") - }) - - // HTTP 403 禁止访问 - testGroup.GET("/403", func(c *gin.Context) { - handler.Forbidden(c, "模拟无权限") - }) - - // 模拟超时(sleep 超过前端 10s timeout) - testGroup.GET("/timeout", func(c *gin.Context) { - time.Sleep(15 * time.Second) - handler.Success(c, "这条消息不应该出现") - }) - - // 返回分页数据 - testGroup.GET("/paginated", func(c *gin.Context) { - items := []gin.H{ - {"id": 1, "name": "item-1"}, - {"id": 2, "name": "item-2"}, - {"id": 3, "name": "item-3"}, - } - handler.SuccessWithPaginated(c, 100, items) - }) - } - - fmt.Println("Server starting on :8080...") - if err := r.Run(":8080"); err != nil { - panic(err) + log.Printf("authserver listening on %s", cfg.HTTPAddr) + if err := r.Run(cfg.HTTPAddr); err != nil { + log.Fatalf("run server: %v", err) } } diff --git a/authserver/docker-compose.mysql.yml b/server/docker-compose.mysql.yml similarity index 100% rename from authserver/docker-compose.mysql.yml rename to server/docker-compose.mysql.yml diff --git a/server/go.mod b/server/go.mod index 455aa12..8fe33ab 100644 --- a/server/go.mod +++ b/server/go.mod @@ -1,32 +1,48 @@ module github.com/1024XEngineer/xinfra/server -go 1.21 - -require github.com/gin-gonic/gin v1.9.1 +go 1.26 require ( - github.com/bytedance/sonic v1.9.1 // indirect - github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect - github.com/gabriel-vasile/mimetype v1.4.2 // indirect - github.com/gin-contrib/sse v0.1.0 // indirect + github.com/gin-gonic/gin v1.11.0 + github.com/golang-jwt/jwt/v5 v5.3.0 + gorm.io/driver/mysql v1.6.0 + gorm.io/gorm v1.30.1 +) + +require ( + filippo.io/edwards25519 v1.1.0 // indirect + github.com/bytedance/sonic v1.14.0 // indirect + github.com/bytedance/sonic/loader v0.3.0 // indirect + github.com/cloudwego/base64x v0.1.6 // indirect + github.com/gabriel-vasile/mimetype v1.4.8 // indirect + github.com/gin-contrib/sse v1.1.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.14.0 // indirect + github.com/go-playground/validator/v10 v10.27.0 // indirect + github.com/go-sql-driver/mysql v1.8.1 // indirect github.com/goccy/go-json v0.10.2 // indirect + github.com/goccy/go-yaml v1.18.0 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/cpuid/v2 v2.2.4 // indirect - github.com/leodido/go-urn v1.2.4 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/klauspost/cpuid/v2 v2.3.0 // indirect + github.com/leodido/go-urn v1.4.0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/pelletier/go-toml/v2 v2.0.8 // indirect + github.com/pelletier/go-toml/v2 v2.2.4 // indirect + github.com/quic-go/qpack v0.5.1 // indirect + github.com/quic-go/quic-go v0.54.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.2.11 // indirect - golang.org/x/arch v0.3.0 // indirect - golang.org/x/crypto v0.9.0 // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect - google.golang.org/protobuf v1.30.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect + github.com/ugorji/go/codec v1.3.0 // indirect + go.uber.org/mock v0.5.0 // indirect + golang.org/x/arch v0.20.0 // indirect + golang.org/x/crypto v0.40.0 // indirect + golang.org/x/mod v0.25.0 // indirect + golang.org/x/net v0.42.0 // indirect + golang.org/x/sync v0.16.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/text v0.27.0 // indirect + golang.org/x/tools v0.34.0 // indirect + google.golang.org/protobuf v1.36.9 // indirect ) diff --git a/server/go.sum b/server/go.sum index 1a77fa1..d4f772e 100644 --- a/server/go.sum +++ b/server/go.sum @@ -1,86 +1,102 @@ -github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= -github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s= -github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= -github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= -github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= -github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= +filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= +github.com/bytedance/sonic v1.14.0 h1:/OfKt8HFw0kh2rj8N0F6C/qPGRESq0BbaNZgcNXXzQQ= +github.com/bytedance/sonic v1.14.0/go.mod h1:WoEbx8WTcFJfzCe0hbmyTGrfjt8PzNEBdxlNUO24NhA= +github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA= +github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= +github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M= +github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= -github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= -github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= -github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= +github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM= +github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8= +github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= +github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= +github.com/gin-gonic/gin v1.11.0 h1:OW/6PLjyusp2PPXtyxKHU0RbX6I/l28FTdDlae5ueWk= +github.com/gin-gonic/gin v1.11.0/go.mod h1:+iq/FyxlGzII0KHiBGjuNn4UNENUlKbGlNmc+W50Dls= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= -github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/go-playground/validator/v10 v10.27.0 h1:w8+XrWVMhGkxOaaowyKH35gFydVHOvC0/uWoy2Fzwn4= +github.com/go-playground/validator/v10 v10.27.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= +github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= +github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw= +github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= +github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= +github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= -github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= -github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= -github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= +github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= -github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= +github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= +github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI= +github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg= +github.com/quic-go/quic-go v0.54.0 h1:6s1YB9QotYI6Ospeiguknbp2Znb/jZYjZLRXn9kMQBg= +github.com/quic-go/quic-go v0.54.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= -github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= -github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= -golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k= -golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA= +github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= +golang.org/x/arch v0.20.0 h1:dx1zTU0MAE98U+TQ8BLl7XsJbgze2WnNKF/8tGp/Q6c= +golang.org/x/arch v0.20.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= +golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= +golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= +golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= +golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= +golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= +golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= +golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= +golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= +golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= +google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= +google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= +gorm.io/driver/mysql v1.6.0 h1:eNbLmNTpPpTOVZi8MMxCi2aaIm0ZpInbORNXDwyLGvg= +gorm.io/driver/mysql v1.6.0/go.mod h1:D/oCC2GWK3M/dqoLxnOlaNKmXz8WNTfcS9y5ovaSqKo= +gorm.io/gorm v1.30.1 h1:lSHg33jJTBxs2mgJRfRZeLDG+WZaHYCk3Wtfl6Ngzo4= +gorm.io/gorm v1.30.1/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE= diff --git a/authserver/internal/auth/jwt.go b/server/internal/auth/jwt.go similarity index 100% rename from authserver/internal/auth/jwt.go rename to server/internal/auth/jwt.go diff --git a/authserver/internal/auth/oidc_key.go b/server/internal/auth/oidc_key.go similarity index 100% rename from authserver/internal/auth/oidc_key.go rename to server/internal/auth/oidc_key.go diff --git a/authserver/internal/auth/random.go b/server/internal/auth/random.go similarity index 100% rename from authserver/internal/auth/random.go rename to server/internal/auth/random.go diff --git a/server/internal/config/.gitkeep b/server/internal/config/.gitkeep deleted file mode 100644 index 3f1878d..0000000 --- a/server/internal/config/.gitkeep +++ /dev/null @@ -1,4 +0,0 @@ -# 配置管理模块 - -存放配置加载相关代码: -- config.go: 配置加载,读取 YAML 配置文件,支持环境变量覆盖 diff --git a/authserver/internal/config/config.go b/server/internal/config/config.go similarity index 100% rename from authserver/internal/config/config.go rename to server/internal/config/config.go diff --git a/authserver/internal/database/database.go b/server/internal/database/database.go similarity index 85% rename from authserver/internal/database/database.go rename to server/internal/database/database.go index ca19b6e..c57fa40 100644 --- a/authserver/internal/database/database.go +++ b/server/internal/database/database.go @@ -1,7 +1,7 @@ package database import ( - "authserver/internal/model" + "github.com/1024XEngineer/xinfra/server/internal/model" "gorm.io/driver/mysql" "gorm.io/gorm" diff --git a/authserver/internal/database/seed.go b/server/internal/database/seed.go similarity index 66% rename from authserver/internal/database/seed.go rename to server/internal/database/seed.go index 2d06763..32a2d6c 100644 --- a/authserver/internal/database/seed.go +++ b/server/internal/database/seed.go @@ -1,7 +1,7 @@ package database import ( - "authserver/internal/config" + "github.com/1024XEngineer/xinfra/server/internal/config" "gorm.io/gorm" ) diff --git a/server/internal/handler/.gitkeep b/server/internal/handler/.gitkeep deleted file mode 100644 index 67a2a01..0000000 --- a/server/internal/handler/.gitkeep +++ /dev/null @@ -1,8 +0,0 @@ -# HTTP 处理器层(Controller) - -存放请求处理器,负责接收请求、校验参数、调用 Service: -- auth.go: 认证处理器,处理登录/登出/用户信息请求 -- audit.go: 审计处理器,处理登录审计/运维操作审计查询请求 -- subsystem.go: 子系统处理器,处理子系统列表/SSO URL 生成请求 -- task.go: 任务处理器,处理 Ansible 任务创建/状态查询请求 -- response.go: 统一响应,定义标准 JSON 响应格式和错误码 diff --git a/authserver/internal/handler/clouddm.go b/server/internal/handler/clouddm.go similarity index 96% rename from authserver/internal/handler/clouddm.go rename to server/internal/handler/clouddm.go index 904e6b8..d0ca6cd 100644 --- a/authserver/internal/handler/clouddm.go +++ b/server/internal/handler/clouddm.go @@ -9,8 +9,8 @@ import ( "strings" "time" - "authserver/internal/config" - "authserver/internal/service" + "github.com/1024XEngineer/xinfra/server/internal/config" + "github.com/1024XEngineer/xinfra/server/internal/service" "github.com/gin-gonic/gin" ) diff --git a/authserver/internal/handler/context.go b/server/internal/handler/context.go similarity index 87% rename from authserver/internal/handler/context.go rename to server/internal/handler/context.go index dbb1acd..7af0641 100644 --- a/authserver/internal/handler/context.go +++ b/server/internal/handler/context.go @@ -4,8 +4,8 @@ import ( "net/http" "strings" - "authserver/internal/auth" - "authserver/internal/config" + "github.com/1024XEngineer/xinfra/server/internal/auth" + "github.com/1024XEngineer/xinfra/server/internal/config" "github.com/gin-gonic/gin" ) diff --git a/authserver/internal/handler/health.go b/server/internal/handler/health.go similarity index 100% rename from authserver/internal/handler/health.go rename to server/internal/handler/health.go diff --git a/authserver/internal/handler/oauth.go b/server/internal/handler/oauth.go similarity index 97% rename from authserver/internal/handler/oauth.go rename to server/internal/handler/oauth.go index cffa577..403b283 100644 --- a/authserver/internal/handler/oauth.go +++ b/server/internal/handler/oauth.go @@ -8,10 +8,10 @@ import ( "strings" "time" - "authserver/internal/auth" - "authserver/internal/config" - "authserver/internal/model" - "authserver/internal/service" + "github.com/1024XEngineer/xinfra/server/internal/auth" + "github.com/1024XEngineer/xinfra/server/internal/config" + "github.com/1024XEngineer/xinfra/server/internal/model" + "github.com/1024XEngineer/xinfra/server/internal/service" "github.com/gin-gonic/gin" "gorm.io/gorm" diff --git a/authserver/internal/handler/saml.go b/server/internal/handler/saml.go similarity index 94% rename from authserver/internal/handler/saml.go rename to server/internal/handler/saml.go index a90818d..4c21ed9 100644 --- a/authserver/internal/handler/saml.go +++ b/server/internal/handler/saml.go @@ -7,9 +7,9 @@ import ( "strings" "time" - "authserver/internal/config" - "authserver/internal/service" - "authserver/internal/sso" + "github.com/1024XEngineer/xinfra/server/internal/config" + "github.com/1024XEngineer/xinfra/server/internal/service" + "github.com/1024XEngineer/xinfra/server/internal/sso" "github.com/gin-gonic/gin" ) diff --git a/authserver/internal/handler/user.go b/server/internal/handler/user.go similarity index 100% rename from authserver/internal/handler/user.go rename to server/internal/handler/user.go diff --git a/authserver/internal/handler/wayen.go b/server/internal/handler/wayen.go similarity index 96% rename from authserver/internal/handler/wayen.go rename to server/internal/handler/wayen.go index 5f2718f..18c1776 100644 --- a/authserver/internal/handler/wayen.go +++ b/server/internal/handler/wayen.go @@ -5,9 +5,9 @@ import ( "net/http" "strings" - "authserver/internal/auth" - "authserver/internal/model" - "authserver/internal/service" + "github.com/1024XEngineer/xinfra/server/internal/auth" + "github.com/1024XEngineer/xinfra/server/internal/model" + "github.com/1024XEngineer/xinfra/server/internal/service" "github.com/gin-gonic/gin" "gorm.io/gorm" diff --git a/server/internal/middleware/.gitkeep b/server/internal/middleware/.gitkeep deleted file mode 100644 index 75697ab..0000000 --- a/server/internal/middleware/.gitkeep +++ /dev/null @@ -1,6 +0,0 @@ -# HTTP 中间件 - -存放请求处理前后执行的通用逻辑: -- auth.go: 认证中间件,校验 JWT Token,注入用户信息到 Context -- logger.go: 日志中间件,记录请求方法、路径、耗时、状态码 -- audit.go: 审计中间件,自动记录非 GET 请求的操作审计日志 diff --git a/server/internal/middleware/logger.go b/server/internal/middleware/logger.go deleted file mode 100644 index 5a29b07..0000000 --- a/server/internal/middleware/logger.go +++ /dev/null @@ -1,38 +0,0 @@ -package middleware - -import ( - "log" - "time" - - "github.com/gin-gonic/gin" -) - -// Logger 返回请求日志中间件 -// 记录请求方法、路径、状态码、耗时、客户端 IP -func Logger() gin.HandlerFunc { - return func(c *gin.Context) { - // 请求开始时间 - startTime := time.Now() - - // 处理请求 - c.Next() - - // 计算耗时 - duration := time.Since(startTime) - - // 获取请求信息 - method := c.Request.Method - path := c.Request.URL.Path - statusCode := c.Writer.Status() - clientIP := c.ClientIP() - - // 记录日志 - log.Printf("[REQUEST] %s %s | %d | %v | %s", - method, - path, - statusCode, - duration, - clientIP, - ) - } -} diff --git a/server/internal/middleware/recovery.go b/server/internal/middleware/recovery.go deleted file mode 100644 index c933495..0000000 --- a/server/internal/middleware/recovery.go +++ /dev/null @@ -1,28 +0,0 @@ -package middleware - -import ( - "log" - "runtime/debug" - - "github.com/1024XEngineer/xinfra/server/internal/handler" - "github.com/gin-gonic/gin" -) - -// Recovery 返回 panic 恢复中间件 -// 捕获请求处理过程中的 panic,返回 500 错误而不是崩溃 -func Recovery() gin.HandlerFunc { - return func(c *gin.Context) { - defer func() { - if err := recover(); err != nil { - // 记录 panic 堆栈信息 - log.Printf("[PANIC] %v\n%s", err, debug.Stack()) - - // 返回 500 错误 - handler.InternalError(c, "服务器内部错误") - c.Abort() - } - }() - - c.Next() - } -} diff --git a/server/internal/model/.gitkeep b/server/internal/model/.gitkeep deleted file mode 100644 index 33256f7..0000000 --- a/server/internal/model/.gitkeep +++ /dev/null @@ -1,6 +0,0 @@ -# 数据模型层 - -存放数据库表结构和业务实体定义: -- user.go: 用户模型,对应 users 表,定义用户字段和状态枚举 -- audit.go: 审计模型,对应 login_audit / ops_audit 表 -- subsystem.go: 子系统模型,对应 subsystems 表,定义子系统信息 diff --git a/authserver/internal/model/models.go b/server/internal/model/models.go similarity index 100% rename from authserver/internal/model/models.go rename to server/internal/model/models.go diff --git a/server/internal/repository/.gitkeep b/server/internal/repository/.gitkeep deleted file mode 100644 index e6a190d..0000000 --- a/server/internal/repository/.gitkeep +++ /dev/null @@ -1,5 +0,0 @@ -# 数据访问层(DAO) - -存放数据库 CRUD 操作封装: -- user.go: 用户仓储,用户查询、创建、更新、LDAP DN 映射 -- audit.go: 审计仓储,审计记录插入、分页查询、条件筛选 diff --git a/server/internal/handler/response.go b/server/internal/response/response.go similarity index 56% rename from server/internal/handler/response.go rename to server/internal/response/response.go index bfea90f..b67281c 100644 --- a/server/internal/handler/response.go +++ b/server/internal/response/response.go @@ -1,4 +1,4 @@ -package handler +package response import ( "net/http" @@ -6,38 +6,31 @@ import ( "github.com/gin-gonic/gin" ) -// Response 统一响应结构 type Response struct { - Code int `json:"code"` // 业务错误码,0 表示成功 - Message string `json:"message"` // 响应消息 - Data interface{} `json:"data,omitempty"` // 响应数据,成功时返回 - Details string `json:"details,omitempty"` // 错误详情,失败时返回 + Code int `json:"code"` + Message string `json:"message"` + Data interface{} `json:"data,omitempty"` + Details string `json:"details,omitempty"` } -// 分页响应结构 type PaginatedData struct { Total int64 `json:"total"` Items interface{} `json:"items"` } -// 业务错误码定义 const ( - // 成功 CodeSuccess = 0 - // 认证相关错误 10001-10099 - CodeLDAPAuthFailed = 10001 // LDAP 认证失败 - CodeInvalidCredentials = 10002 // 用户名或密码错误 - CodeTokenExpired = 10003 // Token 已过期 - CodeSSONotConfigured = 10004 // 子系统未配置 SSO - CodeSSOGenerateFailed = 10005 // SSO 跳转生成失败 + CodeLDAPAuthFailed = 10001 + CodeInvalidCredentials = 10002 + CodeTokenExpired = 10003 + CodeSSONotConfigured = 10004 + CodeSSOGenerateFailed = 10005 - // 任务相关错误 20001-20099 - CodeTaskCreateFailed = 20001 // Ansible 任务创建失败 - CodeTaskExecTimeout = 20002 // Ansible 任务执行超时 + CodeTaskCreateFailed = 20001 + CodeTaskExecTimeout = 20002 ) -// 错误码对应的默认消息 var codeMessages = map[int]string{ CodeSuccess: "success", CodeLDAPAuthFailed: "LDAP 认证失败", @@ -49,24 +42,21 @@ var codeMessages = map[int]string{ CodeTaskExecTimeout: "Ansible 任务执行超时", } -// GetMessage 根据错误码获取默认消息 -func GetMessage(code int) string { +func Message(code int) string { if msg, ok := codeMessages[code]; ok { return msg } return "未知错误" } -// Success 返回成功响应 func Success(c *gin.Context, data interface{}) { c.JSON(http.StatusOK, Response{ Code: CodeSuccess, - Message: GetMessage(CodeSuccess), + Message: Message(CodeSuccess), Data: data, }) } -// SuccessWithMessage 返回自定义消息的成功响应 func SuccessWithMessage(c *gin.Context, message string, data interface{}) { c.JSON(http.StatusOK, Response{ Code: CodeSuccess, @@ -75,11 +65,10 @@ func SuccessWithMessage(c *gin.Context, message string, data interface{}) { }) } -// SuccessWithPaginated 返回分页成功响应 func SuccessWithPaginated(c *gin.Context, total int64, items interface{}) { c.JSON(http.StatusOK, Response{ Code: CodeSuccess, - Message: GetMessage(CodeSuccess), + Message: Message(CodeSuccess), Data: PaginatedData{ Total: total, Items: items, @@ -87,17 +76,15 @@ func SuccessWithPaginated(c *gin.Context, total int64, items interface{}) { }) } -// Error 返回错误响应 -func Error(c *gin.Context, httpCode int, bizCode int, details string) { +func Error(c *gin.Context, httpCode, bizCode int, details string) { c.JSON(httpCode, Response{ Code: bizCode, - Message: GetMessage(bizCode), + Message: Message(bizCode), Details: details, }) } -// ErrorWithMessage 返回自定义消息的错误响应 -func ErrorWithMessage(c *gin.Context, httpCode int, bizCode int, message string, details string) { +func ErrorWithMessage(c *gin.Context, httpCode, bizCode int, message, details string) { c.JSON(httpCode, Response{ Code: bizCode, Message: message, @@ -105,17 +92,14 @@ func ErrorWithMessage(c *gin.Context, httpCode int, bizCode int, message string, }) } -// BadRequest 返回 400 错误 func BadRequest(c *gin.Context, details string) { Error(c, http.StatusBadRequest, CodeInvalidCredentials, details) } -// Unauthorized 返回 401 错误 func Unauthorized(c *gin.Context, details string) { Error(c, http.StatusUnauthorized, CodeTokenExpired, details) } -// Forbidden 返回 403 错误 func Forbidden(c *gin.Context, details string) { c.JSON(http.StatusForbidden, Response{ Code: http.StatusForbidden, @@ -124,7 +108,6 @@ func Forbidden(c *gin.Context, details string) { }) } -// NotFound 返回 404 错误 func NotFound(c *gin.Context, details string) { c.JSON(http.StatusNotFound, Response{ Code: http.StatusNotFound, @@ -133,7 +116,6 @@ func NotFound(c *gin.Context, details string) { }) } -// InternalError 返回 500 错误 func InternalError(c *gin.Context, details string) { c.JSON(http.StatusInternalServerError, Response{ Code: http.StatusInternalServerError, diff --git a/server/internal/router/.gitkeep b/server/internal/router/.gitkeep deleted file mode 100644 index 010eea4..0000000 --- a/server/internal/router/.gitkeep +++ /dev/null @@ -1,4 +0,0 @@ -# 路由注册模块 - -存放 API 路由配置: -- router.go: 路由注册,定义 API 路由表,绑定 Handler 和 Middleware diff --git a/authserver/internal/router/router.go b/server/internal/router/router.go similarity index 91% rename from authserver/internal/router/router.go rename to server/internal/router/router.go index 3390113..583edbf 100644 --- a/authserver/internal/router/router.go +++ b/server/internal/router/router.go @@ -1,9 +1,9 @@ package router import ( - "authserver/internal/config" - "authserver/internal/handler" - "authserver/internal/service" + "github.com/1024XEngineer/xinfra/server/internal/config" + "github.com/1024XEngineer/xinfra/server/internal/handler" + "github.com/1024XEngineer/xinfra/server/internal/service" "github.com/gin-gonic/gin" "gorm.io/gorm" diff --git a/server/internal/service/.gitkeep b/server/internal/service/.gitkeep deleted file mode 100644 index 4bb71a0..0000000 --- a/server/internal/service/.gitkeep +++ /dev/null @@ -1,8 +0,0 @@ -# 业务逻辑层 - -存放核心业务逻辑,编排 Repository: -- auth.go: 认证服务,LDAP 认证、本地降级认证、JWT 生成 -- ldap.go: LDAP 服务,封装 LDAP 连接、查询、认证逻辑 -- audit.go: 审计服务,记录登录审计、运维操作审计 -- subsystem.go: 子系统服务,子系统查询、OAuth 2.0 SSO URL 生成 -- ansible.go: Ansible 调度服务,创建任务、执行 Playbook、推送日志 diff --git a/authserver/internal/service/audit.go b/server/internal/service/audit.go similarity index 95% rename from authserver/internal/service/audit.go rename to server/internal/service/audit.go index 60fde17..4ffa8a7 100644 --- a/authserver/internal/service/audit.go +++ b/server/internal/service/audit.go @@ -3,7 +3,7 @@ package service import ( "encoding/json" - "authserver/internal/model" + "github.com/1024XEngineer/xinfra/server/internal/model" "gorm.io/gorm" ) diff --git a/authserver/internal/service/auth.go b/server/internal/service/auth.go similarity index 96% rename from authserver/internal/service/auth.go rename to server/internal/service/auth.go index 91b8f62..28085d2 100644 --- a/authserver/internal/service/auth.go +++ b/server/internal/service/auth.go @@ -8,10 +8,10 @@ import ( "strings" "time" - "authserver/internal/auth" - "authserver/internal/config" - "authserver/internal/model" - "authserver/internal/sso" + "github.com/1024XEngineer/xinfra/server/internal/auth" + "github.com/1024XEngineer/xinfra/server/internal/config" + "github.com/1024XEngineer/xinfra/server/internal/model" + "github.com/1024XEngineer/xinfra/server/internal/sso" "gorm.io/gorm" ) diff --git a/authserver/internal/service/wayen.go b/server/internal/service/wayen.go similarity index 97% rename from authserver/internal/service/wayen.go rename to server/internal/service/wayen.go index f370ab5..996ef6b 100644 --- a/authserver/internal/service/wayen.go +++ b/server/internal/service/wayen.go @@ -11,8 +11,8 @@ import ( "strings" "time" - "authserver/internal/config" - "authserver/internal/model" + "github.com/1024XEngineer/xinfra/server/internal/config" + "github.com/1024XEngineer/xinfra/server/internal/model" "gorm.io/gorm" ) diff --git a/authserver/internal/sso/login.go b/server/internal/sso/login.go similarity index 100% rename from authserver/internal/sso/login.go rename to server/internal/sso/login.go diff --git a/authserver/internal/sso/login_test.go b/server/internal/sso/login_test.go similarity index 100% rename from authserver/internal/sso/login_test.go rename to server/internal/sso/login_test.go diff --git a/authserver/internal/sso/metadata.go b/server/internal/sso/metadata.go similarity index 100% rename from authserver/internal/sso/metadata.go rename to server/internal/sso/metadata.go diff --git a/server/internal/websocket/.gitkeep b/server/internal/websocket/.gitkeep deleted file mode 100644 index 77150fc..0000000 --- a/server/internal/websocket/.gitkeep +++ /dev/null @@ -1,4 +0,0 @@ -# WebSocket 实时推送模块 - -存放 WebSocket 连接管理相关代码: -- hub.go: WebSocket Hub,管理客户端连接,广播 Ansible 任务日志 diff --git a/server/migrations/.gitkeep b/server/migrations/.gitkeep deleted file mode 100644 index 6c162a7..0000000 --- a/server/migrations/.gitkeep +++ /dev/null @@ -1,4 +0,0 @@ -# 数据库迁移脚本 - -存放按版本管理的表结构变更脚本: -- 001_init.sql: 初始化迁移,创建 users / subsystems / audit / ansible_tasks 表 diff --git a/server/pkg/database/.gitkeep b/server/pkg/database/.gitkeep deleted file mode 100644 index dc7614e..0000000 --- a/server/pkg/database/.gitkeep +++ /dev/null @@ -1,4 +0,0 @@ -# 数据库连接管理 - -存放数据库连接相关代码: -- mysql.go: MySQL 连接池,初始化连接、健康检查、优雅关闭 diff --git a/server/pkg/ldap/.gitkeep b/server/pkg/ldap/.gitkeep deleted file mode 100644 index c26fe50..0000000 --- a/server/pkg/ldap/.gitkeep +++ /dev/null @@ -1,4 +0,0 @@ -# LDAP 客户端封装 - -存放可复用的 LDAP 相关代码: -- client.go: LDAP 客户端,连接管理、用户认证、属性查询 diff --git a/server/pkg/sso/.gitkeep b/server/pkg/sso/.gitkeep deleted file mode 100644 index 42dd31e..0000000 --- a/server/pkg/sso/.gitkeep +++ /dev/null @@ -1,5 +0,0 @@ -# SSO 协议处理 - -存放 SSO 相关协议实现: -- oauth2.go: OAuth 2.0 客户端,主系统↔子系统的 Authorization Code 流程 -- saml.go: SAML 处理,主系统↔LDAP 的 SAML 断言生成和验证 diff --git a/authserver/web/.dockerignore b/server/web/.dockerignore similarity index 100% rename from authserver/web/.dockerignore rename to server/web/.dockerignore diff --git a/authserver/web/Dockerfile b/server/web/Dockerfile similarity index 100% rename from authserver/web/Dockerfile rename to server/web/Dockerfile diff --git a/authserver/web/index.html b/server/web/index.html similarity index 100% rename from authserver/web/index.html rename to server/web/index.html diff --git a/authserver/web/nginx.conf b/server/web/nginx.conf similarity index 100% rename from authserver/web/nginx.conf rename to server/web/nginx.conf diff --git a/authserver/web/package-lock.json b/server/web/package-lock.json similarity index 100% rename from authserver/web/package-lock.json rename to server/web/package-lock.json diff --git a/authserver/web/package.json b/server/web/package.json similarity index 100% rename from authserver/web/package.json rename to server/web/package.json diff --git a/authserver/web/src/App.vue b/server/web/src/App.vue similarity index 100% rename from authserver/web/src/App.vue rename to server/web/src/App.vue diff --git a/authserver/web/src/main.js b/server/web/src/main.js similarity index 100% rename from authserver/web/src/main.js rename to server/web/src/main.js diff --git a/authserver/web/src/style.css b/server/web/src/style.css similarity index 100% rename from authserver/web/src/style.css rename to server/web/src/style.css diff --git a/authserver/web/vite.config.js b/server/web/vite.config.js similarity index 100% rename from authserver/web/vite.config.js rename to server/web/vite.config.js