chinaip_json.go 358 B

12345678910111213141516171819
  1. // +build json
  2. package rules
  3. import (
  4. "encoding/json"
  5. "github.com/v2ray/v2ray-core/common/log"
  6. )
  7. func parseChinaIPRule(data []byte) (*Rule, error) {
  8. rawRule := new(JsonRule)
  9. err := json.Unmarshal(data, rawRule)
  10. if err != nil {
  11. log.Error("Router: Invalid router rule: ", err)
  12. return nil, err
  13. }
  14. return NewChinaIPRule(rawRule.OutboundTag), nil
  15. }