|
|
@@ -7,27 +7,24 @@ import (
|
|
|
"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"
|
|
|
- pointconfig "github.com/v2ray/v2ray-core/shell/point/config"
|
|
|
)
|
|
|
|
|
|
var (
|
|
|
InvalidRule = errors.New("Invalid Rule")
|
|
|
NoRuleApplicable = errors.New("No rule applicable")
|
|
|
-
|
|
|
- EmptyTag = pointconfig.DetourTag("")
|
|
|
)
|
|
|
|
|
|
type Router struct {
|
|
|
rules []config.Rule
|
|
|
}
|
|
|
|
|
|
-func (this *Router) TakeDetour(dest v2net.Destination) (pointconfig.DetourTag, error) {
|
|
|
+func (this *Router) TakeDetour(dest v2net.Destination) (string, error) {
|
|
|
for _, rule := range this.rules {
|
|
|
if rule.Apply(dest) {
|
|
|
return rule.Tag(), nil
|
|
|
}
|
|
|
}
|
|
|
- return EmptyTag, NoRuleApplicable
|
|
|
+ return "", NoRuleApplicable
|
|
|
}
|
|
|
|
|
|
type RouterFactory struct {
|