records, ok := r.store.Records[domain.ID()][key]
if !ok {
- continue
+ for _, wc := range key.Wildcards() {
+ records, ok = r.store.Records[domain.ID()][wc]
+ if ok {
+ r.log.V(2).Debugf(" query for %q matched on wildcard candidate %s", key, wc)
+ break
+ }
+ }
+ if !ok {
+ continue
+ }
}
answers := make([]dns.RR, 0)
type recordKey string
+func (rk recordKey) Wildcards() []recordKey {
+ parts := strings.Split(string(rk), ".")
+ wildcards := make([]recordKey, len(parts))
+ for i, _ := range parts {
+ parts[i] = "*"
+ wildcards = append(wildcards, recordKey(strings.Join(parts[i:], ".")))
+ }
+ return wildcards
+}
+
var machinesRegistryStorePath string
func init() {