mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 16:54:15 -04:00
18 lines
345 B
Go
18 lines
345 B
Go
|
|
package kubernetes
|
||
|
|
|
||
|
|
import (
|
||
|
|
"strings"
|
||
|
|
|
||
|
|
"github.com/miekg/dns"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Domain is the opposite of Path.
|
||
|
|
func (k Kubernetes) Domain(s string) string {
|
||
|
|
l := strings.Split(s, "/")
|
||
|
|
// start with 1, to strip /skydns
|
||
|
|
for i, j := 1, len(l)-1; i < j; i, j = i+1, j-1 {
|
||
|
|
l[i], l[j] = l[j], l[i]
|
||
|
|
}
|
||
|
|
return dns.Fqdn(strings.Join(l[1:len(l)-1], "."))
|
||
|
|
}
|