mirror of
https://github.com/nezhahq/nezha.git
synced 2025-02-08 20:48:13 -05:00
增强 IP 获取健壮性
This commit is contained in:
parent
22904e5035
commit
8e95b6565d
@ -4,7 +4,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -27,12 +26,6 @@ var ipv6Servers = []string{
|
|||||||
var cachedIP, cachedCountry string
|
var cachedIP, cachedCountry string
|
||||||
|
|
||||||
func UpdateIP() {
|
func UpdateIP() {
|
||||||
go func() {
|
|
||||||
for {
|
|
||||||
log.Println(cachedIP, cachedCountry)
|
|
||||||
time.Sleep(time.Second)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
for {
|
for {
|
||||||
ipv4 := fetchGeoIP(ipv4Servers)
|
ipv4 := fetchGeoIP(ipv4Servers)
|
||||||
ipv6 := fetchGeoIP(ipv6Servers)
|
ipv6 := fetchGeoIP(ipv6Servers)
|
||||||
|
Loading…
Reference in New Issue
Block a user