2016-02-01 16:30:00 -05:00
|
|
|
// +build json
|
|
|
|
|
2016-10-12 10:11:13 -04:00
|
|
|
package router
|
2016-02-01 16:30:00 -05:00
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
|
2016-08-20 14:55:45 -04:00
|
|
|
"v2ray.com/core/common/log"
|
2016-02-01 16:30:00 -05:00
|
|
|
)
|
|
|
|
|
2016-10-11 17:02:44 -04:00
|
|
|
func parseChinaIPRule(data []byte) (*RoutingRule, error) {
|
2016-02-01 16:30:00 -05:00
|
|
|
rawRule := new(JsonRule)
|
|
|
|
err := json.Unmarshal(data, rawRule)
|
|
|
|
if err != nil {
|
|
|
|
log.Error("Router: Invalid router rule: ", err)
|
|
|
|
return nil, err
|
|
|
|
}
|
2016-10-11 17:02:44 -04:00
|
|
|
return &RoutingRule{
|
|
|
|
Tag: rawRule.OutboundTag,
|
|
|
|
Ip: chinaIPs,
|
|
|
|
}, nil
|
2016-02-01 16:30:00 -05:00
|
|
|
}
|