1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-30 05:56:54 -05:00

detect any ip

This commit is contained in:
Darien Raymond 2018-07-18 16:29:29 +02:00
parent b9db4514e2
commit 2858b769dd
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -65,12 +65,21 @@ func (h *Handler) resolveIP(ctx context.Context, domain string) net.Address {
return net.IPAddress(ips[dice.Roll(len(ips))])
}
func isValidAddress(addr *net.IPOrDomain) bool {
if addr == nil {
return false
}
a := addr.AsAddress()
return a != net.AnyIP
}
// Process implements proxy.Outbound.
func (h *Handler) Process(ctx context.Context, link *core.Link, dialer proxy.Dialer) error {
destination, _ := proxy.TargetFromContext(ctx)
if h.config.DestinationOverride != nil {
server := h.config.DestinationOverride.Server
if server.Address != nil {
if isValidAddress(server.Address) {
destination.Address = server.Address.AsAddress()
}
if server.Port != 0 {