From a6212335e70d14256823fd8ab29c04d6b88a4251 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 21 Sep 2024 20:03:37 +0800 Subject: [PATCH] :sparkles: Check client ip --- pkg/internal/server/api/check_ip.go | 7 +++++++ pkg/internal/server/api/index.go | 1 + 2 files changed, 8 insertions(+) create mode 100644 pkg/internal/server/api/check_ip.go diff --git a/pkg/internal/server/api/check_ip.go b/pkg/internal/server/api/check_ip.go new file mode 100644 index 0000000..cce5c80 --- /dev/null +++ b/pkg/internal/server/api/check_ip.go @@ -0,0 +1,7 @@ +package api + +import "github.com/gofiber/fiber/v2" + +func getClientIP(c *fiber.Ctx) error { + return c.SendString(c.IP()) +} diff --git a/pkg/internal/server/api/index.go b/pkg/internal/server/api/index.go index c590dd5..6a70a11 100644 --- a/pkg/internal/server/api/index.go +++ b/pkg/internal/server/api/index.go @@ -12,6 +12,7 @@ func MapAPIs(app *fiber.App) { wellKnown.Get("/", func(c *fiber.Ctx) error { return c.SendStatus(fiber.StatusOK) }) + wellKnown.Get("/check-ip", getClientIP) wellKnown.Get("/directory/services", listExistsService) }