mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-19 23:03:08 +00:00
simplify router config
This commit is contained in:
1 parent
a7c2425c9c
commit
aab774e78f
19 files changed
+60
-54
No files matched your search
@@ -2,7 +2,7 @@ package point
|
||||
|
||||
import (
|
||||
"github.com/v2ray/v2ray-core/app/dns"
|
||||
routerconfig "github.com/v2ray/v2ray-core/app/router/config"
|
||||
"github.com/v2ray/v2ray-core/app/router"
|
||||
"github.com/v2ray/v2ray-core/common/log"
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
)
|
||||
@@ -38,7 +38,7 @@ type OutboundDetourConfig interface {
|
||||
type PointConfig interface {
|
||||
Port() v2net.Port
|
||||
LogConfig() LogConfig
|
||||
RouterConfig() routerconfig.RouterConfig
|
||||
RouterConfig() router.RouterConfig
|
||||
InboundConfig() ConnectionConfig
|
||||
OutboundConfig() ConnectionConfig
|
||||
InboundDetours() []InboundDetourConfig
|
||||
|
||||
+10
-10
@@ -5,8 +5,8 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
routerconfig "github.com/v2ray/v2ray-core/app/router/config"
|
||||
routerconfigjson "github.com/v2ray/v2ray-core/app/router/config/json"
|
||||
"github.com/v2ray/v2ray-core/app/router"
|
||||
routerjson "github.com/v2ray/v2ray-core/app/router/json"
|
||||
"github.com/v2ray/v2ray-core/common/log"
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
proxyconfig "github.com/v2ray/v2ray-core/proxy/common/config"
|
||||
@@ -15,13 +15,13 @@ import (
|
||||
|
||||
// Config is the config for Point server.
|
||||
type Config struct {
|
||||
PortValue v2net.Port `json:"port"` // Port of this Point server.
|
||||
LogConfigValue *LogConfig `json:"log"`
|
||||
RouterConfigValue *routerconfigjson.RouterConfig `json:"routing"`
|
||||
InboundConfigValue *ConnectionConfig `json:"inbound"`
|
||||
OutboundConfigValue *ConnectionConfig `json:"outbound"`
|
||||
InboundDetoursValue []*InboundDetourConfig `json:"inboundDetour"`
|
||||
OutboundDetoursValue []*OutboundDetourConfig `json:"outboundDetour"`
|
||||
PortValue v2net.Port `json:"port"` // Port of this Point server.
|
||||
LogConfigValue *LogConfig `json:"log"`
|
||||
RouterConfigValue *routerjson.RouterConfig `json:"routing"`
|
||||
InboundConfigValue *ConnectionConfig `json:"inbound"`
|
||||
OutboundConfigValue *ConnectionConfig `json:"outbound"`
|
||||
InboundDetoursValue []*InboundDetourConfig `json:"inboundDetour"`
|
||||
OutboundDetoursValue []*OutboundDetourConfig `json:"outboundDetour"`
|
||||
}
|
||||
|
||||
func (config *Config) Port() v2net.Port {
|
||||
@@ -35,7 +35,7 @@ func (config *Config) LogConfig() point.LogConfig {
|
||||
return config.LogConfigValue
|
||||
}
|
||||
|
||||
func (this *Config) RouterConfig() routerconfig.RouterConfig {
|
||||
func (this *Config) RouterConfig() router.RouterConfig {
|
||||
if this.RouterConfigValue == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package mocks
|
||||
|
||||
import (
|
||||
routerconfig "github.com/v2ray/v2ray-core/app/router/config"
|
||||
routertestingconfig "github.com/v2ray/v2ray-core/app/router/config/testing"
|
||||
"github.com/v2ray/v2ray-core/app/router"
|
||||
routertesting "github.com/v2ray/v2ray-core/app/router/testing"
|
||||
"github.com/v2ray/v2ray-core/common/log"
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
"github.com/v2ray/v2ray-core/shell/point"
|
||||
@@ -73,7 +73,7 @@ func (this *OutboundDetourConfig) Tag() string {
|
||||
type Config struct {
|
||||
PortValue v2net.Port
|
||||
LogConfigValue *LogConfig
|
||||
RouterConfigValue *routertestingconfig.RouterConfig
|
||||
RouterConfigValue *routertesting.RouterConfig
|
||||
InboundConfigValue *ConnectionConfig
|
||||
OutboundConfigValue *ConnectionConfig
|
||||
InboundDetoursValue []*InboundDetourConfig
|
||||
@@ -91,7 +91,7 @@ func (config *Config) LogConfig() point.LogConfig {
|
||||
return config.LogConfigValue
|
||||
}
|
||||
|
||||
func (this *Config) RouterConfig() routerconfig.RouterConfig {
|
||||
func (this *Config) RouterConfig() router.RouterConfig {
|
||||
if this.RouterConfigValue == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user