From 8341fba20fc83e9fea31f19c3d2eeb553910d357 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sun, 6 Feb 2022 15:23:32 +0400 Subject: [PATCH] Utility for my infrastructure. Added MainSite function. --- pkg/utils/dwelling.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 pkg/utils/dwelling.go diff --git a/pkg/utils/dwelling.go b/pkg/utils/dwelling.go new file mode 100644 index 0000000..3547f93 --- /dev/null +++ b/pkg/utils/dwelling.go @@ -0,0 +1,14 @@ +package utils + +import "strings" + +// MainSite returns homepage address depending on network used. +func MainSite(host string) string { + if strings.HasPrefix(host, "i2p") { + return "http://arav.i2p" + } else if strings.HasPrefix(host, "onion") { + return "http://.onion" + } + + return "https://arav.top" +}