🎨 Improve online check

This commit is contained in:
Daniel 2025-04-28 11:28:54 +08:00
parent 1735966518
commit f7c747c511
No known key found for this signature in database
GPG Key ID: 86211BA83DF03017

View File

@ -111,11 +111,13 @@ func IsPortOpen(port string) bool {
}
func isOnline(checkURL string, skipTlsVerify bool, timeout int) (ret bool) {
c := req.C().SetTimeout(time.Duration(timeout) * time.Millisecond)
c := req.C().
SetTimeout(time.Duration(timeout) * time.Millisecond).
SetProxy(httpclient.ProxyFromEnvironment).
SetUserAgent(UserAgent)
if skipTlsVerify {
c.EnableInsecureSkipVerify()
}
c.SetUserAgent(UserAgent)
for i := 0; i < 2; i++ {
resp, err := c.R().Get(checkURL)