将 web 框架从 gin 切换到 fiber
This commit is contained in:
@@ -2,13 +2,12 @@ package handlers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"proxy-server/server/debug"
|
||||
"slices"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func GetConsuming(c *gin.Context) {
|
||||
func GetConsuming(c *fiber.Ctx) error {
|
||||
list := debug.ConsumingList()
|
||||
// sort by total time
|
||||
slices.SortFunc(list, func(a debug.Consuming, b debug.Consuming) int {
|
||||
@@ -25,12 +24,12 @@ func GetConsuming(c *gin.Context) {
|
||||
times := list[i]
|
||||
strList[i] = fmt.Sprintf("Auth: %s, Data: %s, Proxy: %s, Total: %s", times.Auth, times.Data, times.Proxy, times.Total)
|
||||
}
|
||||
c.JSON(200, strList)
|
||||
return c.JSON(strList)
|
||||
}
|
||||
|
||||
func RestConsuming(c *gin.Context) {
|
||||
func RestConsuming(c *fiber.Ctx) error {
|
||||
debug.InitConsumingList()
|
||||
c.JSON(200, gin.H{
|
||||
return c.JSON(fiber.Map{
|
||||
"message": "success",
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user