1
0
mirror of https://github.com/fumiama/terasu.git synced 2026-06-08 20:10:37 +08:00

feat: drop ipv6 test due to server down

This commit is contained in:
源文雨
2025-10-06 02:01:37 +08:00
parent 15625807a5
commit 2732915dda
7 changed files with 10 additions and 38 deletions

View File

@@ -1,28 +1,3 @@
package ip
import (
"context"
"net/http"
"time"
"github.com/RomiChan/syncx"
)
var IsIPv6Available = syncx.Lazy[bool]{Init: func() bool {
ctx, cancel := context.WithTimeout(context.Background(), 4*time.Second)
defer cancel()
req, err := http.NewRequestWithContext(ctx, "GET", "http://v6.ipv6-test.com/json/widgetdata.php?callback=?", nil)
if err != nil {
return false
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
return false
}
_ = resp.Body.Close()
return true
}}
func init() {
go IsIPv6Available.Get()
}
var IsIPv6Available = true