1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-11-23 12:02:58 -05:00

remove json packages in app folder

This commit is contained in:
Darien Raymond
2016-01-17 15:20:49 +00:00
parent 48f1d34ca5
commit ae8121e633
31 changed files with 423 additions and 505 deletions

View File

@@ -38,18 +38,18 @@ func (this *cacheEntry) Extend() {
}
type Router struct {
rules []Rule
rules []*Rule
cache *collect.ValidityMap
}
func NewRouter() *Router {
return &Router{
rules: make([]Rule, 0, 16),
rules: make([]*Rule, 0, 16),
cache: collect.NewValidityMap(3600),
}
}
func (this *Router) AddRule(rule Rule) *Router {
func (this *Router) AddRule(rule *Rule) *Router {
this.rules = append(this.rules, rule)
return this
}
@@ -57,7 +57,7 @@ func (this *Router) AddRule(rule Rule) *Router {
func (this *Router) takeDetourWithoutCache(dest v2net.Destination) (string, error) {
for _, rule := range this.rules {
if rule.Apply(dest) {
return rule.Tag(), nil
return rule.Tag, nil
}
}
return "", NoRuleApplicable
@@ -78,7 +78,7 @@ type RouterFactory struct {
}
func (this *RouterFactory) Create(rawConfig interface{}) (router.Router, error) {
config := rawConfig.(RouterRuleConfig)
config := rawConfig.(*RouterRuleConfig)
rules := config.Rules()
router := NewRouter()
for _, rule := range rules {