From 7af7bc3b63d0f02675b730e7e85170592885e23b Mon Sep 17 00:00:00 2001 From: boqiu <82121246@qq.com> Date: Mon, 3 Aug 2026 17:10:50 +0800 Subject: [PATCH] Add API to test client IP --- api/route.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/route.go b/api/route.go index 247f71d..332e035 100644 --- a/api/route.go +++ b/api/route.go @@ -52,6 +52,9 @@ func MustServe(config Config, services service.Services) { gasTankController := NewGasTankController(services) tokenPayController := NewTokenPayController(services) + // test client IP address + api.GET("/ip", middleware.Wrap(testClientIP)) + // account abstract - auth api.POST("/aa/auth", rateLimiters.Middleware("setAuth"), middleware.Metrics("api.aa.auth.send"), middleware.Wrap(aaController.SendAuth)) api.GET("/aa/auth/:txHash", middleware.Metrics("api.aa.auth.status"), middleware.Wrap(aaController.GetAuthStatus)) @@ -67,3 +70,7 @@ func MustServe(config Config, services service.Services) { api.POST("/tokenpay/submit", rateLimiters.Middleware("sponsor"), middleware.Metrics("api.tokenpay.submit"), middleware.Wrap(tokenPayController.Submit)) }) } + +func testClientIP(c *gin.Context) (any, error) { + return middleware.GetRealIP(c), nil +}