parser.go
func (d *Directive) getArguments() map[string]string {
	arguments := make(map[string]string)
	index := -1
	ip := false

	term := d.term
	index = strings.Index(term, ":")
	if index != -1 {
		// "a"      [ ":" domain-spec ]
		// "ip4"      ":" ip4-network
		// ...
		term := term[index+1 : len(term)]
		spec := ""
		index = strings.Index(term, "/")
		if index == -1 {
			spec = term
		} else {
			spec = term[0:index]
			term = term[index+1 : len(term)]
		}
		if net.ParseIP(spec) != nil {
			arguments["ip"] = spec
			ip = true
		} else {
			arguments["domain"] = spec
		}
	}

	index = strings.Index(term, "/")
	if index == -1 {
		arguments["ip4-cidr"] = ""
		arguments["ip6-cidr"] = ""
		return arguments
	}
	if term[index:index+2] != "//" {
		term = term[index+1 : len(term)]
	} else {
		term = term[index:len(term)]
	}

	cidrs := strings.Split(term, "//")
	if ip {
		if !strings.Contains(arguments["ip"], ":") {
			arguments["ip4-cidr"] = cidrs[0]
		} else {
			arguments["ip6-cidr"] = cidrs[0]
		}

	} else {
		if len(cidrs) == 2 {
			// ip4-cidr + "/" + ip6-cidr
			arguments["ip4-cidr"] = cidrs[0]
			arguments["ip6-cidr"] = cidrs[1]
		}
		if len(cidrs) == 1 {
			// ip4
			arguments["ip4-cidr"] = cidrs[0]
			arguments["ip6-cidr"] = ""
		}
	}

	return arguments
}
func (d *Directive) getArguments() map[string]string {
	arguments := make(map[string]string)
	index := -1
	ip := false

	term := d.term
	index = strings.Index(term, ":")
	if index != -1 {
		// "a"      [ ":" domain-spec ]
		// "ip4"      ":" ip4-network
		// ...
		term := term[index+1 : len(term)]
		spec := ""
		index = strings.Index(term, "/")
		if index == -1 {
			spec = term
		} else {
			spec = term[0:index]
			term = term[index+1 : len(term)]
		}
		if net.ParseIP(spec) != nil {
			arguments["ip"] = spec
			ip = true
		} else {
			arguments["domain"] = spec
		}
	}

	index = strings.Index(term, "/")
	if index == -1 {
		arguments["ip4-cidr"] = ""
		arguments["ip6-cidr"] = ""
		return arguments
	}
	if term[index:index+2] != "//" {
		term = term[index+1 : len(term)]
	} else {
		term = term[index:len(term)]
	}

	cidrs := strings.Split(term, "//")
	if ip {
		if !strings.Contains(arguments["ip"], ":") {
			arguments["ip4-cidr"] = cidrs[0]
		} else {
			arguments["ip6-cidr"] = cidrs[0]
		}

	} else {
		if len(cidrs) == 2 {
			// ip4-cidr + "/" + ip6-cidr
			arguments["ip4-cidr"] = cidrs[0]
			arguments["ip6-cidr"] = cidrs[1]
		}
		if len(cidrs) == 1 {
			// ip4
			arguments["ip4-cidr"] = cidrs[0]
			arguments["ip6-cidr"] = ""
		}
	}

	return arguments
}
// Get the arguments (i.e. domain-spec, ip4-network, ip6-network, dual-cidr-length, ip4-cidr-length, ip6-cidr-length)
// See 'TestDirective -> directive.getArguments()' for possible return values