func BuildURL(hostname string, insecure bool) string {
	if hostname == "" {
		return ""
	}
	if strings.HasPrefix(hostname, "http://") || strings.HasPrefix(hostname, "https://") {
		return hostname
	}
	protocol := "https"
	if insecure {
		protocol = "http"
	}
	return fmt.Sprintf("%s://%s", protocol, hostname)
}
BuildURL appends http:// or https:// to given hostname, according to the insecure parameter
package utils
import (
	"fmt"
	"sort"
	"strings"
	"crypto/sha256"
	"encoding/hex"
	"time"
)
func ListContains(list []string, search string) bool {
	for _, r := range list {
		if r == search {
			return true
		}
	}
	return false
}
func MapMatchesAll(all, search map[string]string) bool {
	if all == nil || search == nil {
		return false
	}
	if len(all) >= len(search) {
		for k, v := range search {
			if all[k] != v {
				return false
			}
		}
		return true
	}
	return false
}
func Keys(m map[string]string) []string {
	keys := make([]string, 0, len(m))
	for k := range m {
		keys = append(keys, k)
	}
	return keys
}
func FilterValues(m map[string]string, s string) map[string]string {
	filtered := make(map[string]string, len(m))
	for k, v := range m {
		if v != s {
			filtered[k] = v
		}
	}
	return filtered
}