Documentation ¶
Index ¶
- Constants
- Variables
- func AllHosts(cidr *net.IPNet) []net.IP
- func CIDRSubset(cidr *net.IPNet, addr string, num int) []net.IP
- func DialContext(ctx context.Context, network, addr string) (net.Conn, error)
- func FirstLast(cidr *net.IPNet) (net.IP, net.IP)
- func IPDec(ip net.IP)
- func IPInc(ip net.IP)
- func IsIPv4(ip net.IP) bool
- func IsIPv6(ip net.IP) bool
- func IsReservedAddress(addr string) (bool, string)
- func Range2CIDR(first, last net.IP) *net.IPNet
- func RangeHosts(start, end net.IP) []net.IP
- type DNSAnswer
- type DNSRequest
Constants ¶
const ( NONE = "none" ALT = "alt" GUESS = "guess" ARCHIVE = "archive" API = "api" AXFR = "axfr" BRUTE = "brute" CERT = "cert" CRAWL = "crawl" DNS = "dns" RIR = "rir" EXTERNAL = "ext" SCRAPE = "scrape" )
Request tag types.
const IPv4RE = "((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)[.]){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
IPv4RE is a regular expression that will match an IPv4 address.
const ReservedCIDRDescription = "Reserved Network Address Blocks"
ReservedCIDRDescription is the description used for reserved address ranges.
Variables ¶
var LocalAddr net.Addr
LocalAddr is the global option for specifying the network interface.
var ReservedCIDRs = []string{
"192.168.0.0/16",
"172.16.0.0/12",
"10.0.0.0/8",
"127.0.0.0/8",
"224.0.0.0/4",
"240.0.0.0/4",
"100.64.0.0/10",
"198.18.0.0/15",
"169.254.0.0/16",
"192.88.99.0/24",
"192.0.0.0/24",
"192.0.2.0/24",
"192.94.77.0/24",
"192.94.78.0/24",
"192.52.193.0/24",
"192.12.109.0/24",
"192.31.196.0/24",
"192.0.0.0/29",
}
ReservedCIDRs includes all the networks that are reserved for special use.
Functions ¶
func AllHosts ¶
AllHosts returns a slice containing all the IP addresses within the CIDR provided by the parameter. This implementation was obtained/modified from the following: https://gist.github.com/kotakanbe/d3059af990252ba89a82
func CIDRSubset ¶
CIDRSubset returns a subset of the IP addresses contained within the cidr parameter with num elements around the addr element.
func DialContext ¶
DialContext performs the dial using global variables (e.g. LocalAddr).
func IsReservedAddress ¶
IsReservedAddress checks if the addr parameter is within one of the address ranges in the ReservedCIDRs slice.
func Range2CIDR ¶
Range2CIDR turns an IP range into a CIDR.