aboutsummaryrefslogtreecommitdiff
path: root/plugin/file/wildcard.go
blob: 7e8e806a1fd1b6d0cc41d39daefa0d475eb847db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
package file

import "github.com/miekg/dns"

// replaceWithAsteriskLabel replaces the left most label with '*'.
func replaceWithAsteriskLabel(qname string) (wildcard string) {
	i, shot := dns.NextLabel(qname, 0)
	if shot {
		return ""
	}

	return "*." + qname[i:]
}