cidr: github.com/m7shapan/cidr Index | Files

package cidr

import "github.com/m7shapan/cidr"

Index

Package Files

helpers.go parse.go v4.go v6.go

func DtoIPv4 Uses

func DtoIPv4(i uint32) net.IP

func DtoIPv6 Uses

func DtoIPv6(i *big.Int) net.IP

func IPv4tod Uses

func IPv4tod(ip net.IP) uint32

IPv4tod convert IPv4 to decimal in case IP is not IPv4 will return 0

func IPv6tod Uses

func IPv6tod(ip net.IP) *big.Int

IPv6tod convert IPv6 to decimal in case IP is not IPv6 will return nil

type ParsedCIDR Uses

type ParsedCIDR struct {
    FirstIP net.IP
    LastIP  net.IP
    IPNet   *net.IPNet
    IsIPv4  bool
    IsIPv6  bool
}

An ParsedCIDR contains FirstIP the first ip of the parsed range LasttIP the last ip of the parsed range IPNet represents an IP network IsIPv4 check for IPv4 IsIPv6 check for IPv6

func ParseCIDR Uses

func ParseCIDR(s string) (*ParsedCIDR, error)

ParseCIDR return ParsedCIDR for the provided IP Range

func (*ParsedCIDR) FirstIPv4 Uses

func (p *ParsedCIDR) FirstIPv4() uint32

FirstIPv4 return Decimal FirstIP

func (*ParsedCIDR) FirstIPv6 Uses

func (p *ParsedCIDR) FirstIPv6() *big.Int

FirstIPv6 return Decimal FirstIP

func (*ParsedCIDR) HostCountIPv4 Uses

func (p *ParsedCIDR) HostCountIPv4() uint32

HostCountIPv4 return number of IPs on the parsed range

func (*ParsedCIDR) HostCountIPv6 Uses

func (p *ParsedCIDR) HostCountIPv6() *big.Int

HostCountIPv6 return number of IPs on the parsed range

func (*ParsedCIDR) LastIPv4 Uses

func (p *ParsedCIDR) LastIPv4() uint32

LastIPv4 return Decimal LastIP

func (*ParsedCIDR) LastIPv6 Uses

func (p *ParsedCIDR) LastIPv6() *big.Int

LastIPv6 return Decimal LastIP

Package cidr imports 3 packages (graph). Updated 2020-04-28. Refresh now. Tools for package owners.