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:
parent
b9db4514e2
commit
2858b769dd
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user