package ip import ( "github.com/gin-gonic/gin" "ipv6-test-node/internal/pkg/protocol" "ipv6-test-node/internal/pkg/utils" "net" "net/http" ) func ISP(c *gin.Context) { var req *protocol.ISPRequest err := c.BindJSON(&req) if err != nil { c.AbortWithStatus(http.StatusInternalServerError) return } asn, err := utils.GetASN(utils.ToIP(net.ParseIP(req.Address))) if err != nil { return } name, err := utils.GetISPName(asn) if err != nil { return } c.JSON(http.StatusOK, protocol.ISPResponse{ISP: name}) }