package ip import ( "github.com/gin-gonic/gin" "ipv6-test-node/internal/pkg/protocol" "ipv6-test-node/internal/pkg/utils" "net" "net/http" "strconv" ) func MyIP(c *gin.Context) { ip := utils.ToIP(net.ParseIP(c.ClientIP())) c.JSON(http.StatusOK, protocol.MyIPResponse{ Address: c.ClientIP(), Version: strconv.Itoa(int(ip.Version)), }) }