|
|
@ -16,7 +16,7 @@ import (
|
|
|
|
"encoding/json"
|
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"log"
|
|
|
|
"math/rand"
|
|
|
|
"math/rand/v2"
|
|
|
|
"net"
|
|
|
|
"net"
|
|
|
|
"net/http"
|
|
|
|
"net/http"
|
|
|
|
"net/netip"
|
|
|
|
"net/netip"
|
|
|
@ -604,7 +604,7 @@ func filterSlice[T any](a []T, f func(T) bool) []T {
|
|
|
|
func generateHostname() string {
|
|
|
|
func generateHostname() string {
|
|
|
|
tails := words.Tails()
|
|
|
|
tails := words.Tails()
|
|
|
|
scales := words.Scales()
|
|
|
|
scales := words.Scales()
|
|
|
|
if rand.Int()%2 == 0 {
|
|
|
|
if rand.IntN(2) == 0 {
|
|
|
|
// JavaScript
|
|
|
|
// JavaScript
|
|
|
|
tails = filterSlice(tails, func(s string) bool { return strings.HasPrefix(s, "j") })
|
|
|
|
tails = filterSlice(tails, func(s string) bool { return strings.HasPrefix(s, "j") })
|
|
|
|
scales = filterSlice(scales, func(s string) bool { return strings.HasPrefix(s, "s") })
|
|
|
|
scales = filterSlice(scales, func(s string) bool { return strings.HasPrefix(s, "s") })
|
|
|
@ -614,8 +614,8 @@ func generateHostname() string {
|
|
|
|
scales = filterSlice(scales, func(s string) bool { return strings.HasPrefix(s, "a") })
|
|
|
|
scales = filterSlice(scales, func(s string) bool { return strings.HasPrefix(s, "a") })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tail := tails[rand.Intn(len(tails))]
|
|
|
|
tail := tails[rand.IntN(len(tails))]
|
|
|
|
scale := scales[rand.Intn(len(scales))]
|
|
|
|
scale := scales[rand.IntN(len(scales))]
|
|
|
|
return fmt.Sprintf("%s-%s", tail, scale)
|
|
|
|
return fmt.Sprintf("%s-%s", tail, scale)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|