update: improve http tunnel and slug extraction from domain

This commit is contained in:
2025-02-07 16:32:30 +07:00
parent 82eb7af7a6
commit dfc57cf542
5 changed files with 103 additions and 107 deletions

18
utils/utils.go Normal file
View File

@ -0,0 +1,18 @@
package utils
import (
"math/rand"
"strings"
"time"
)
func GenerateRandomString(length int) string {
const charset = "abcdefghijklmnopqrstuvwxyz"
seededRand := rand.New(rand.NewSource(time.Now().UnixNano() + int64(rand.Intn(9999))))
var result strings.Builder
for i := 0; i < length; i++ {
randomIndex := seededRand.Intn(len(charset))
result.WriteString(string(charset[randomIndex]))
}
return result.String()
}