mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-06-14 15:28:40 +00:00
Chore: Refactor infra/conf.TestToCidrList() (#4017)
This commit is contained in:
parent
17825b25f2
commit
ec1fd008c4
2 changed files with 34 additions and 30 deletions
|
@ -2,35 +2,15 @@ package conf_test
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/xtls/xray-core/app/dns"
|
||||
"github.com/xtls/xray-core/common"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/common/platform"
|
||||
"github.com/xtls/xray-core/common/platform/filesystem"
|
||||
. "github.com/xtls/xray-core/infra/conf"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func init() {
|
||||
wd, err := os.Getwd()
|
||||
common.Must(err)
|
||||
|
||||
if _, err := os.Stat(platform.GetAssetLocation("geoip.dat")); err != nil && os.IsNotExist(err) {
|
||||
common.Must(filesystem.CopyFile(platform.GetAssetLocation("geoip.dat"), filepath.Join(wd, "..", "..", "resources", "geoip.dat")))
|
||||
}
|
||||
|
||||
os.Setenv("xray.location.asset", wd)
|
||||
}
|
||||
|
||||
func TestDNSConfigParsing(t *testing.T) {
|
||||
defer func() {
|
||||
os.Unsetenv("xray.location.asset")
|
||||
}()
|
||||
|
||||
parserCreator := func() func(string) (proto.Message, error) {
|
||||
return func(s string) (proto.Message, error) {
|
||||
config := new(DNSConfig)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue