1package dnsutil
2
3import (
4	"strings"
5
6	"github.com/miekg/dns"
7)
8
9// Join joins labels to form a fully qualified domain name. If the last label is
10// the root label it is ignored. Not other syntax checks are performed.
11func Join(labels []string) string {
12	ll := len(labels)
13	if labels[ll-1] == "." {
14		s := strings.Join(labels[:ll-1], ".")
15		return dns.Fqdn(s)
16	}
17	s := strings.Join(labels, ".")
18	return dns.Fqdn(s)
19}
20