mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-10 18:43:41 +08:00
feat: support ip randomize in http header
This commit is contained in:
16
common/ip-gen.go
Normal file
16
common/ip-gen.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
)
|
||||
|
||||
func GenerateIP() string {
|
||||
// Generate a random number between 20 and 240
|
||||
segment2 := rand.Intn(221) + 20
|
||||
segment3 := rand.Intn(256)
|
||||
segment4 := rand.Intn(256)
|
||||
|
||||
ipAddress := fmt.Sprintf("104.%d.%d.%d", segment2, segment3, segment4)
|
||||
return ipAddress
|
||||
}
|
||||
Reference in New Issue
Block a user