27 lines
592 B
Go
27 lines
592 B
Go
package utils
|
|
|
|
import "strings"
|
|
|
|
// MainSite returns homepage address depending on network used.
|
|
func MainSite(host string) string {
|
|
if strings.HasSuffix(host, "i2p") {
|
|
return "http://arav.i2p"
|
|
} else if strings.HasSuffix(host, "onion") {
|
|
return "http://.onion"
|
|
}
|
|
|
|
return "https://arav.top"
|
|
}
|
|
|
|
// 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"
|
|
} else {
|
|
return "www"
|
|
}
|
|
}
|