small string split join optimization

This commit is contained in:
yusing
2024-12-19 00:54:31 +08:00
parent 654194b274
commit e7be27413c
20 changed files with 160 additions and 50 deletions

View File

@@ -14,6 +14,7 @@ import (
"github.com/yusing/go-proxy/internal/route/routes"
route "github.com/yusing/go-proxy/internal/route/types"
"github.com/yusing/go-proxy/internal/task"
"github.com/yusing/go-proxy/internal/utils/strutils"
)
var findRouteFunc = findRouteAnyDomain
@@ -124,7 +125,7 @@ func Handler(w http.ResponseWriter, r *http.Request) {
}
func findRouteAnyDomain(host string) (route.HTTPRoute, error) {
hostSplit := strings.Split(host, ".")
hostSplit := strutils.SplitRune(host, '.')
n := len(hostSplit)
switch {
case n == 3: