Documentation
¶
Index ¶
- Variables
- func BuildCloudflareClient(ip *net.IPAddr) *http.Client
- func CheckCF()
- func ExecuteCloudflareRequest(req *http.Request) (*http.Response, error)
- func InitRandSeed()
- func MapColoMap() *sync.Map
- func TestDownloadSpeed(ipSet models.PingDelaySet) (speedSet models.DownloadSpeedSet)
- type IPRanges
- type Ping
Constants ¶
This section is empty.
Variables ¶
View Source
var ( URL = defaultURL Timeout = defaultTimeout Disable = defaultDisableDownload TestCount = defaultTestNum MinSpeed = defaultMinSpeed )
View Source
var ( Httping bool = true HttpingStatusCode int HttpingCFColo string HttpingCFColomap *sync.Map OutRegexp = regexp.MustCompile(`[A-Z]{3}`) )
View Source
var ( // TestAll test all ip TestAll = false // IPFile is the filename of IP Rangs IPFile = defaultInputFile IPText string )
View Source
var ( Routines = defaultRoutines TCPPort int = defaultPort PingTimes int = defaultPingTimes IpTotal atomic.Int64 IpDone atomic.Int64 )
View Source
var BetterIP string
View Source
var IsWatching = false
View Source
var ReCheck = make(chan bool)
Functions ¶
func InitRandSeed ¶
func InitRandSeed()
func init() {
defaultTransportDialContext := (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext
http.DefaultTransport.(*http.Transport).DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
// 3. 获取 addr 的端口,有可能我们第一次访问它会重定向,端口变了
// 所以这里的逻辑是防止它重定向的时候端口变了,这里 ip 还是绑定的
// 之前端口,会导致错误 400
if (strings.Contains(addr, "hiyai.cn") || strings.Contains(addr, "aider.email")) && BetterIP != "" {
portSlice := strings.Split(addr, ":")
port := portSlice[1]
addr = BetterIP + ":" + port
fmt.Println("=========================================================", BetterIP)
return dialer.DialContext(ctx, network, addr)
}
return defaultTransportDialContext(ctx, network, addr)
}
}
func MapColoMap ¶
func TestDownloadSpeed ¶
func TestDownloadSpeed(ipSet models.PingDelaySet) (speedSet models.DownloadSpeedSet)
Types ¶
Click to show internal directories.
Click to hide internal directories.