aboutsummaryrefslogtreecommitdiff
path: root/plugin/file/wildcard.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/file/wildcard.go')
-rw-r--r--plugin/file/wildcard.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/plugin/file/wildcard.go b/plugin/file/wildcard.go
new file mode 100644
index 000000000..9526cb53f
--- /dev/null
+++ b/plugin/file/wildcard.go
@@ -0,0 +1,13 @@
+package file
+
+import "github.com/miekg/dns"
+
+// replaceWithWildcard replaces the left most label with '*'.
+func replaceWithAsteriskLabel(qname string) (wildcard string) {
+ i, shot := dns.NextLabel(qname, 0)
+ if shot {
+ return ""
+ }
+
+ return "*." + qname[i:]
+}