add !pm relay - per-mailbox relay config

This commit is contained in:
Aine
2024-05-02 11:28:37 +03:00
parent 6a63e44bfc
commit ea1533acae
13 changed files with 135 additions and 32 deletions

View File

@@ -2,6 +2,7 @@ package utils
import (
"net"
"net/url"
"sort"
"strconv"
"strings"
@@ -40,6 +41,15 @@ func SanitizeDomain(domain string) string {
return domains[0]
}
// SanitizeURL checks that input URL is valid
func SanitizeURL(str string) string {
parsed, err := url.Parse(str)
if err != nil {
return ""
}
return parsed.String()
}
// Bool converts string to boolean
func Bool(str string) bool {
str = strings.ToLower(str)