func SplitDomainName(s string) (labels []string) {
	if len(s) == 0 {
		return nil
	}
	fqdnEnd := 0  
	idx := Split(s)
	begin := 0
	if s[len(s)-1] == '.' {
		fqdnEnd = len(s) - 1
	} else {
		fqdnEnd = len(s)
	}
	switch len(idx) {
	case 0:
		return nil
	case 1:
	default:
		end := 0
		for i := 1; i < len(idx); i++ {
			end = idx[i]
			labels = append(labels, s[begin:end-1])
			begin = end
		}
	}
	labels = append(labels, s[begin:fqdnEnd])
	return labels
}
Holds a bunch of helper functions for dealing with labels.
SplitDomainName splits a name string into it's labels.
www.miek.nl. returns []string{"www", "miek", "nl"}
.www.miek.nl. returns []string{"", "www", "miek", "nl"},
The root label (.) returns nil. Note that using
strings.Split(s) will work in most cases, but does not handle
escaped dots (\.) for instance.
s must be a syntactically valid domain name, see IsDomainName.
package dns