2024-09-24 05:31:28 +00:00
|
|
|
package router
|
|
|
|
|
|
|
|
import (
|
|
|
|
"api/config"
|
|
|
|
"api/router/middleware"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
func ServerRouter() http.Handler {
|
|
|
|
gin.SetMode(config.Cfg.Server.AppMode)
|
|
|
|
r := gin.New()
|
|
|
|
r.SetTrustedProxies([]string{"*"})
|
|
|
|
|
|
|
|
r.Use(middleware.Cors()) // 跨域中间件
|
|
|
|
|
|
|
|
// 无需鉴权的接口
|
|
|
|
base := r.Group("/api")
|
|
|
|
{
|
|
|
|
base.GET("/getHeaders", networkApi.GetHeaders)
|
2024-09-25 08:35:07 +00:00
|
|
|
base.POST("/getIpInfo", ipApi.GetIpInfo)
|
|
|
|
base.POST("/getIpInfoList", ipApi.GetIpInfoList)
|
2024-09-24 05:31:28 +00:00
|
|
|
}
|
|
|
|
return r
|
|
|
|
}
|