mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-15 01:09:20 +02:00
Chore: Drop dead code in test (#4012)
This commit is contained in:
parent
7b4a686b74
commit
83ae38497b
|
@ -7,7 +7,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/xtls/xray-core/app/dns"
|
"github.com/xtls/xray-core/app/dns"
|
||||||
"github.com/xtls/xray-core/app/router"
|
|
||||||
"github.com/xtls/xray-core/common"
|
"github.com/xtls/xray-core/common"
|
||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
"github.com/xtls/xray-core/common/platform"
|
"github.com/xtls/xray-core/common/platform"
|
||||||
|
@ -24,32 +23,11 @@ func init() {
|
||||||
common.Must(filesystem.CopyFile(platform.GetAssetLocation("geoip.dat"), filepath.Join(wd, "..", "..", "resources", "geoip.dat")))
|
common.Must(filesystem.CopyFile(platform.GetAssetLocation("geoip.dat"), filepath.Join(wd, "..", "..", "resources", "geoip.dat")))
|
||||||
}
|
}
|
||||||
|
|
||||||
geositeFilePath := filepath.Join(wd, "geosite.dat")
|
|
||||||
os.Setenv("xray.location.asset", wd)
|
os.Setenv("xray.location.asset", wd)
|
||||||
geositeFile, err := os.OpenFile(geositeFilePath, os.O_CREATE|os.O_WRONLY, 0o600)
|
|
||||||
common.Must(err)
|
|
||||||
defer geositeFile.Close()
|
|
||||||
|
|
||||||
list := &router.GeoSiteList{
|
|
||||||
Entry: []*router.GeoSite{
|
|
||||||
{
|
|
||||||
CountryCode: "TEST",
|
|
||||||
Domain: []*router.Domain{
|
|
||||||
{Type: router.Domain_Full, Value: "example.com"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
listBytes, err := proto.Marshal(list)
|
|
||||||
common.Must(err)
|
|
||||||
common.Must2(geositeFile.Write(listBytes))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDNSConfigParsing(t *testing.T) {
|
func TestDNSConfigParsing(t *testing.T) {
|
||||||
geositePath := platform.GetAssetLocation("geosite.dat")
|
|
||||||
defer func() {
|
defer func() {
|
||||||
os.Remove(geositePath)
|
|
||||||
os.Unsetenv("xray.location.asset")
|
os.Unsetenv("xray.location.asset")
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue