From 5dc3cfa8b3efe8d1df7f0de1f7df779f39f15e1a Mon Sep 17 00:00:00 2001 From: rxdn <29165304+rxdn@users.noreply.github.com> Date: Sat, 6 Nov 2021 18:51:09 +0000 Subject: [PATCH] ip handler --- app/http/endpoints/root/IpHandler.go | 7 +++++++ app/http/server.go | 3 +++ 2 files changed, 10 insertions(+) create mode 100644 app/http/endpoints/root/IpHandler.go diff --git a/app/http/endpoints/root/IpHandler.go b/app/http/endpoints/root/IpHandler.go new file mode 100644 index 0000000..6630fd9 --- /dev/null +++ b/app/http/endpoints/root/IpHandler.go @@ -0,0 +1,7 @@ +package root + +import "github.com/gin-gonic/gin" + +func IpHandler(ctx *gin.Context) { + ctx.String(200, ctx.ClientIP()) +} diff --git a/app/http/server.go b/app/http/server.go index 970750f..7586f1e 100644 --- a/app/http/server.go +++ b/app/http/server.go @@ -51,6 +51,9 @@ func StartServer() { router.Use(middleware.Cors(config.Conf)) + // util endpoints + router.GET("/ip", root.IpHandler) + router.GET("/webchat", root.WebChatWs) router.POST("/callback", middleware.VerifyXTicketsHeader, root.CallbackHandler)