1
0
dwelling-upload/pkg/utils/dwelling.go

27 lines
623 B
Go

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