diff --git a/main.go b/main.go index 3bae8fe..27ffbc4 100644 --- a/main.go +++ b/main.go @@ -171,6 +171,7 @@ func AuthMiddleware(authToken string) gin.HandlerFunc { } func (s *ProxyService) InitRoutes(e *gin.Engine) { + e.GET("/_ping", s.pong) authToken := s.cfg.AuthToken // replace with your dynamic value as needed if authToken != "" { // 鉴权 @@ -185,6 +186,20 @@ func (s *ProxyService) InitRoutes(e *gin.Engine) { } } +type Pong struct { + Now int `json:"now"` + Status string `json:"status"` + Ns1 string `json:"ns1"` +} + +func (s *ProxyService) pong(c *gin.Context) { + c.JSON(http.StatusOK, Pong{ + Now: time.Now().Second(), + Status: "ok", + Ns1: "200 OK", + }) +} + func (s *ProxyService) completions(c *gin.Context) { ctx := c.Request.Context()