This commit is contained in:
Stavros
2025-03-15 17:44:41 +02:00
parent 52f189563b
commit 0c91465c63
6 changed files with 725 additions and 695 deletions

View File

@@ -46,14 +46,14 @@ func ParseUsers(users string) (types.Users, error) {
return usersParsed, nil
}
// Root url parses parses a hostname and returns the root domain (e.g. sub1.sub2.domain.com -> sub2.domain.com)
func GetRootURL(urlSrc string) (string, error) {
// Get upper domain parses a hostname and returns the upper domain (e.g. sub1.sub2.domain.com -> sub2.domain.com)
func GetUpperDomain(urlSrc string) (string, error) {
// Make sure the url is valid
urlParsed, parseErr := url.Parse(urlSrc)
urlParsed, err := url.Parse(urlSrc)
// Check if there was an error
if parseErr != nil {
return "", parseErr
if err != nil {
return "", err
}
// Split the hostname by period