|
|
@@ -2,6 +2,7 @@ package router_test
|
|
|
|
|
|
import (
|
|
|
"errors"
|
|
|
+ "io/fs"
|
|
|
"os"
|
|
|
"path/filepath"
|
|
|
"strconv"
|
|
|
@@ -32,8 +33,8 @@ func init() {
|
|
|
|
|
|
os.Setenv("v2ray.location.asset", tempPath)
|
|
|
|
|
|
- if _, err := os.Stat(platform.GetAssetLocation("geoip.dat")); err != nil && errors.Is(err, os.ErrNotExist) {
|
|
|
- if _, err := os.Stat(geoipPath); err != nil && errors.Is(err, os.ErrNotExist) {
|
|
|
+ if _, err := os.Stat(platform.GetAssetLocation("geoip.dat")); err != nil && errors.Is(err, fs.ErrNotExist) {
|
|
|
+ if _, err := os.Stat(geoipPath); err != nil && errors.Is(err, fs.ErrNotExist) {
|
|
|
common.Must(os.MkdirAll(tempPath, 0755))
|
|
|
geoipBytes, err := common.FetchHTTPContent(geoipURL)
|
|
|
common.Must(err)
|
|
|
@@ -41,8 +42,8 @@ func init() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if _, err := os.Stat(platform.GetAssetLocation("geosite.dat")); err != nil && errors.Is(err, os.ErrNotExist) {
|
|
|
- if _, err := os.Stat(geositePath); err != nil && errors.Is(err, os.ErrNotExist) {
|
|
|
+ if _, err := os.Stat(platform.GetAssetLocation("geosite.dat")); err != nil && errors.Is(err, fs.ErrNotExist) {
|
|
|
+ if _, err := os.Stat(geositePath); err != nil && errors.Is(err, fs.ErrNotExist) {
|
|
|
common.Must(os.MkdirAll(tempPath, 0755))
|
|
|
geositeBytes, err := common.FetchHTTPContent(geositeURL)
|
|
|
common.Must(err)
|