Skip to content

Commit

Permalink
fix geoip
Browse files Browse the repository at this point in the history
  • Loading branch information
DarienRaymond committed Oct 17, 2016
1 parent 8b936bc commit 4a67587
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 7,657 deletions.
8 changes: 7 additions & 1 deletion tools/conf/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"v2ray.com/core/common/log"
v2net "v2ray.com/core/common/net"
"v2ray.com/core/tools/geoip"

"github.com/golang/protobuf/proto"
)

type RouterRulesConfig struct {
Expand Down Expand Up @@ -173,9 +175,13 @@ func parseChinaIPRule(data []byte) (*router.RoutingRule, error) {
log.Error("Router: Invalid router rule: ", err)
return nil, err
}
var chinaIPs geoip.CountryIPRange
if err := proto.Unmarshal(geoip.ChinaIPs, &chinaIPs); err != nil {
return nil, err
}
return &router.RoutingRule{
Tag: rawRule.OutboundTag,
Ip: geoip.ChinaIPs,
Ip: chinaIPs.Ips,
}, nil
}

Expand Down
66 changes: 66 additions & 0 deletions tools/geoip/geoip.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions tools/geoip/geoip.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
syntax = "proto3";

package v2ray.core.tools.geoip;
option go_package = "geoip";

import "v2ray.com/core/app/router/config.proto";

message CountryIPRange {
repeated v2ray.core.app.router.IP ips = 1;
}
Loading

0 comments on commit 4a67587

Please sign in to comment.