Documentation ¶
Index ¶
- Variables
- func BigIntToIPv6(ipaddr *big.Int) net.IP
- func ClientIP(req *http.Request) (string, error)
- func IPv4ToInt(ip string) uint32
- func IPv6ToBigInt(ip net.IP) *big.Int
- func IntToIPv4(ip uint32) string
- func IsIP(addr string) bool
- func IsIPv4(addr string) bool
- func IsIPv6(addr string) bool
- type DomainParsed
- type IPList
- type LocalhostList
- type LocalhostOption
- type LocalhostOptionFunc
Constants ¶
This section is empty.
Variables ¶
var ErrDomainParse = fmt.Errorf("domain parse failed")
var ErrNotfoundClientIP = fmt.Errorf("not found client ip")
Functions ¶
func BigIntToIPv6 ¶ added in v1.4.0
BigIntToIPv6 Convert IP address of version 6 from big integer to net.IP.
func IPv6ToBigInt ¶ added in v1.4.0
IPv6ToBigInt Convert IPv6 address string to integer.
Types ¶
type DomainParsed ¶
DomainParsed parsed domain result structure definition.
func DomainParse ¶
func DomainParse(domain string) (*DomainParsed, error)
DomainParse parse domain to IP address.
func NewDomainParsedWithOriginal ¶
func NewDomainParsedWithOriginal(domain string) *DomainParsed
NewDomainParsedWithOriginal returns a new DomainParsed instance with original domain string.
func (*DomainParsed) FirstIP ¶
func (d *DomainParsed) FirstIP() string
FirstIP returns the IPS list first IP address.
func (*DomainParsed) IPv4s ¶ added in v1.3.1
func (d *DomainParsed) IPv4s() IPList
IPv4s returns an IPv4 list.
func (*DomainParsed) IPv6s ¶ added in v1.3.1
func (d *DomainParsed) IPv6s() IPList
IPv6s returns an IPv6 list.
func (*DomainParsed) String ¶
func (d *DomainParsed) String() string
String implement Stringer interface.
type IPList ¶ added in v1.3.1
type IPList []string
IPList IP list structure definition.
type LocalhostList ¶ added in v1.3.2
type LocalhostList []string
LocalhostList localhost IP list structure definition.
func Localhost ¶ added in v1.3.2
func Localhost(options ...LocalhostOption) (LocalhostList, error)
Localhost Get localhost IP list.
func (LocalhostList) First ¶ added in v1.3.2
func (list LocalhostList) First() string
First returns localhost IP list first element.
type LocalhostOption ¶ added in v1.3.2
type LocalhostOption interface {
// contains filtered or unexported methods
}
LocalhostOption implement Option model.
func WithLocalhostExclude ¶ added in v1.3.2
func WithLocalhostExclude(excludes ...string) LocalhostOption
WithLocalhostExclude Get IP list exclude specify IP.
func WithLocalhostExcludeIPv4 ¶ added in v1.3.2
func WithLocalhostExcludeIPv4(exclude bool) LocalhostOption
WithLocalhostExcludeIPv4 Get IP list exclude IPv4 address.
func WithLocalhostExcludeIPv6 ¶ added in v1.3.2
func WithLocalhostExcludeIPv6(exclude bool) LocalhostOption
WithLocalhostExcludeIPv6 Get IP list exclude IPv6 address.
type LocalhostOptionFunc ¶ added in v1.3.2
type LocalhostOptionFunc func(option *localhostOption)
LocalhostOptionFunc Options function structure.