mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-25 07:20:44 +00:00
Use dns in router
This commit is contained in:
1 parent
3b545abe02
commit
dac1339d6e
15 files changed
+92
-34
No files matched your search
@@ -7,6 +7,7 @@ package point
|
||||
import (
|
||||
"github.com/v2ray/v2ray-core/app"
|
||||
"github.com/v2ray/v2ray-core/app/dispatcher"
|
||||
"github.com/v2ray/v2ray-core/app/dns"
|
||||
"github.com/v2ray/v2ray-core/app/proxyman"
|
||||
"github.com/v2ray/v2ray-core/app/router"
|
||||
"github.com/v2ray/v2ray-core/common/log"
|
||||
@@ -120,9 +121,15 @@ func NewPoint(pConfig *Config) (*Point, error) {
|
||||
}
|
||||
}
|
||||
|
||||
dnsConfig := pConfig.DNSConfig
|
||||
if dnsConfig != nil {
|
||||
dnsServer := dns.NewCacheServer(vpoint.space.ForContext("system.dns"), dnsConfig)
|
||||
vpoint.space.Bind(dns.APP_ID, dnsServer)
|
||||
}
|
||||
|
||||
routerConfig := pConfig.RouterConfig
|
||||
if routerConfig != nil {
|
||||
r, err := router.CreateRouter(routerConfig.Strategy, routerConfig.Settings)
|
||||
r, err := router.CreateRouter(routerConfig.Strategy, routerConfig.Settings, vpoint.space.ForContext("system.router"))
|
||||
if err != nil {
|
||||
log.Error("Failed to create router: ", err)
|
||||
return nil, ErrorBadConfiguration
|
||||
|
||||
Reference in new issue
Block a user