v2ray-core/app/router/chinaip_json.go

23 lines
379 B
Go
Raw Normal View History

2016-02-01 21:30:00 +00:00
// +build json
2016-10-12 14:11:13 +00:00
package router
2016-02-01 21:30:00 +00:00
import (
"encoding/json"
2016-08-20 18:55:45 +00:00
"v2ray.com/core/common/log"
2016-02-01 21:30:00 +00:00
)
2016-10-11 21:02:44 +00:00
func parseChinaIPRule(data []byte) (*RoutingRule, error) {
2016-02-01 21:30:00 +00: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 21:02:44 +00:00
return &RoutingRule{
Tag: rawRule.OutboundTag,
Ip: chinaIPs,
}, nil
2016-02-01 21:30:00 +00:00
}