mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-02 22:52:16 +08:00
🎨 Improve online check
This commit is contained in:
parent
1735966518
commit
f7c747c511
@ -111,11 +111,13 @@ func IsPortOpen(port string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isOnline(checkURL string, skipTlsVerify bool, timeout int) (ret 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 {
|
if skipTlsVerify {
|
||||||
c.EnableInsecureSkipVerify()
|
c.EnableInsecureSkipVerify()
|
||||||
}
|
}
|
||||||
c.SetUserAgent(UserAgent)
|
|
||||||
|
|
||||||
for i := 0; i < 2; i++ {
|
for i := 0; i < 2; i++ {
|
||||||
resp, err := c.R().Get(checkURL)
|
resp, err := c.R().Get(checkURL)
|
||||||
|
Loading…
Reference in New Issue
Block a user