mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-13 02:30:26 +00:00
♻️ ✨ 🔥 优化 acgimage, 新增 ipv6 分流
This commit is contained in:
20
utils/web/ipv6.go
Normal file
20
utils/web/ipv6.go
Normal 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
|
||||
}()
|
||||
Reference in New Issue
Block a user