mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-03 16:24:04 +00:00
update end 2 end test
This commit is contained in:
1 parent
5003afc85c
commit
9b830fc432
7 files changed
+111
-22
No files matched your search
@@ -0,0 +1,14 @@
|
||||
package testing
|
||||
|
||||
type RouterConfig struct {
|
||||
StrategyValue string
|
||||
SettingsValue interface{}
|
||||
}
|
||||
|
||||
func (this *RouterConfig) Strategy() string {
|
||||
return this.StrategyValue
|
||||
}
|
||||
|
||||
func (this *RouterConfig) Settings() interface{} {
|
||||
return this.SettingsValue
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"github.com/v2ray/v2ray-core/app/router/rules/config"
|
||||
)
|
||||
|
||||
type RouterRuleConfig struct {
|
||||
RuleList []*TestRule
|
||||
}
|
||||
|
||||
func (this *RouterRuleConfig) Rules() []config.Rule {
|
||||
rules := make([]config.Rule, len(this.RuleList))
|
||||
for idx, rule := range this.RuleList {
|
||||
rules[idx] = rule
|
||||
}
|
||||
return rules
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/v2ray/v2ray-core/app/router"
|
||||
"github.com/v2ray/v2ray-core/app/router/rules/config"
|
||||
"github.com/v2ray/v2ray-core/app/router/rules/config/json"
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
)
|
||||
|
||||
@@ -31,7 +30,7 @@ type RouterFactory struct {
|
||||
}
|
||||
|
||||
func (this *RouterFactory) Create(rawConfig interface{}) (router.Router, error) {
|
||||
config := rawConfig.(*json.RouterRuleConfig)
|
||||
config := rawConfig.(config.RouterRuleConfig)
|
||||
rules := config.Rules()
|
||||
for _, rule := range rules {
|
||||
if rule == nil {
|
||||
|
||||
Reference in new issue
Block a user