summaryrefslogtreecommitdiff
path: root/web/controllers/reflect_ip.go
diff options
context:
space:
mode:
Diffstat (limited to 'web/controllers/reflect_ip.go')
-rw-r--r--web/controllers/reflect_ip.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/web/controllers/reflect_ip.go b/web/controllers/reflect_ip.go
new file mode 100644
index 0000000..d04b98c
--- /dev/null
+++ b/web/controllers/reflect_ip.go
@@ -0,0 +1,19 @@
1package controllers
2
3import (
4 "net/http"
5
6 "github.com/gin-gonic/gin"
7
8 "code.crute.me/mcrute/go_ddns_manager/web"
9)
10
11func ReflectIP(c *gin.Context) {
12 ip := web.GetRequestIP(c)
13 if ip == nil {
14 c.String(http.StatusInternalServerError, "")
15 return
16 }
17
18 c.String(http.StatusOK, ip.String())
19}