// add adds an address/ACL mapping.
add adds an address/ACL mapping.
// add adds an address / ACL mapping .
func (m *IPMap) add(addr, acl string) error {
	if m.addresses == nil {
		m.addresses = make(map[string][]string)
	}
	if ip := net.ParseIP(addr); ip != nil {
		s := ip.String()
		m.addresses[s] = append(m.addresses[s], acl)
		return nil
	}
	r, err := ParseIPRange(addr)
	if err != nil {
		return fmt.Errorf("invalid IP address or range: %s", addr)
	}
	m.ranges = append(m.ranges, rangeToGroup{r, acl})
	return nil
}
func ( m * IPMap ) add ( addr , acl string ) error { if m . addresses == nil { m . addresses = make ( map [ string ] [ ] string ) } if ip := net . ParseIP ( addr ) ; ip != nil { s := ip . String ( ) m . addresses [ s ] = append ( m . addresses [ s ] , acl ) return nil } r , err := ParseIPRange ( addr ) if err != nil { return fmt . Errorf ( " " , addr ) } m . ranges = append ( m . ranges , rangeToGroup { r , acl } ) return nil }
add adds an address/ACL mapping.
add adds an address / ACL mapping .