MCPcopy Create free account
hub / github.com/chainreactors/spray / RandHost

Function RandHost

pkg/utils.go:172–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

170}
171
172func RandHost() string {
173 n := 8
174 b := make([]byte, n)
175 // A rand.Int63() generates 63 random bits, enough for letterIdMax letters!
176 for i, cache, remain := n-1, randInt63(), letterIdMax; i >= 1; {
177 if remain == 0 {
178 cache, remain = randInt63(), letterIdMax
179 }
180 if idx := int(cache & letterIdMask); idx < len(letters) {
181 b[i] = letters[idx]
182 i--
183 }
184 cache >>= letterIdBits
185 remain--
186 }
187
188 b[5] = byte(0x2e)
189 return *(*string)(unsafe.Pointer(&b))
190}
191
192func FilterJs(u string) bool {
193 if commonFilter(u) {

Callers 2

InitMethod · 0.92
doCheckMethod · 0.92

Calls 1

randInt63Function · 0.85

Tested by

no test coverage detected