Github文件加速
-为访问Github文件进行加速
- - -GitHub 链接带不带协议头均可,支持 release、archive 以及文件,转换后链接均可使用。
-文件大小限制
-...
-白名单状态
-...
-黑名单状态
-...
-diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml index 40a60f6..ecee468 100644 --- a/.github/workflows/build-dev.yml +++ b/.github/workflows/build-dev.yml @@ -59,6 +59,11 @@ jobs: else echo "DEV-VERSION file not found!" && exit 1 fi + - name: 拉取前端 + run: | + sudo git clone https://github.com/WJQSERVER-STUDIO/GHPrxoy-Frontend.git pages + sudo rm -rf pages/.git/ + - name: 安装 Go uses: actions/setup-go@v3 with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 76306c5..76d37ef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,6 +56,11 @@ jobs: else echo "VERSION file not found!" && exit 1 fi + - name: 拉取前端 + run: | + sudo git clone https://github.com/WJQSERVER-STUDIO/GHPrxoy-Frontend.git pages + sudo rm -rf pages/.git/ + - name: 安装 Go uses: actions/setup-go@v3 with: diff --git a/.gitignore b/.gitignore index c16c6b1..02838fb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ demo.toml *.log *.bak list.json -repos \ No newline at end of file +repos +pages \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 93bc519..bc8603b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # 更新日志 +3.0.0 - 2025-03-19 +--- +- RELEASE: Next Gen; 下一个起点; v3会与v2.4.0及以上版本保证兼容关系, 可平顺升级; +- CHANGE: 使用HertZ框架重构, 提升性能 +- CHANGE: 前端在构建时加入, 新增`Design`,`Metro`,`Classic`主题 +- CHANGE: 加入`Mino`主题对接选项 +- FIX: 修正部分日志输出问题 +- CHANGE: 移除gin残留 +- CHANGE: 移除无用传入参数, 调整代码结构 + +25w20b - 2025-03-19 +--- +- PRE-RELEASE: 此版本是v3.0.0的预发布版本,请勿在生产环境中使用; v3.0.0会与v2.4.0及以上保证兼容关系, 可平顺升级; +- CHANGE: 加入`Mino`主题对接选项 +- FIX: 修正部分日志输出问题 +- CHANGE: 移除gin残留 +- CHANGE: 移除无用传入参数, 调整代码结构 + +25w20a - 2025-03-18 +--- +- PRE-RELEASE: 此版本是v3.0.0的预发布版本,请勿在生产环境中使用; v3.0.0会与v2.4.0及以上保证兼容关系, 可平顺升级; +- CHANGE: 使用HertZ重构 +- CHANGE: 前端在构建时加入, 新增`Design`,`Metro`,`Classic`主题 + 2.5.0 - 2025-03-17 --- - ADD: 加入脚本嵌套加速功能 diff --git a/DEV-VERSION b/DEV-VERSION index e33ec6f..b7d6d4a 100644 --- a/DEV-VERSION +++ b/DEV-VERSION @@ -1 +1 @@ -25w19a \ No newline at end of file +25w20b \ No newline at end of file diff --git a/README.md b/README.md index 7aeec5f..9f5595f 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,16 @@ ### 项目特点 - 基于Go语言实现,支持多平台 -- 使用[Gin](https://github.com/gin-gonic/gin)作为Web框架 +- 使用字节旗下的[HertZ](https://github.com/cloudwego/hertz)作为Web框架 - 使用[Touka-HTTPC](https://github.com/satomitouka/touka-httpc)作为HTTP客户端 - 支持Git clone,raw,realeases等文件拉取 +- 支持多个前端主题 +- 支持自定义黑名单/白名单 - 支持Git Clone缓存(配合组件) - 支持Docker部署 - 支持速率限制 - 支持用户鉴权 -- 支持自定义黑名单/白名单 +- 支持shell脚本嵌套加速 - 基于[WJQSERVER-STUDIO/golang-temp](https://github.com/WJQSERVER-STUDIO/golang-temp)模板构建,具有标准化的日志记录与构建流程 ### 项目开发过程 @@ -32,6 +34,7 @@ **本项目是[WJQSERVER-STUDIO/ghproxy-go](https://github.com/WJQSERVER-STUDIO/ghproxy-go)的重构版本,实现了原项目原定功能的同时,进一步优化了性能** 关于此项目的详细开发过程,请参看Commit记录与[CHANGELOG.md](https://github.com/WJQSERVER-STUDIO/ghproxy/blob/main/CHANGELOG.md) +- v3.0.0 迁移到HertZ框架, 进一步提升效率, 同时v3.0.0与v2.4.0及以上版本兼容, 可直接平顺升级 - v2.4.1 对路径匹配进行优化 - v2.0.0 对`proxy`核心模块进行了重构,大幅优化内存占用 - v1.0.0 迁移至本仓库,并再次重构内容实现 @@ -201,4 +204,6 @@ USDT(TRC20): `TNfSYG6F2vkiibd6J6mhhHNWDgWgNdF5hN` ### 捐赠列表 -虚位以待... +| 赞助人 |金额| +|--------|------| +| starry | 8 USDT (TRC20) | diff --git a/VERSION b/VERSION index fad066f..56fea8a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.5.0 \ No newline at end of file +3.0.0 \ No newline at end of file diff --git a/api/api.go b/api/api.go index 5a53c63..2a0068b 100644 --- a/api/api.go +++ b/api/api.go @@ -1,129 +1,137 @@ package api import ( - "encoding/json" + "context" "ghproxy/config" "github.com/WJQSERVER-STUDIO/go-utils/logger" - "github.com/gin-gonic/gin" -) - -var ( - router *gin.Engine - cfg *config.Config + "github.com/cloudwego/hertz/pkg/app" + "github.com/cloudwego/hertz/pkg/app/server" ) var ( logw = logger.Logw - LogDump = logger.LogDump + logDump = logger.LogDump logDebug = logger.LogDebug logInfo = logger.LogInfo logWarning = logger.LogWarning logError = logger.LogError ) -func NoCacheMiddleware() gin.HandlerFunc { - return func(c *gin.Context) { +func NoCacheMiddleware() app.HandlerFunc { + return func(ctx context.Context, c *app.RequestContext) { // 设置禁止缓存的响应头 - c.Header("Cache-Control", "no-store, no-cache, must-revalidate") - c.Header("Pragma", "no-cache") - c.Header("Expires", "0") - c.Next() // 继续处理请求 + c.Response.Header.Set("Cache-Control", "no-store, no-cache, must-revalidate") + c.Response.Header.Set("Pragma", "no-cache") + c.Response.Header.Set("Expires", "0") + c.Next(ctx) // 继续处理请求 } } -func InitHandleRouter(cfg *config.Config, router *gin.Engine, version string) { - apiRouter := router.Group("api", NoCacheMiddleware()) +func InitHandleRouter(cfg *config.Config, r *server.Hertz, version string) { + apiRouter := r.Group("/api", NoCacheMiddleware()) { - apiRouter.GET("/size_limit", func(c *gin.Context) { - SizeLimitHandler(cfg, c) + apiRouter.GET("/size_limit", func(ctx context.Context, c *app.RequestContext) { + SizeLimitHandler(cfg, c, ctx) }) - apiRouter.GET("/whitelist/status", func(c *gin.Context) { - WhiteListStatusHandler(c, cfg) + apiRouter.GET("/whitelist/status", func(ctx context.Context, c *app.RequestContext) { + WhiteListStatusHandler(cfg, c, ctx) }) - apiRouter.GET("/blacklist/status", func(c *gin.Context) { - BlackListStatusHandler(c, cfg) + apiRouter.GET("/blacklist/status", func(ctx context.Context, c *app.RequestContext) { + BlackListStatusHandler(cfg, c, ctx) }) - apiRouter.GET("/cors/status", func(c *gin.Context) { - CorsStatusHandler(c, cfg) + apiRouter.GET("/cors/status", func(ctx context.Context, c *app.RequestContext) { + CorsStatusHandler(cfg, c, ctx) }) - apiRouter.GET("/healthcheck", func(c *gin.Context) { - HealthcheckHandler(c) + apiRouter.GET("/healthcheck", func(ctx context.Context, c *app.RequestContext) { + HealthcheckHandler(c, ctx) }) - apiRouter.GET("/version", func(c *gin.Context) { - VersionHandler(c, version) + apiRouter.GET("/version", func(ctx context.Context, c *app.RequestContext) { + VersionHandler(c, ctx, version) }) - apiRouter.GET("/rate_limit/status", func(c *gin.Context) { - RateLimitStatusHandler(c, cfg) + apiRouter.GET("/rate_limit/status", func(ctx context.Context, c *app.RequestContext) { + RateLimitStatusHandler(cfg, c, ctx) }) - apiRouter.GET("/rate_limit/limit", func(c *gin.Context) { - RateLimitLimitHandler(c, cfg) + apiRouter.GET("/rate_limit/limit", func(ctx context.Context, c *app.RequestContext) { + RateLimitLimitHandler(cfg, c, ctx) }) + apiRouter.GET("/smartgit/status", func(ctx context.Context, c *app.RequestContext) { + SmartGitStatusHandler(cfg, c, ctx) + }) + } logInfo("API router Init success") } -func SizeLimitHandler(cfg *config.Config, c *gin.Context) { +func SizeLimitHandler(cfg *config.Config, c *app.RequestContext, ctx context.Context) { sizeLimit := cfg.Server.SizeLimit - logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, c.Request.URL.Path, c.Request.UserAgent(), c.Request.Proto) - c.Writer.Header().Set("Content-Type", "application/json") - json.NewEncoder(c.Writer).Encode(map[string]interface{}{ + logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, string(c.Path()), c.Request.Header.UserAgent(), c.Request.Header.GetProtocol()) + c.Response.Header.Set("Content-Type", "application/json") + c.JSON(200, (map[string]interface{}{ "MaxResponseBodySize": sizeLimit, - }) + })) } -func WhiteListStatusHandler(c *gin.Context, cfg *config.Config) { - logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, c.Request.URL.Path, c.Request.UserAgent(), c.Request.Proto) - c.Writer.Header().Set("Content-Type", "application/json") - json.NewEncoder(c.Writer).Encode(map[string]interface{}{ +func WhiteListStatusHandler(cfg *config.Config, c *app.RequestContext, ctx context.Context) { + logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, string(c.Path()), c.Request.Header.UserAgent(), c.Request.Header.GetProtocol()) + c.Response.Header.Set("Content-Type", "application/json") + c.JSON(200, (map[string]interface{}{ "Whitelist": cfg.Whitelist.Enabled, - }) + })) } -func BlackListStatusHandler(c *gin.Context, cfg *config.Config) { - logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, c.Request.URL.Path, c.Request.UserAgent(), c.Request.Proto) - c.Writer.Header().Set("Content-Type", "application/json") - json.NewEncoder(c.Writer).Encode(map[string]interface{}{ +func BlackListStatusHandler(cfg *config.Config, c *app.RequestContext, ctx context.Context) { + logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, string(c.Path()), c.Request.Header.UserAgent(), c.Request.Header.GetProtocol()) + c.Response.Header.Set("Content-Type", "application/json") + c.JSON(200, (map[string]interface{}{ "Blacklist": cfg.Blacklist.Enabled, - }) + })) } -func CorsStatusHandler(c *gin.Context, cfg *config.Config) { - logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, c.Request.URL.Path, c.Request.UserAgent(), c.Request.Proto) - c.Writer.Header().Set("Content-Type", "application/json") - json.NewEncoder(c.Writer).Encode(map[string]interface{}{ +func CorsStatusHandler(cfg *config.Config, c *app.RequestContext, ctx context.Context) { + logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, string(c.Path()), c.Request.Header.UserAgent(), c.Request.Header.GetProtocol()) + c.Response.Header.Set("Content-Type", "application/json") + c.JSON(200, (map[string]interface{}{ "Cors": cfg.Server.Cors, - }) + })) } -func HealthcheckHandler(c *gin.Context) { - logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, c.Request.URL.Path, c.Request.UserAgent(), c.Request.Proto) - c.Writer.Header().Set("Content-Type", "application/json") - json.NewEncoder(c.Writer).Encode(map[string]interface{}{ +func HealthcheckHandler(c *app.RequestContext, ctx context.Context) { + logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, string(c.Path()), c.Request.Header.UserAgent(), c.Request.Header.GetProtocol()) + c.Response.Header.Set("Content-Type", "application/json") + c.JSON(200, (map[string]interface{}{ "Status": "OK", - }) + })) } -func VersionHandler(c *gin.Context, version string) { - logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, c.Request.URL.Path, c.Request.UserAgent(), c.Request.Proto) - c.Writer.Header().Set("Content-Type", "application/json") - json.NewEncoder(c.Writer).Encode(map[string]interface{}{ +func VersionHandler(c *app.RequestContext, ctx context.Context, version string) { + logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, string(c.Path()), c.Request.Header.UserAgent(), c.Request.Header.GetProtocol()) + c.Response.Header.Set("Content-Type", "application/json") + c.JSON(200, (map[string]interface{}{ "Version": version, - }) + })) } -func RateLimitStatusHandler(c *gin.Context, cfg *config.Config) { - logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, c.Request.URL.Path, c.Request.UserAgent(), c.Request.Proto) - c.Writer.Header().Set("Content-Type", "application/json") - json.NewEncoder(c.Writer).Encode(map[string]interface{}{ +func RateLimitStatusHandler(cfg *config.Config, c *app.RequestContext, ctx context.Context) { + logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, string(c.Path()), c.Request.Header.UserAgent(), c.Request.Header.GetProtocol()) + c.Response.Header.Set("Content-Type", "application/json") + c.JSON(200, (map[string]interface{}{ "RateLimit": cfg.RateLimit.Enabled, - }) + })) } -func RateLimitLimitHandler(c *gin.Context, cfg *config.Config) { - logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, c.Request.URL.Path, c.Request.UserAgent(), c.Request.Proto) - c.Writer.Header().Set("Content-Type", "application/json") - json.NewEncoder(c.Writer).Encode(map[string]interface{}{ +func RateLimitLimitHandler(cfg *config.Config, c *app.RequestContext, ctx context.Context) { + logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, string(c.Path()), c.Request.Header.UserAgent(), c.Request.Header.GetProtocol()) + c.Response.Header.Set("Content-Type", "application/json") + c.JSON(200, (map[string]interface{}{ "RatePerMinute": cfg.RateLimit.RatePerMinute, - }) + })) +} + +func SmartGitStatusHandler(cfg *config.Config, c *app.RequestContext, ctx context.Context) { + logInfo("%s %s %s %s %s", c.ClientIP(), c.Request.Method, string(c.Path()), c.Request.Header.UserAgent(), c.Request.Header.GetProtocol()) + c.Response.Header.Set("Content-Type", "application/json") + c.JSON(200, (map[string]interface{}{ + "enabled": cfg.GitClone.Mode == "cache", + })) } diff --git a/auth/auth-header.go b/auth/auth-header.go index c29f66b..b63983d 100644 --- a/auth/auth-header.go +++ b/auth/auth-header.go @@ -4,16 +4,16 @@ import ( "fmt" "ghproxy/config" - "github.com/gin-gonic/gin" + "github.com/cloudwego/hertz/pkg/app" ) -func AuthHeaderHandler(c *gin.Context, cfg *config.Config) (isValid bool, err error) { +func AuthHeaderHandler(c *app.RequestContext, cfg *config.Config) (isValid bool, err error) { if !cfg.Auth.Enabled { return true, nil } // 获取"GH-Auth"的值 - authToken := c.GetHeader("GH-Auth") - logDebug("%s %s %s %s %s AUTH_TOKEN: %s", c.Request.Method, c.Request.Host, c.Request.URL.Path, c.Request.Proto, c.Request.RemoteAddr, authToken) + authToken := string(c.GetHeader("GH-Auth")) + logDebug("%s %s %s %s %s AUTH_TOKEN: %s", c.Request.Method, string(c.Path()), c.Request.Header.UserAgent(), c.Request.Header.GetProtocol(), authToken) if authToken == "" { return false, fmt.Errorf("Auth token not found") } diff --git a/auth/auth-parameters.go b/auth/auth-parameters.go index e43a1a7..2e1139d 100644 --- a/auth/auth-parameters.go +++ b/auth/auth-parameters.go @@ -4,16 +4,16 @@ import ( "fmt" "ghproxy/config" - "github.com/gin-gonic/gin" + "github.com/cloudwego/hertz/pkg/app" ) -func AuthParametersHandler(c *gin.Context, cfg *config.Config) (isValid bool, err error) { +func AuthParametersHandler(c *app.RequestContext, cfg *config.Config) (isValid bool, err error) { if !cfg.Auth.Enabled { return true, nil } authToken := c.Query("auth_token") - logDebug("%s %s %s %s %s AUTH_TOKEN: %s", c.ClientIP(), c.Request.Method, c.Request.URL.Path, c.Request.UserAgent(), c.Request.Proto, authToken) + logDebug("%s %s %s %s %s AUTH_TOKEN: %s", c.ClientIP(), c.Request.Method, string(c.Path()), c.Request.Header.UserAgent(), c.Request.Header.GetProtocol(), authToken) if authToken == "" { return false, fmt.Errorf("Auth token not found") diff --git a/auth/auth.go b/auth/auth.go index d7cad1a..0236903 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -1,16 +1,17 @@ package auth import ( + "context" "fmt" "ghproxy/config" "github.com/WJQSERVER-STUDIO/go-utils/logger" - "github.com/gin-gonic/gin" + "github.com/cloudwego/hertz/pkg/app" ) var ( logw = logger.Logw - LogDump = logger.LogDump + logDump = logger.LogDump logDebug = logger.LogDebug logInfo = logger.LogInfo logWarning = logger.LogWarning @@ -35,7 +36,7 @@ func Init(cfg *config.Config) { logDebug("Auth Init") } -func AuthHandler(c *gin.Context, cfg *config.Config) (isValid bool, err error) { +func AuthHandler(ctx context.Context, c *app.RequestContext, cfg *config.Config) (isValid bool, err error) { if cfg.Auth.AuthMethod == "parameters" { isValid, err = AuthParametersHandler(c, cfg) return isValid, err diff --git a/config/config.go b/config/config.go index ee2ab4a..ddeed7b 100644 --- a/config/config.go +++ b/config/config.go @@ -24,7 +24,6 @@ host = "0.0.0.0" # 监听地址 port = 8080 # 监听端口 sizeLimit = 125 # 125MB H2C = true # 是否开启H2C传输 -enableH2C = "on" # 是否开启H2C传输(latest和dev版本请开启) on/off (2.4.0弃用) */ type ServerConfig struct { @@ -33,7 +32,6 @@ type ServerConfig struct { SizeLimit int `toml:"sizeLimit"` H2C bool `toml:"H2C"` Cors string `toml:"cors"` - EnableH2C string `toml:"enableH2C"` Debug bool `toml:"debug"` } @@ -54,7 +52,7 @@ type HttpcConfig struct { /* [gitclone] mode = "bypass" # bypass / cache -smartGitAddr = ":8080" +smartGitAddr = "http://127.0.0.1:8080" ForceH2C = true */ type GitCloneConfig struct { @@ -74,13 +72,11 @@ type ShellConfig struct { /* [pages] mode = "internal" # "internal" or "external" -enabled = false -theme = "bootstrap" # "bootstrap" or "nebula" +theme = "bootstrap" # "bootstrap" or "nebula" or "design" or "classic" staticDir = "/data/www" */ type PagesConfig struct { Mode string `toml:"mode"` - Enabled bool `toml:"enabled"` Theme string `toml:"theme"` StaticDir string `toml:"staticDir"` } diff --git a/gitclone/git-client.go b/gitclone/git-client.go deleted file mode 100644 index 29f0fa8..0000000 --- a/gitclone/git-client.go +++ /dev/null @@ -1,120 +0,0 @@ -package gitclone - -import ( - "archive/tar" - "bytes" - "errors" - "fmt" - "io" - "os" - "path/filepath" - - "github.com/go-git/go-git/v5" - "github.com/pierrec/lz4" -) - -func CloneRepo(dir string, repoName string, repoUrl string) error { - repoPath := dir - _, err := git.PlainClone(repoPath, true, &git.CloneOptions{ - URL: repoUrl, - Progress: os.Stdout, - Mirror: true, - }) - if err != nil && !errors.Is(err, git.ErrRepositoryAlreadyExists) { - fmt.Printf("Fail to clone: %v\n", err) - } else if err != nil && errors.Is(err, git.ErrRepositoryAlreadyExists) { - // 移除文件夹 - fmt.Printf("Repository already exists\n") - err = os.RemoveAll(repoPath) - if err != nil { - fmt.Printf("Fail to remove: %v\n", err) - return err - } - _, err = git.PlainClone(repoPath, true, &git.CloneOptions{ - URL: repoUrl, - Progress: os.Stdout, - Mirror: true, - }) - if err != nil { - fmt.Printf("Fail to clone: %v\n", err) - return err - } - } - - // 压缩 - err = CompressRepo(repoPath) - if err != nil { - fmt.Printf("Fail to compress: %v\n", err) - return err - } - return nil -} - -// CompressRepo 将指定的仓库压缩成 LZ4 格式的压缩包 -func CompressRepo(repoPath string) error { - lz4File, err := os.Create(repoPath + ".lz4") - if err != nil { - return fmt.Errorf("failed to create LZ4 file: %w", err) - } - defer lz4File.Close() - - // 创建 LZ4 编码器 - lz4Writer := lz4.NewWriter(lz4File) - defer lz4Writer.Close() - - // 创建 tar.Writer - tarBuffer := new(bytes.Buffer) - tarWriter := tar.NewWriter(tarBuffer) - - // 遍历仓库目录并打包 - err = filepath.Walk(repoPath, func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - - // 创建 tar 文件头 - header, err := tar.FileInfoHeader(info, "") - if err != nil { - return err - } - header.Name, err = filepath.Rel(repoPath, path) - if err != nil { - return err - } - - // 写入 tar 文件头 - if err := tarWriter.WriteHeader(header); err != nil { - return err - } - - // 如果是文件,写入文件内容 - if !info.IsDir() { - file, err := os.Open(path) - if err != nil { - return err - } - defer file.Close() - - _, err = io.Copy(tarWriter, file) - if err != nil { - return err - } - } - return nil - }) - if err != nil { - return fmt.Errorf("failed to walk through repo directory: %w", err) - } - - // 关闭 tar.Writer - if err := tarWriter.Close(); err != nil { - return fmt.Errorf("failed to close tar writer: %w", err) - } - - // 将 tar 数据写入 LZ4 压缩包 - if _, err := lz4Writer.Write(tarBuffer.Bytes()); err != nil { - return fmt.Errorf("failed to write to LZ4 file: %w", err) - } - - return nil -} diff --git a/gitclone/gitclone.go b/gitclone/gitclone.go deleted file mode 100644 index d9a3f60..0000000 --- a/gitclone/gitclone.go +++ /dev/null @@ -1,14 +0,0 @@ -package gitclone - -import ( - "github.com/WJQSERVER-STUDIO/go-utils/logger" -) - -var ( - logw = logger.Logw - logDump = logger.LogDump - logDebug = logger.LogDebug - logInfo = logger.LogInfo - logWarning = logger.LogWarning - logError = logger.LogError -) diff --git a/gitclone/smart-http.go b/gitclone/smart-http.go deleted file mode 100644 index cb06f0c..0000000 --- a/gitclone/smart-http.go +++ /dev/null @@ -1,164 +0,0 @@ -package gitclone - -/* -package gitclone - -import ( - "compress/gzip" - "ghproxy/config" - "io" - "log" - "net/http" - "os" - - "github.com/gin-gonic/gin" - "github.com/go-git/go-billy/v5/osfs" - "github.com/go-git/go-git/v5/plumbing/format/pktline" - "github.com/go-git/go-git/v5/plumbing/protocol/packp" - "github.com/go-git/go-git/v5/plumbing/transport" - "github.com/go-git/go-git/v5/plumbing/transport/server" -) - -// MIT https://github.com/erred/gitreposerver - -// httpInfoRefs 函数处理 /info/refs 请求,用于 Git 客户端获取仓库的引用信息。 -// 返回一个 gin.HandlerFunc 类型的处理函数。 -func HttpInfoRefs(cfg *config.Config) gin.HandlerFunc { - return func(c *gin.Context) { - - repo := c.Param("repo") // 从 Gin 上下文中获取路由参数 "repo",即仓库名 - username := c.Param("username") - repoName := repo - dir := cfg.GitClone.Dir + "/" + username + "/" + repo - url := "https://github.com/" + username + "/" + repo - - // 输出 repo user dir url - logInfo("Repo: %s, User: %s, Dir: %s, Url: %s\n", repoName, username, dir, url) - - _, err := os.Stat(dir) // 检查目录是否存在 - if os.IsNotExist(err) { - CloneRepo(dir, repoName, url) - } - - // 检查请求参数 "service" 是否为 "git-upload-pack"。 - // 这是为了确保只处理 smart git 的 upload-pack 服务请求。 - if c.Query("service") != "git-upload-pack" { - c.String(http.StatusForbidden, "only smart git") // 如果 service 参数不正确,返回 403 Forbidden 状态码和错误信息 - log.Printf("Request to /info/refs with invalid service: %s, repo: %s\n", c.Query("service"), repoName) // 记录无效 service 参数的日志 - return // 结束处理 - } - - c.Header("content-type", "application/x-git-upload-pack-advertisement") // 设置 HTTP 响应头的 Content-Type 为 advertisement 类型。 - // 这种类型用于告知客户端服务器支持的 Git 服务。 - - ep, err := transport.NewEndpoint("/") // 创建一个新的传输端点 (Endpoint)。这里使用根路径 "/" 作为端点,表示本地文件系统。 - if err != nil { // 检查创建端点是否出错 - log.Printf("Error creating endpoint: %v, repo: %s\n", err, repoName) // 记录创建端点错误日志 - c.String(http.StatusInternalServerError, err.Error()) // 返回 500 Internal Server Error 状态码和错误信息 - return // 结束处理 - } - - bfs := osfs.New(dir) // 创建一个基于本地文件系统的 billy Filesystem (bfs)。dir 变量指定了仓库的根目录。 - ld := server.NewFilesystemLoader(bfs) // 创建一个基于文件系统的仓库加载器 (Loader)。Loader 负责从文件系统中加载仓库。 - svr := server.NewServer(ld) // 创建一个新的 Git 服务器 (Server)。Server 负责处理 Git 服务请求。 - sess, err := svr.NewUploadPackSession(ep, nil) // 创建一个新的 upload-pack 会话 (Session)。Session 用于处理客户端的 upload-pack 请求。 - if err != nil { // 检查创建会话是否出错 - log.Printf("Error creating upload pack session: %v, repo: %s\n", err, repoName) // 记录创建会话错误日志 - c.String(http.StatusInternalServerError, err.Error()) // 返回 500 Internal Server Error 状态码和错误信息 - return // 结束处理 - } - - ar, err := sess.AdvertisedReferencesContext(c.Request.Context()) // 获取已通告的引用 (Advertised References)。Advertised References 包含了仓库的分支、标签等信息。 - if err != nil { // 检查获取 Advertised References 是否出错 - c.String(http.StatusInternalServerError, err.Error()) // 返回 500 Internal Server Error 状态码和错误信息 - log.Printf("Error getting advertised references: %v, repo: %s\n", err, repoName) // 记录获取 Advertised References 错误日志 - return // 结束处理 - } - - // 设置 Advertised References 的前缀 (Prefix)。 - // Prefix 通常包含 # service=git-upload-pack 和 pktline.Flush。 - // # service=git-upload-pack 用于告知客户端服务器提供的是 upload-pack 服务。 - // pktline.Flush 用于在 pkt-line 格式中发送 flush-pkt。 - ar.Prefix = [][]byte{ - []byte("# service=git-upload-pack"), // 服务类型声明 - pktline.Flush, // pkt-line flush 信号 - } - err = ar.Encode(c.Writer) // 将 Advertised References 编码并写入 HTTP 响应。使用 pkt-line 格式进行编码。 - if err != nil { // 检查编码和写入是否出错 - log.Printf("Error encoding advertised references: %v, repo: %s\n", err, repoName) // 记录编码错误日志 - c.String(http.StatusInternalServerError, err.Error()) // 返回 500 Internal Server Error 状态码和错误信息 - return // 结束处理 - } - } -} - -// httpGitUploadPack 函数处理 /git-upload-pack 请求,用于处理 Git 客户端的推送 (push) 操作。 -// 返回一个 gin.HandlerFunc 类型的处理函数。 -func HttpGitUploadPack(cfg *config.Config) gin.HandlerFunc { - return func(c *gin.Context) { - - repo := c.Param("repo") // 从 Gin 上下文中获取路由参数 "repo",即仓库名 - username := c.Param("username") - repoName := repo - dir := cfg.GitClone.Dir + "/" + username + "/" + repo - - c.Header("content-type", "application/x-git-upload-pack-result") // 设置 HTTP 响应头的 Content-Type 为 result 类型。 - // 这种类型用于返回 upload-pack 操作的结果。 - - var bodyReader io.Reader = c.Request.Body // 初始化 bodyReader 为 HTTP 请求的 body。用于读取客户端发送的数据。 - // 检查请求头 "Content-Encoding" 是否为 "gzip"。 - // 如果是 gzip,则需要使用 gzip 解压缩请求 body。 - if c.GetHeader("Content-Encoding") == "gzip" { - gzipReader, err := gzip.NewReader(c.Request.Body) // 创建一个新的 gzip Reader,用于解压缩请求 body。 - if err != nil { // 检查创建 gzip Reader 是否出错 - log.Printf("Error creating gzip reader: %v, repo: %s\n", err, repoName) // 记录创建 gzip Reader 错误日志 - c.String(http.StatusInternalServerError, err.Error()) // 返回 500 Internal Server Error 状态码和错误信息 - return // 结束处理 - } - defer gzipReader.Close() // 延迟关闭 gzip Reader,确保资源释放 - bodyReader = gzipReader // 将 bodyReader 替换为 gzip Reader,后续从 gzip Reader 中读取数据 - } - - upr := packp.NewUploadPackRequest() // 创建一个新的 UploadPackRequest 对象。UploadPackRequest 用于解码客户端发送的 upload-pack 请求数据。 - err := upr.Decode(bodyReader) // 解码请求 body 中的数据到 UploadPackRequest 对象中。使用 packp 协议格式进行解码。 - if err != nil { // 检查解码是否出错 - log.Printf("Error decoding upload pack request: %v, repo: %s\n", err, repoName) // 记录解码错误日志 - c.String(http.StatusInternalServerError, err.Error()) // 返回 500 Internal Server Error 状态码和错误信息 - return // 结束处理 - } - - ep, err := transport.NewEndpoint("/") // 创建一个新的传输端点 (Endpoint)。这里使用根路径 "/" 作为端点,表示本地文件系统。 - if err != nil { // 检查创建端点是否出错 - log.Printf("Error creating endpoint: %v, repo: %s\n", err, repoName) // 记录创建端点错误日志 - c.String(http.StatusInternalServerError, err.Error()) // 返回 500 Internal Server Error 状态码和错误信息 - return // 结束处理 - } - - bfs := osfs.New(dir) // 创建一个基于本地文件系统的 billy Filesystem (bfs)。dir 变量指定了仓库的根目录。 - ld := server.NewFilesystemLoader(bfs) // 创建一个基于文件系统的仓库加载器 (Loader)。Loader 负责从文件系统中加载仓库。 - svr := server.NewServer(ld) // 创建一个新的 Git 服务器 (Server)。Server 负责处理 Git 服务请求。 - sess, err := svr.NewUploadPackSession(ep, nil) // 创建一个新的 upload-pack 会话 (Session)。Session 用于处理客户端的 upload-pack 请求。 - if err != nil { // 检查创建会话是否出错 - log.Printf("Error creating upload pack session: %v, repo: %s\n", err, repoName) // 记录创建会话错误日志 - c.String(http.StatusInternalServerError, err.Error()) // 返回 500 Internal Server Error 状态码和错误信息 - return // 结束处理 - } - - res, err := sess.UploadPack(c.Request.Context(), upr) // 处理 upload-pack 请求,执行实际的仓库推送操作。 - // sess.UploadPack 函数接收 context 和 UploadPackRequest 对象作为参数,返回 UploadPackResult 和 error。 - if err != nil { // 检查 UploadPack 操作是否出错 - c.String(http.StatusInternalServerError, err.Error()) // 返回 500 Internal Server Error 状态码和错误信息 - log.Printf("Error during upload pack: %v, repo: %s\n", err, repoName) // 记录 UploadPack 操作错误日志 - return // 结束处理 - } - - err = res.Encode(c.Writer) // 将 UploadPackResult 编码并写入 HTTP 响应。使用 pkt-line 格式进行编码。 - if err != nil { // 检查编码和写入是否出错 - log.Printf("Error encoding upload pack result: %v, repo: %s\n", err, repoName) // 记录编码错误日志 - c.String(http.StatusInternalServerError, err.Error()) // 返回 500 Internal Server Error 状态码和错误信息 - return // 结束处理 - } - } -} - -*/ diff --git a/go.mod b/go.mod index 5d6971d..588e63d 100644 --- a/go.mod +++ b/go.mod @@ -3,59 +3,37 @@ module ghproxy go 1.24.1 require ( - github.com/BurntSushi/toml v1.4.0 - github.com/WJQSERVER-STUDIO/go-utils/copyb v0.0.4 + github.com/BurntSushi/toml v1.5.0 + github.com/WJQSERVER-STUDIO/go-utils/hwriter v0.0.2 github.com/WJQSERVER-STUDIO/go-utils/logger v1.5.0 - github.com/gin-gonic/gin v1.10.0 - github.com/go-git/go-git/v5 v5.14.0 - github.com/pierrec/lz4 v2.6.1+incompatible + github.com/cloudwego/hertz v0.9.6 + github.com/hertz-contrib/http2 v0.1.8 github.com/satomitouka/touka-httpc v0.3.3 + github.com/valyala/bytebufferpool v1.0.0 golang.org/x/net v0.37.0 golang.org/x/time v0.11.0 ) require ( - dario.cat/mergo v1.0.1 // indirect - github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/ProtonMail/go-crypto v1.1.6 // indirect + github.com/WJQSERVER-STUDIO/go-utils/copyb v0.0.4 // indirect github.com/WJQSERVER-STUDIO/go-utils/log v0.0.1 // indirect + github.com/bytedance/gopkg v0.1.1 // indirect github.com/bytedance/sonic v1.13.1 // indirect github.com/bytedance/sonic/loader v0.2.4 // indirect - github.com/cloudflare/circl v1.6.0 // indirect github.com/cloudwego/base64x v0.1.5 // indirect - github.com/cyphar/filepath-securejoin v0.4.1 // indirect - github.com/emirpasic/gods v1.18.1 // indirect - github.com/frankban/quicktest v1.14.6 // indirect - github.com/gabriel-vasile/mimetype v1.4.8 // indirect - github.com/gin-contrib/sse v1.0.0 // indirect - github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect - github.com/go-git/go-billy/v5 v5.6.2 // 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.25.0 // indirect - github.com/goccy/go-json v0.10.5 // indirect - github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect - github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect - github.com/json-iterator/go v1.1.12 // indirect - github.com/kevinburke/ssh_config v1.2.0 // indirect + github.com/cloudwego/netpoll v0.6.5 // indirect + github.com/fsnotify/fsnotify v1.8.0 // indirect + github.com/google/go-cmp v0.7.0 // indirect github.com/klauspost/cpuid/v2 v2.2.10 // 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-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/pelletier/go-toml/v2 v2.2.3 // indirect - github.com/pjbgf/sha1cd v0.3.2 // indirect - github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect - github.com/skeema/knownhosts v1.3.1 // indirect + github.com/nyaruka/phonenumbers v1.5.0 // indirect + github.com/stretchr/testify v1.10.0 // indirect + github.com/tidwall/gjson v1.18.0 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.2.12 // indirect - github.com/valyala/bytebufferpool v1.0.0 // indirect - github.com/xanzy/ssh-agent v0.3.3 // indirect golang.org/x/arch v0.15.0 // indirect - golang.org/x/crypto v0.36.0 // indirect + golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect google.golang.org/protobuf v1.36.5 // indirect - gopkg.in/warnings.v0 v0.1.2 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 2699522..a4d7633 100644 --- a/go.sum +++ b/go.sum @@ -1,170 +1,93 @@ -dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= -dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= -github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= -github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= -github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= -github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -github.com/ProtonMail/go-crypto v1.1.6 h1:ZcV+Ropw6Qn0AX9brlQLAUXfqLBc7Bl+f/DmNxpLfdw= -github.com/ProtonMail/go-crypto v1.1.6/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= +github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= +github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/WJQSERVER-STUDIO/go-utils/copyb v0.0.4 h1:JLtFd00AdFg/TP+dtvIzLkdHwKUGPOAijN1sMtEYoFg= github.com/WJQSERVER-STUDIO/go-utils/copyb v0.0.4/go.mod h1:FZ6XE+4TKy4MOfX1xWKe6Rwsg0ucYFCdNh1KLvyKTfc= +github.com/WJQSERVER-STUDIO/go-utils/hwriter v0.0.2 h1:z9xSC3qkt8Qjjb+KRV0Az5klUBJ/gE3berBbjVSFVzY= +github.com/WJQSERVER-STUDIO/go-utils/hwriter v0.0.2/go.mod h1:U3dVP2MzKJfK6dPiobxmSdynibqCOn1mxQEVLylESWA= github.com/WJQSERVER-STUDIO/go-utils/log v0.0.1 h1:gJEQspQPB527Vp2FPcdOrynQEj3YYtrg1ixVSB/JvZM= github.com/WJQSERVER-STUDIO/go-utils/log v0.0.1/go.mod h1:j9Q+xnwpOfve7/uJnZ2izRQw6NNoXjvJHz7vUQAaLZE= github.com/WJQSERVER-STUDIO/go-utils/logger v1.5.0 h1:Uk4N7Sh4OPth3am3xVv17JlAm7tsna97ZLQRpQj7r5c= github.com/WJQSERVER-STUDIO/go-utils/logger v1.5.0/go.mod h1:mtxlnDdwsHcqDDpAQLa94nxbPFwNHSAHbBbIXQAA3po= -github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= -github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/bytedance/gopkg v0.1.0/go.mod h1:FtQG3YbQG9L/91pbKSw787yBQPutC+457AvDW77fgUQ= +github.com/bytedance/gopkg v0.1.1 h1:3azzgSkiaw79u24a+w9arfH8OfnQQ4MHUt9lJFREEaE= +github.com/bytedance/gopkg v0.1.1/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM= +github.com/bytedance/mockey v1.2.12 h1:aeszOmGw8CPX8CRx1DZ/Glzb1yXvhjDh6jdFBNZjsU4= +github.com/bytedance/mockey v1.2.12/go.mod h1:3ZA4MQasmqC87Tw0w7Ygdy7eHIc2xgpZ8Pona5rsYIk= github.com/bytedance/sonic v1.13.1 h1:Jyd5CIvdFnkOWuKXr+wm4Nyk2h0yAFsr8ucJgEasO3g= github.com/bytedance/sonic v1.13.1/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY= github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= -github.com/cloudflare/circl v1.6.0 h1:cr5JKic4HI+LkINy2lg3W2jF8sHCVTBncJr5gIIq7qk= -github.com/cloudflare/circl v1.6.0/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4= github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= +github.com/cloudwego/hertz v0.9.6 h1:Kj5SSPlKBC32NIN7+B/tt8O1pdDz8brMai00rqqjULQ= +github.com/cloudwego/hertz v0.9.6/go.mod h1:X5Ez52XhtszU4t+CTBGIJI4PqmcI1oSf8ULBz0SWfLo= github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s= -github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI= +github.com/cloudwego/netpoll v0.6.5 h1:6E/BWhSzQoyLg9Kx/4xiMdIIpovzwBtXvuqSqaTUzDQ= +github.com/cloudwego/netpoll v0.6.5/go.mod h1:BtM+GjKTdwKoC8IOzD08/+8eEn2gYoiNLipFca6BVXQ= 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/elazarl/goproxy v1.7.2 h1:Y2o6urb7Eule09PjlhQRGNsqRfPmYI3KKQLFpCAV3+o= -github.com/elazarl/goproxy v1.7.2/go.mod h1:82vkLNir0ALaW14Rc399OTTjyNREgmdL2cVoIbS6XaE= -github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= -github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= -github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= -github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -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.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E= -github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0= -github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= -github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= -github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c= -github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU= -github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= -github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= -github.com/go-git/go-billy/v5 v5.6.2 h1:6Q86EsPXMa7c3YZ3aLAQsMA0VlWmy43r6FHqa/UNbRM= -github.com/go-git/go-billy/v5 v5.6.2/go.mod h1:rcFC2rAsp/erv7CMz9GczHcuD0D32fWzH+MJAU+jaUU= -github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4= -github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= -github.com/go-git/go-git/v5 v5.14.0 h1:/MD3lCrGjCen5WfEAzKg00MJJffKhC8gzS80ycmCi60= -github.com/go-git/go-git/v5 v5.14.0/go.mod h1:Z5Xhoia5PcWA3NF8vRLURn9E5FRhSl7dGj9ItW3Wk5k= -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.25.0 h1:5Dh7cjvzR7BRZadnsVOzPhWsrwUr0nmsZJxEAnFLNO8= -github.com/go-playground/validator/v10 v10.25.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus= -github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= -github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= -github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ= -github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= +github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= 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/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= -github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -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/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= -github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/hertz-contrib/http2 v0.1.8 h1:kjfCGkUxJZHgfPsnRjx1FLJBG55KvtvSQD214guBQLw= +github.com/hertz-contrib/http2 v0.1.8/go.mod h1:m42hrl8fiTwE4p8c7JdRUZpkePEthvV89q3elL2GeD0= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -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/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/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= -github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= -github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= -github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= -github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= -github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pjbgf/sha1cd v0.3.2 h1:a9wb0bp1oC2TGwStyn0Umc/IGKQnEgF0vVaZ8QF8eo4= -github.com/pjbgf/sha1cd v0.3.2/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxuCS6A= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/nyaruka/phonenumbers v1.5.0 h1:0M+Gd9zl53QC4Nl5z1Yj1O/zPk2XXBUwR/vlzdXSJv4= +github.com/nyaruka/phonenumbers v1.5.0/go.mod h1:gv+CtldaFz+G3vHHnasBSirAi3O2XLqZzVWz4V1pl2E= 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/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/satomitouka/touka-httpc v0.3.3 h1:Th0uJ5do3oqqZgdUDtqD1SH11x8TcJmrwHMJQlEIKCg= github.com/satomitouka/touka-httpc v0.3.3/go.mod h1:sNXyW5XBufkwB9ZJ+PIlgN/6xiJ7aZV1fWGrXR0u3bA= -github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= -github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8= -github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= 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/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 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.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= +github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= +github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= 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.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= -github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= -github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= golang.org/x/arch v0.15.0 h1:QtOrQd0bTUnhNVNndMpLHNWrDmYzZ2KDqSrEymqInZw= golang.org/x/arch v0.15.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE= -golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw= +golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM= +golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= -golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= @@ -173,13 +96,6 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 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= diff --git a/loggin/loggin.go b/loggin/loggin.go deleted file mode 100644 index ccc66be..0000000 --- a/loggin/loggin.go +++ /dev/null @@ -1,34 +0,0 @@ -package loggin - -import ( - "ghproxy/timing" - "time" - - "github.com/WJQSERVER-STUDIO/go-utils/logger" - "github.com/gin-gonic/gin" -) - -var ( - logw = logger.Logw - LogDump = logger.LogDump - logDebug = logger.LogDebug - logInfo = logger.LogInfo - logWarning = logger.LogWarning - logError = logger.LogError -) - -// 日志中间件 -func Middleware() gin.HandlerFunc { - return func(c *gin.Context) { - // 处理请求 - c.Next() - - var timingResults time.Duration - - // 获取计时结果 - timingResults, _ = timing.Get(c) - - // 记录日志 IP METHOD URL USERAGENT PROTOCOL STATUS TIMING - logInfo("%s %s %s %s %d %s ", c.ClientIP(), c.Request.Method, c.Request.URL.Path, c.Request.UserAgent(), c.Writer.Status(), timingResults) - } -} diff --git a/main.go b/main.go index f8adcc2..568832c 100644 --- a/main.go +++ b/main.go @@ -1,10 +1,10 @@ package main import ( + "context" "embed" "flag" "fmt" - "io" "io/fs" "net/http" "time" @@ -13,32 +13,41 @@ import ( "ghproxy/auth" "ghproxy/config" "ghproxy/middleware/loggin" - "ghproxy/middleware/timing" "ghproxy/proxy" "ghproxy/rate" "github.com/WJQSERVER-STUDIO/go-utils/logger" - "github.com/gin-gonic/gin" + "github.com/cloudwego/hertz/pkg/app" + "github.com/cloudwego/hertz/pkg/app/middlewares/server/recovery" + "github.com/cloudwego/hertz/pkg/app/server" + "github.com/cloudwego/hertz/pkg/common/adaptor" + + "github.com/hertz-contrib/http2/factory" ) var ( cfg *config.Config - router *gin.Engine + r *server.Hertz configfile = "/data/ghproxy/config/config.toml" cfgfile string version string - dev string runMode string limiter *rate.RateLimiter iplimiter *rate.IPRateLimiter ) var ( - //go:embed pages/bootstrap/* + //go:embed pages/* pagesFS embed.FS - //go:embed pages/nebula/* - NebulaPagesFS embed.FS + /* + //go:embed pages/bootstrap/* + BootstrapPagesFS embed.FS + //go:embed pages/nebula/* + NebulaPagesFS embed.FS + //go:embed pages/design/* + DesignPagesFS embed.FS + */ ) var ( @@ -86,8 +95,8 @@ func loadlist(cfg *config.Config) { auth.Init(cfg) } -func setupApi(cfg *config.Config, router *gin.Engine, version string) { - api.InitHandleRouter(cfg, router, version) +func setupApi(cfg *config.Config, r *server.Hertz, version string) { + api.InitHandleRouter(cfg, r, version) } func setupRateLimit(cfg *config.Config) { @@ -110,12 +119,19 @@ func InitReq(cfg *config.Config) { func loadEmbeddedPages(cfg *config.Config) (fs.FS, error) { var pages fs.FS var err error - switch cfg.Pages.Theme { case "bootstrap": pages, err = fs.Sub(pagesFS, "pages/bootstrap") case "nebula": - pages, err = fs.Sub(NebulaPagesFS, "pages/nebula") + pages, err = fs.Sub(pagesFS, "pages/nebula") + case "design": + pages, err = fs.Sub(pagesFS, "pages/design") + case "metro": + pages, err = fs.Sub(pagesFS, "pages/metro") + case "classic": + pages, err = fs.Sub(pagesFS, "pages/classic") + case "mino": + pages, err = fs.Sub(pagesFS, "pages/mino") default: pages, err = fs.Sub(pagesFS, "pages/bootstrap") // 默认主题 logWarning("Invalid Pages Theme: %s, using default theme 'bootstrap'", cfg.Pages.Theme) @@ -128,7 +144,7 @@ func loadEmbeddedPages(cfg *config.Config) (fs.FS, error) { } // setupPages 设置页面路由 -func setupPages(cfg *config.Config, router *gin.Engine) { +func setupPages(cfg *config.Config, r *server.Hertz) { switch cfg.Pages.Mode { case "internal": // 加载嵌入式资源 @@ -139,11 +155,42 @@ func setupPages(cfg *config.Config, router *gin.Engine) { } // 设置嵌入式资源路由 - router.GET("/", gin.WrapH(http.FileServer(http.FS(pages)))) - router.GET("/favicon.ico", gin.WrapH(http.FileServer(http.FS(pages)))) - router.GET("/script.js", gin.WrapH(http.FileServer(http.FS(pages)))) - router.GET("/style.css", gin.WrapH(http.FileServer(http.FS(pages)))) - //router.GET("/bootstrap.min.css", gin.WrapH(http.FileServer(http.FS(pages)))) + r.GET("/", func(ctx context.Context, c *app.RequestContext) { + staticServer := http.FileServer(http.FS(pages)) + req, err := adaptor.GetCompatRequest(&c.Request) + if err != nil { + logError("%s", err) + return + } + staticServer.ServeHTTP(adaptor.GetCompatResponseWriter(&c.Response), req) + }) + r.GET("/favicon.ico", func(ctx context.Context, c *app.RequestContext) { + staticServer := http.FileServer(http.FS(pages)) + req, err := adaptor.GetCompatRequest(&c.Request) + if err != nil { + logError("%s", err) + return + } + staticServer.ServeHTTP(adaptor.GetCompatResponseWriter(&c.Response), req) + }) + r.GET("/script.js", func(ctx context.Context, c *app.RequestContext) { + staticServer := http.FileServer(http.FS(pages)) + req, err := adaptor.GetCompatRequest(&c.Request) + if err != nil { + logError("%s", err) + return + } + staticServer.ServeHTTP(adaptor.GetCompatResponseWriter(&c.Response), req) + }) + r.GET("/style.css", func(ctx context.Context, c *app.RequestContext) { + staticServer := http.FileServer(http.FS(pages)) + req, err := adaptor.GetCompatRequest(&c.Request) + if err != nil { + logError("%s", err) + return + } + staticServer.ServeHTTP(adaptor.GetCompatResponseWriter(&c.Response), req) + }) case "external": // 设置外部资源路径 @@ -154,13 +201,10 @@ func setupPages(cfg *config.Config, router *gin.Engine) { //bootstrapPath := fmt.Sprintf("%s/bootstrap.min.css", cfg.Pages.StaticDir) // 设置外部资源路由 - router.GET("/", func(c *gin.Context) { - c.File(indexPagePath) - logInfo("IP:%s UA:%s METHOD:%s HTTPv:%s", c.ClientIP(), c.Request.UserAgent(), c.Request.Method, c.Request.Proto) - }) - router.StaticFile("/favicon.ico", faviconPath) - router.StaticFile("/script.js", javascriptsPath) - router.StaticFile("/style.css", stylesheetsPath) + r.StaticFile("/", indexPagePath) + r.StaticFile("/favicon.ico", faviconPath) + r.StaticFile("/script.js", javascriptsPath) + r.StaticFile("/style.css", stylesheetsPath) //router.StaticFile("/bootstrap.min.css", bootstrapPath) default: @@ -174,10 +218,42 @@ func setupPages(cfg *config.Config, router *gin.Engine) { return } // 设置嵌入式资源路由 - router.GET("/", gin.WrapH(http.FileServer(http.FS(pages)))) - router.GET("/favicon.ico", gin.WrapH(http.FileServer(http.FS(pages)))) - router.GET("/script.js", gin.WrapH(http.FileServer(http.FS(pages)))) - router.GET("/style.css", gin.WrapH(http.FileServer(http.FS(pages)))) + r.GET("/", func(ctx context.Context, c *app.RequestContext) { + staticServer := http.FileServer(http.FS(pages)) + req, err := adaptor.GetCompatRequest(&c.Request) + if err != nil { + logError("%s", err) + return + } + staticServer.ServeHTTP(adaptor.GetCompatResponseWriter(&c.Response), req) + }) + r.GET("/favicon.ico", func(ctx context.Context, c *app.RequestContext) { + staticServer := http.FileServer(http.FS(pages)) + req, err := adaptor.GetCompatRequest(&c.Request) + if err != nil { + logError("%s", err) + return + } + staticServer.ServeHTTP(adaptor.GetCompatResponseWriter(&c.Response), req) + }) + r.GET("/script.js", func(ctx context.Context, c *app.RequestContext) { + staticServer := http.FileServer(http.FS(pages)) + req, err := adaptor.GetCompatRequest(&c.Request) + if err != nil { + logError("%s", err) + return + } + staticServer.ServeHTTP(adaptor.GetCompatResponseWriter(&c.Response), req) + }) + r.GET("/style.css", func(ctx context.Context, c *app.RequestContext) { + staticServer := http.FileServer(http.FS(pages)) + req, err := adaptor.GetCompatRequest(&c.Request) + if err != nil { + logError("%s", err) + return + } + staticServer.ServeHTTP(adaptor.GetCompatResponseWriter(&c.Response), req) + }) } } @@ -191,94 +267,87 @@ func init() { setupRateLimit(cfg) if cfg.Server.Debug { - dev = "true" - version = "dev" - } - if dev == "true" { - gin.SetMode(gin.DebugMode) runMode = "dev" } else { - gin.SetMode(gin.ReleaseMode) runMode = "release" } - logDebug("Run Mode: %s", runMode) - - gin.LoggerWithWriter(io.Discard) - router = gin.New() - - // 添加recovery中间件 - router.Use(gin.Recovery()) - - // 添加log中间件 - router.Use(loggin.Middleware()) - - // 添加计时中间件 - router.Use(timing.Middleware()) - - if cfg.Server.H2C { - router.UseH2C = true + if cfg.Server.Debug { + version = "Dev" } - setupApi(cfg, router, version) +} - setupPages(cfg, router) +func main() { + logDebug("Run Mode: %s", runMode) + + addr := fmt.Sprintf("%s:%d", cfg.Server.Host, cfg.Server.Port) + + r := server.New( + server.WithHostPorts(addr), + server.WithH2C(true), + ) + + r.AddProtocol("h2", factory.NewServerFactory()) + + // 添加Recovery中间件 + r.Use(recovery.Recovery()) + // 添加log中间件 + r.Use(loggin.Middleware()) + + setupApi(cfg, r, version) + + setupPages(cfg, r) // 1. GitHub Releases/Archive - Use distinct path segments for type - router.GET("/github.com/:username/:repo/releases/*filepath", func(c *gin.Context) { // Distinct path for releases - proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c) + r.GET("/github.com/:username/:repo/releases/*filepath", func(ctx context.Context, c *app.RequestContext) { // Distinct path for releases + proxy.NoRouteHandler(cfg, limiter, iplimiter)(ctx, c) }) - router.GET("/github.com/:username/:repo/archive/*filepath", func(c *gin.Context) { // Distinct path for archive - proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c) + r.GET("/github.com/:username/:repo/archive/*filepath", func(ctx context.Context, c *app.RequestContext) { // Distinct path for archive + proxy.NoRouteHandler(cfg, limiter, iplimiter)(ctx, c) }) // 2. GitHub Blob/Raw - Use distinct path segments for type - router.GET("/github.com/:username/:repo/blob/*filepath", func(c *gin.Context) { // Distinct path for blob - proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c) + r.GET("/github.com/:username/:repo/blob/*filepath", func(ctx context.Context, c *app.RequestContext) { // Distinct path for blob + proxy.NoRouteHandler(cfg, limiter, iplimiter)(ctx, c) }) - router.GET("/github.com/:username/:repo/raw/*filepath", func(c *gin.Context) { // Distinct path for raw - proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c) + r.GET("/github.com/:username/:repo/raw/*filepath", func(ctx context.Context, c *app.RequestContext) { // Distinct path for raw + proxy.NoRouteHandler(cfg, limiter, iplimiter)(ctx, c) }) - router.GET("/github.com/:username/:repo/info/*filepath", func(c *gin.Context) { // Distinct path for info - proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c) + r.GET("/github.com/:username/:repo/info/*filepath", func(ctx context.Context, c *app.RequestContext) { // Distinct path for info + proxy.NoRouteHandler(cfg, limiter, iplimiter)(ctx, c) }) - router.GET("/github.com/:username/:repo/git-upload-pack", func(c *gin.Context) { - proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c) + r.GET("/github.com/:username/:repo/git-upload-pack", func(ctx context.Context, c *app.RequestContext) { + proxy.NoRouteHandler(cfg, limiter, iplimiter)(ctx, c) }) // 4. Raw GitHubusercontent - Keep as is (assuming it's distinct enough) - router.GET("/raw.githubusercontent.com/:username/:repo/*filepath", func(c *gin.Context) { - proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c) + r.GET("/raw.githubusercontent.com/:username/:repo/*filepath", func(ctx context.Context, c *app.RequestContext) { + proxy.NoRouteHandler(cfg, limiter, iplimiter)(ctx, c) }) // 5. Gist GitHubusercontent - Keep as is (assuming it's distinct enough) - router.GET("/gist.githubusercontent.com/:username/*filepath", func(c *gin.Context) { - proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c) + r.GET("/gist.githubusercontent.com/:username/*filepath", func(ctx context.Context, c *app.RequestContext) { + proxy.NoRouteHandler(cfg, limiter, iplimiter)(ctx, c) }) // 6. GitHub API Repos - Keep as is (assuming it's distinct enough) - router.GET("/api.github.com/repos/:username/:repo/*filepath", func(c *gin.Context) { - proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c) + r.GET("/api.github.com/repos/:username/:repo/*filepath", func(ctx context.Context, c *app.RequestContext) { + proxy.NoRouteHandler(cfg, limiter, iplimiter)(ctx, c) }) - router.NoRoute(func(c *gin.Context) { - logInfo(c.Request.URL.Path) - proxy.NoRouteHandler(cfg, limiter, iplimiter, runMode)(c) + r.NoRoute(func(ctx context.Context, c *app.RequestContext) { + proxy.NoRouteHandler(cfg, limiter, iplimiter)(ctx, c) }) fmt.Printf("GHProxy Version: %s\n", version) fmt.Printf("A Go Based High-Performance Github Proxy \n") fmt.Printf("Made by WJQSERVER-STUDIO\n") -} -func main() { - err := router.Run(fmt.Sprintf("%s:%d", cfg.Server.Host, cfg.Server.Port)) - if err != nil { - logError("Failed to start server: %v\n", err) - } + r.Spin() defer logger.Close() fmt.Println("Program Exit") } diff --git a/middleware/loggin/loggin.go b/middleware/loggin/loggin.go index ca3f681..95f6668 100644 --- a/middleware/loggin/loggin.go +++ b/middleware/loggin/loggin.go @@ -1,16 +1,16 @@ package loggin import ( - "ghproxy/middleware/timing" + "context" "time" "github.com/WJQSERVER-STUDIO/go-utils/logger" - "github.com/gin-gonic/gin" + "github.com/cloudwego/hertz/pkg/app" ) var ( logw = logger.Logw - LogDump = logger.LogDump + logDump = logger.LogDump logDebug = logger.LogDebug logInfo = logger.LogInfo logWarning = logger.LogWarning @@ -18,17 +18,20 @@ var ( ) // 日志中间件 -func Middleware() gin.HandlerFunc { - return func(c *gin.Context) { - // 处理请求 - c.Next() +func Middleware() app.HandlerFunc { + return func(ctx context.Context, c *app.RequestContext) { + startTime := time.Now() // 请求开始处理前记录当前时间作为开始时间 - var timingResults time.Duration + c.Next(ctx) // 调用 Next() 执行后续的 Handler - // 获取计时结果 - timingResults, _ = timing.Get(c) + endTime := time.Now() // 请求处理完成后记录当前时间作为结束时间 + timingResults := endTime.Sub(startTime) // 计算时间差,得到请求处理耗时 (Duration 类型) // 记录日志 IP METHOD URL USERAGENT PROTOCOL STATUS TIMING - logInfo("%s %s %s %s %d %s ", c.ClientIP(), c.Request.Method, c.Request.URL.Path, c.Request.UserAgent(), c.Writer.Status(), timingResults) + // %s %s %s %s %s %d %s 分别对应: ClientIP, Method, Protolcol, Path, UserAgent, StatusCode, timingResults (需要格式化) + // %v 可以通用地格式化 time.Duration 类型 + logInfo("%s %s %s %s %s %d %v ", c.ClientIP(), c.Method(), c.Request.Header.GetProtocol(), string(c.Path()), c.Request.Header.UserAgent(), c.Response.StatusCode(), timingResults) + + //logInfo("%s %s %s %s %d %v ", c.ClientIP(), c.Method(), c.Path(), c.Request.Header.UserAgent(), c.Response.StatusCode(), timingResults) } } diff --git a/middleware/timing/timing.go b/middleware/timing/timing.go deleted file mode 100644 index 9c0ada8..0000000 --- a/middleware/timing/timing.go +++ /dev/null @@ -1,86 +0,0 @@ -package timing - -import ( - "sync" - "time" - - "github.com/gin-gonic/gin" -) - -// 阶段计时结构(固定数组优化) -type timingData struct { - phases [8]struct { // 预分配8个阶段存储 - name string - dur time.Duration - } - count int - start time.Time -} - -// 对象池(内存重用优化) -var pool = sync.Pool{ - New: func() interface{} { - return new(timingData) - }, -} - -// 中间件入口 -func Middleware() gin.HandlerFunc { - return func(c *gin.Context) { - // 从池中获取计时器 - td := pool.Get().(*timingData) - td.start = time.Now() - td.count = 0 - - // 存储到上下文 - c.Set("timing", td) - - // 请求完成后回收对象 - defer func() { - pool.Put(td) - }() - - c.Next() - } -} - -// 记录阶段耗时 -func Record(c *gin.Context, name string) { - if val, exists := c.Get("timing"); exists { - //td := val.(*timingData) - td, ok := val.(*timingData) - if !ok { - return - } - if td.count < len(td.phases) { - td.phases[td.count].name = name - td.phases[td.count].dur = time.Since(td.start) // 直接记录当前时间 - td.count++ - } - } -} - -// 获取计时结果(日志输出用) -func Get(c *gin.Context) (total time.Duration, phases []struct { - Name string - Dur time.Duration -}) { - if val, exists := c.Get("timing"); exists { - //td := val.(*timingData) - td, ok := val.(*timingData) - if !ok { - return - } - for i := 0; i < td.count; i++ { - phases = append(phases, struct { - Name string - Dur time.Duration - }{ - Name: td.phases[i].name, - Dur: td.phases[i].dur, - }) - } - total = time.Since(td.start) - } - return -} diff --git a/pages/bootstrap/favicon.ico b/pages/bootstrap/favicon.ico deleted file mode 100644 index 9c04d31..0000000 Binary files a/pages/bootstrap/favicon.ico and /dev/null differ diff --git a/pages/bootstrap/index.html b/pages/bootstrap/index.html deleted file mode 100644 index a2bc33e..0000000 --- a/pages/bootstrap/index.html +++ /dev/null @@ -1,104 +0,0 @@ - - - -
- - -为访问Github文件进行加速
- - -GitHub 链接带不带协议头均可,支持 release、archive 以及文件,转换后链接均可使用。
-...
-...
-...
-高速稳定的 GitHub 资源访问解决方案
-
- git clone https://example.com/https://github.com/user/project.git
- git clone https://user:your_token@example.com/https://github.com/user/project.git
- wget https://example.com/https://raw.githubusercontent.com/user/project/main/README.md
- curl -LO https://example.com/https://github.com/user/project/releases/download/v1.0.0/project_1.0.0.amd64.tar.gz
- https://raw.githubusercontent.com/user/repo/main/file.txt
- https://github.com/user/repo/archive/main.zip
- https://github.com/user/repo/releases/download/v1.0.0/app.zip
- https://gist.githubusercontent.com/user/gist_id/raw/file.txt
- git clone https://github.com/user/repo.git
-