diff --git a/pkg/utils/dwelling.go b/pkg/utils/dwelling.go index 5a9f6f6..6a8fc84 100644 --- a/pkg/utils/dwelling.go +++ b/pkg/utils/dwelling.go @@ -4,9 +4,9 @@ import "strings" // MainSite returns homepage address depending on network used. func MainSite(host string) string { - if strings.HasSuffix(host, "i2p") { + if strings.Contains(host, "i2p") { return "http://arav.i2p" - } else if strings.HasSuffix(host, "onion") { + } else if strings.Contains(host, "onion") { return "http://.onion" } @@ -15,12 +15,12 @@ func MainSite(host string) string { // NetworkType detects network based on host suffix, // whether client connected from Tor, I2P or Clearnet. -func NetworkType(host string) string { - if strings.HasSuffix(host, "i2p") { - return "i2p" - } else if strings.HasSuffix(host, "onion") { - return "tor" +func NetworkType(host string) (string, string) { + if strings.Contains(host, "i2p") { + return "i2p", "http" + } else if strings.Contains(host, "onion") { + return "tor", "http" } else { - return "www" + return "www", "https" } }