♻️ 🔥 优化 acgimage, 新增 ipv6 分流

This commit is contained in:
fumiama
2022-01-07 21:57:30 +08:00
parent 62a9e413fb
commit d44171de61
4 changed files with 69 additions and 46 deletions

20
utils/web/ipv6.go Normal file
View File

@@ -0,0 +1,20 @@
package web
import (
"io"
"net/http"
"github.com/sirupsen/logrus"
)
var IsSupportIPv6 = func() bool {
resp, err := http.Get("http://v6.ipv6-test.com/json/widgetdata.php?callback=?")
if err != nil {
logrus.Infoln("[web] 本机不支持ipv6")
return false
}
_, _ = io.ReadAll(resp.Body)
_ = resp.Body.Close()
logrus.Infoln("[web] 本机支持ipv6")
return true
}()