mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-08-04 15:19:13 +00:00
simplify
This commit is contained in:
parent
45971efb6b
commit
24e77cfcbf
3 changed files with 28 additions and 4 deletions
26
common/geodata/consts.go
Normal file
26
common/geodata/consts.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package geodata
|
||||
|
||||
import (
|
||||
"github.com/xtls/xray-core/common"
|
||||
)
|
||||
|
||||
var PrivateIPMatcher = common.Must2(IPReg.BuildIPMatcher(common.Must2(ParseIPRules([]string{
|
||||
"0.0.0.0/8",
|
||||
"10.0.0.0/8",
|
||||
"100.64.0.0/10",
|
||||
"127.0.0.0/8",
|
||||
"169.254.0.0/16",
|
||||
"172.16.0.0/12",
|
||||
"192.0.0.0/24",
|
||||
"192.0.2.0/24",
|
||||
"192.88.99.0/24",
|
||||
"192.168.0.0/16",
|
||||
"198.18.0.0/15",
|
||||
"198.51.100.0/24",
|
||||
"203.0.113.0/24",
|
||||
"224.0.0.0/3",
|
||||
"::/127",
|
||||
"fc00::/7",
|
||||
"fe80::/10",
|
||||
"ff00::/8",
|
||||
}))))
|
||||
|
|
@ -241,8 +241,6 @@ type OutboundDetourConfig struct {
|
|||
TargetStrategy string `json:"targetStrategy"`
|
||||
}
|
||||
|
||||
var privateIPMatcher = geodata.NewPrivateIPMatcher()
|
||||
|
||||
func (c *OutboundDetourConfig) checkChainProxyConfig() error {
|
||||
if c.StreamSetting == nil || c.ProxySettings == nil || c.StreamSetting.SocketSettings == nil {
|
||||
return nil
|
||||
|
|
@ -257,7 +255,7 @@ func isInternalOrInvalidAddress(address *Address) bool {
|
|||
if address == nil || address.Address == nil || !address.Family().IsIP() {
|
||||
return true
|
||||
}
|
||||
return privateIPMatcher.Match(address.IP())
|
||||
return geodata.PrivateIPMatcher.Match(address.IP())
|
||||
}
|
||||
|
||||
func (c *OutboundDetourConfig) checkOutboundTLSConflict(rawConfig interface{}, senderSettings *proxyman.SenderConfig) error {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ func init() {
|
|||
defaultBlockPrivateRule = &FinalRule{
|
||||
action: RuleAction_Block,
|
||||
network: allNetworks,
|
||||
ip: geodata.NewPrivateIPMatcher(),
|
||||
ip: geodata.PrivateIPMatcher,
|
||||
}
|
||||
|
||||
defaultBlockAllRule = &FinalRule{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue