summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/mappings.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/services/mappings.go b/services/mappings.go
index aae36f5..d4c3a9d 100644
--- a/services/mappings.go
+++ b/services/mappings.go
@@ -4,6 +4,7 @@ import (
"errors"
"math/rand"
"regexp"
+ "strings"
)
type RegexMapping struct {
@@ -30,7 +31,7 @@ var regexMap = []RegexMapping{
{
// Google Search
Pattern: regexp.MustCompile(`google\.com|whoogle|searx|searxng`),
- Targets: []string{"whoogle", "searx", "searxng"},
+ Targets: []string{"whoogle", "searxng"},
},
{
// Instagram
@@ -122,12 +123,17 @@ var regexMap = []RegexMapping{
}
func MatchRequest(service string) (string, error) {
+
for _, mapping := range regexMap {
hasMatch := mapping.Pattern.MatchString(service)
if !hasMatch {
continue
}
+ if !strings.Contains(service, ".") {
+ return service, nil
+ }
+
index := rand.Intn(len(mapping.Targets))
value := mapping.Targets[index]
return value, nil