Documentation
¶
Index ¶
- Constants
- Variables
- func AddressesFromCIDR(cidr string, o chan<- string)
- func IPv42UInt(ips string) (uint32, error)
- func IPv4Range2CIDRs(sIP string, eIP string) ([]string, error)
- func IPv4UIntRange2CIDRs(sI uint32, eI uint32) []string
- func PrintVersion(app string)
- func ReadLines(input *os.File, out chan<- string) error
- func ReadLinesFromReader(input io.Reader, out chan<- string) error
- func ReverseKey(s string) string
- func ReverseKeyBytes(s []byte) []byte
- func UInt2IPv4(ipi uint32) string
Constants ¶
View Source
const MTBL_KEY_LIMIT = 1024 * 1024 * 512
View Source
const MTBL_VAL_LIMIT = 1024 * 1024 * 1024
Variables ¶
View Source
var IPv4MaskSizes = []uint32{
2147483648,
1073741824,
536870912,
268435456,
134217728,
67108864,
33554432,
16777216,
8388608,
4194304,
2097152,
1048576,
524288,
262144,
131072,
65536,
32768,
16384,
8192,
4096,
2048,
1024,
512,
256,
128,
64,
32,
16,
8,
4,
2,
1,
}
IPv4MaskSizes is a precalculated lookup table for IPv4 CIDR mask sizes
View Source
var IPv4Masks = map[uint32]uint32{
1: 32,
2: 31,
4: 30,
8: 29,
16: 28,
32: 27,
64: 26,
128: 25,
256: 24,
512: 23,
1024: 22,
2048: 21,
4096: 20,
8192: 19,
16384: 18,
32768: 17,
65536: 16,
131072: 15,
262144: 14,
524288: 13,
1048576: 12,
2097152: 11,
4194304: 10,
8388608: 9,
16777216: 8,
33554432: 7,
67108864: 6,
134217728: 5,
268435456: 4,
536870912: 3,
1073741824: 2,
2147483648: 1,
}
IPv4Masks is a precalculated lookup table for IPv4 CIDR
View Source
var MTBLCompressionTypes = map[string]int{ "none": mtbl.COMPRESSION_NONE, "snappy": mtbl.COMPRESSION_SNAPPY, "zlib": mtbl.COMPRESSION_ZLIB, "lz4": mtbl.COMPRESSION_LZ4, "lz4hc": mtbl.COMPRESSION_LZ4HC, }
View Source
var MatchIPv4 = regexp.MustCompile(`^(?:(?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})[.](?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})[.](?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})[.](?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2}))$`)
MatchIPv4 is a regular expression for validating IPv4 addresses
View Source
var MatchIPv6 = regexp.MustCompile(`^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?$`)
MatchIPv6 is a regular expression for validating IPv6 addresses
View Source
var Match_SHA1 = regexp.MustCompile(`^[a-zA-Z0-9]{40}$`)
View Source
var Split_WS = regexp.MustCompile(`\s+`)
View Source
var Version string = "0.0.37"
Functions ¶
func AddressesFromCIDR ¶
AddressesFromCIDR parses a CIDR and writes individual IPs to a channel
func IPv4Range2CIDRs ¶
IPv4Range2CIDRs converts a start and stop IPv4 range to a list of CIDRs
func IPv4UIntRange2CIDRs ¶
IPv4UIntRange2CIDRs converts a range of insigned integers into IPv4 CIDRs
func PrintVersion ¶
func PrintVersion(app string)
func ReverseKey ¶
func ReverseKeyBytes ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.