16 lines
405 B
Go
16 lines
405 B
Go
package dns
|
|
|
|
import "strings"
|
|
|
|
// Extract the username from the domain name @domain that we're processing
|
|
// at the moment.
|
|
func ExtractUsername(pagesDomain, domain string) string {
|
|
suffixlessDomain := strings.TrimSuffix(domain, "."+pagesDomain)
|
|
usernameParts := strings.Split(suffixlessDomain, ".")
|
|
if len(usernameParts) == 1 {
|
|
return usernameParts[0]
|
|
}
|
|
|
|
return strings.Join(usernameParts, ".")
|
|
}
|