client ip

master
jager 3 years ago
parent dd7e9f5440
commit e7ca929c4a

2
.gitignore vendored

@ -17,4 +17,4 @@
builder builder
logs logs
static

@ -34,4 +34,4 @@ ps:
-@ps -ef | grep ./builder/idata | grep -v grep -@ps -ef | grep ./builder/idata | grep -v grep
push: push:
-@scp builder/* root@119.29.105.154:/root/idata/builder/ -@scp builder/* root@119.29.105.154:/root/idata/bin/

@ -30,7 +30,7 @@ import (
const appName = "idata" const appName = "idata"
func main() { func main() {
rand.Seed(time.Now().Unix()) rand.Seed(time.Now().UnixNano())
ctx, wait := flags.Parse(appName) ctx, wait := flags.Parse(appName)
defer wait() defer wait()

@ -37,9 +37,10 @@ func Registry(engine *gin.Engine) {
apiR.GET("/soup", soup.GetRandSoup) apiR.GET("/soup", soup.GetRandSoup)
apiR.GET("/almanac", almanac.Almanac) apiR.GET("/almanac", almanac.Almanac)
apiR.GET("/dirty_word", dirty.IsDirtyWord) apiR.GET("/dirty_word", dirty.IsDirtyWord)
apiR.Static("/video", "./static/")
} }
func myIp(ctx *gin.Context) { func myIp(ctx *gin.Context) {
addr := ctx.Request.RemoteAddr addr := ctx.ClientIP()
ctx.String(http.StatusOK, addr) ctx.String(http.StatusOK, addr)
} }

Loading…
Cancel
Save