func (t *IPInfo) Info() string {
	return t.info
}
Info return information of ip
package util
import (
	"errors"
	"fmt"
	"net"
	"strings"
)
type IPInfo struct {
	info    string
	isIPNet bool
	ip      net.IP
	ipNet   net.IPNet
}
func ParseIPInfo(v string) (IPInfo, error) {
	if ip, ipNet, err := net.ParseCIDR(v); err == nil {
		return IPInfo{
			info:    v,
			isIPNet: true,
			ip:      ip,
			ipNet:   *ipNet,
		}, nil
	}
	if ip := net.ParseIP(v); ip != nil {
		return IPInfo{
			info:    v,
			isIPNet: false,
			ip:      ip,
		}, nil
	}
	return IPInfo{}, errors.New("invalid ip address")
}