reply-ip/cmd/serverFunc.go

23 lines
335 B
Go

package cmd
import (
"fmt"
"github.com/gin-gonic/gin"
"net/http"
)
var (
listenPort string = "1302"
)
func server() {
fmt.Printf("Listening on port %v...\n", listenPort)
router := gin.New()
router.GET("/", serveIP)
router.Run(":" + listenPort)
}
func serveIP(c *gin.Context) {
c.String(http.StatusOK, c.ClientIP()+"\n")
}