mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 08:11:11 +08:00
24w18d
This commit is contained in:
parent
47d062a1c4
commit
c50f23c399
14 changed files with 78 additions and 70 deletions
6
main.go
6
main.go
|
|
@ -62,7 +62,6 @@ func loadlist(cfg *config.Config) {
|
|||
}
|
||||
|
||||
func setupApi(cfg *config.Config, router *gin.Engine) {
|
||||
// 注册 API 接口
|
||||
api.InitHandleRouter(cfg, router)
|
||||
}
|
||||
|
||||
|
|
@ -73,19 +72,14 @@ func init() {
|
|||
setupLogger(cfg)
|
||||
loadlist(cfg)
|
||||
|
||||
// 设置 Gin 模式
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
|
||||
// 初始化路由
|
||||
router = gin.Default()
|
||||
|
||||
setupApi(cfg, router)
|
||||
|
||||
// 定义路由
|
||||
router.GET("/", func(c *gin.Context) {
|
||||
// 返回403错误
|
||||
c.String(http.StatusForbidden, "403 Forbidden This route is not allowed to access.")
|
||||
// 记录访问者IP UA METHOD
|
||||
LogWarning("Forbidden: IP:%s UA:%s METHOD:%s", c.ClientIP(), c.Request.UserAgent(), c.Request.Method)
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue