mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 01:57:12 -05:00
isolate dns settings synthesis
This commit is contained in:
parent
3510ddb464
commit
b37755d111
@ -1,4 +1,6 @@
|
|||||||
package conf
|
package dns
|
||||||
|
|
||||||
|
//go:generate go run github.com/v2fly/v2ray-core/v4/common/errors/errorgen
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
@ -1,4 +1,4 @@
|
|||||||
package conf_test
|
package dns_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -15,8 +15,9 @@ import (
|
|||||||
"github.com/v2fly/v2ray-core/v4/common"
|
"github.com/v2fly/v2ray-core/v4/common"
|
||||||
"github.com/v2fly/v2ray-core/v4/common/net"
|
"github.com/v2fly/v2ray-core/v4/common/net"
|
||||||
"github.com/v2fly/v2ray-core/v4/common/platform/filesystem"
|
"github.com/v2fly/v2ray-core/v4/common/platform/filesystem"
|
||||||
"github.com/v2fly/v2ray-core/v4/infra/conf"
|
|
||||||
_ "github.com/v2fly/v2ray-core/v4/infra/conf/geodata/standard"
|
_ "github.com/v2fly/v2ray-core/v4/infra/conf/geodata/standard"
|
||||||
|
|
||||||
|
dns2 "github.com/v2fly/v2ray-core/v4/infra/conf/synthetic/dns"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -28,7 +29,7 @@ func init() {
|
|||||||
wd, err := os.Getwd()
|
wd, err := os.Getwd()
|
||||||
common.Must(err)
|
common.Must(err)
|
||||||
|
|
||||||
tempPath := filepath.Join(wd, "..", "..", "testing", "temp")
|
tempPath := filepath.Join(wd, "..", "..", "..", "..", "testing", "temp")
|
||||||
geoipPath := filepath.Join(tempPath, "geoip.dat")
|
geoipPath := filepath.Join(tempPath, "geoip.dat")
|
||||||
geositePath := filepath.Join(tempPath, "geosite.dat")
|
geositePath := filepath.Join(tempPath, "geosite.dat")
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ func init() {
|
|||||||
func TestDNSConfigParsing(t *testing.T) {
|
func TestDNSConfigParsing(t *testing.T) {
|
||||||
parserCreator := func() func(string) (protoiface.MessageV1, error) {
|
parserCreator := func() func(string) (protoiface.MessageV1, error) {
|
||||||
return func(s string) (protoiface.MessageV1, error) {
|
return func(s string) (protoiface.MessageV1, error) {
|
||||||
config := new(conf.DNSConfig)
|
config := new(dns2.DNSConfig)
|
||||||
if err := json.Unmarshal([]byte(s), config); err != nil {
|
if err := json.Unmarshal([]byte(s), config); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
@ -3,6 +3,7 @@ package conf
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/loader"
|
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/loader"
|
||||||
|
"github.com/v2fly/v2ray-core/v4/infra/conf/synthetic/dns"
|
||||||
"github.com/v2fly/v2ray-core/v4/infra/conf/synthetic/log"
|
"github.com/v2fly/v2ray-core/v4/infra/conf/synthetic/log"
|
||||||
"github.com/v2fly/v2ray-core/v4/infra/conf/synthetic/router"
|
"github.com/v2fly/v2ray-core/v4/infra/conf/synthetic/router"
|
||||||
"strings"
|
"strings"
|
||||||
@ -343,7 +344,7 @@ type Config struct {
|
|||||||
|
|
||||||
LogConfig *log.LogConfig `json:"log"`
|
LogConfig *log.LogConfig `json:"log"`
|
||||||
RouterConfig *router.RouterConfig `json:"routing"`
|
RouterConfig *router.RouterConfig `json:"routing"`
|
||||||
DNSConfig *DNSConfig `json:"dns"`
|
DNSConfig *dns.DNSConfig `json:"dns"`
|
||||||
InboundConfigs []InboundDetourConfig `json:"inbounds"`
|
InboundConfigs []InboundDetourConfig `json:"inbounds"`
|
||||||
OutboundConfigs []OutboundDetourConfig `json:"outbounds"`
|
OutboundConfigs []OutboundDetourConfig `json:"outbounds"`
|
||||||
Transport *TransportConfig `json:"transport"`
|
Transport *TransportConfig `json:"transport"`
|
||||||
|
Loading…
Reference in New Issue
Block a user