Get the active tunnels for a remote forwarding listener.

@param addressToBind
@param portToBind
@return ActiveTunnel[]
@throws IOException
498172
public ActiveTunnel[] getRemoteForwardingTunnels(String addressToBind,
			int portToBind) throws IOException {
		return getRemoteForwardingTunnels(generateKey(addressToBind, portToBind));
	}
326288
public synchronized void stopLocalForwarding(String bindAddress,
			int bindPort, boolean killActiveTunnels) throws SshException {
		String key = generateKey(bindAddress, bindPort);
		stopLocalForwarding(key, killActiveTunnels);
	}
351003
def get_local_urls(port):
    ''''''
    url_list = []
    for name, info in psutil.net_if_addrs().items():
        for addr in info:
            if AddressFamily.AF_INET == addr.family:
                url_list.append('http://{}:{}'.format(addr.address, port))
    return url_list
1046637
@Override
   public String[] getServers() {
      Collection<SocketAddress> addresses = channelFactory.getServers();
      return addresses.stream().map(SocketAddress::toString).toArray(String[]::new);
   }
622111
public String getHostByAddr(byte [] addr) throws UnknownHostException {
	Name name = ReverseMap.fromAddress(InetAddress.getByAddress(addr));
	Record [] records = new Lookup(name, Type.PTR).run();
	if (records == null)
		throw new UnknownHostException();
	return ((PTRRecord) records[0]).getTarget().toString();
}
869917
public List<HostAddress> connectedHosts() {
    List<HostAddress> usedHost = new ArrayList<>();

    if (isMasterHostFail()) {
      Protocol masterProtocol = waitNewMasterProtocol.get();
      if (masterProtocol != null) {
        usedHost.add(masterProtocol.getHostAddress());
      }
    } else {
      usedHost.add(masterProtocol.getHostAddress());
    }

    if (isSecondaryHostFail()) {
      Protocol secondProtocol = waitNewSecondaryProtocol.get();
      if (secondProtocol != null) {
        usedHost.add(secondProtocol.getHostAddress());
      }
    } else {
      usedHost.add(secondaryProtocol.getHostAddress());
    }

    return usedHost;
  }
1124541
static InetAddress[] getGlobalInterfaces() throws SocketException {
        List<InetAddress> list = new ArrayList<InetAddress> ();
        for (NetworkInterface intf : getInterfaces()) {
            if (intf.isUp()) {
                for (InetAddress address : Collections.list(intf.getInetAddresses())) {
                    if (address.isLoopbackAddress() == false &&
                            address.isSiteLocalAddress() == false &&
                            address.isLinkLocalAddress() == false) {
                        list.add(address);
                    }
                }
            }
        }
        return list.toArray(new InetAddress[list.size()]);
    }
874139
protected String ipForwardedFor() {
        String h = header("X-Forwarded-For");
        return !StringUtil.blank(h) ? h : remoteIP();
    }
889179
def active_network_addresses(hypervisor):
    """"""
    active = []

    for network in hypervisor.listNetworks():
        try:
            xml = hypervisor.networkLookupByName(network).XMLDesc(0)
        except libvirt.libvirtError:  # network has been destroyed meanwhile
            continue
        else:
            ip_element = etree.fromstring(xml).find('.//ip')
            address = ip_element.get('address')
            netmask = ip_element.get('netmask')

            active.append(ipaddress.IPv4Network(u'/'.join((address, netmask)),
                                                strict=False))

    return active
783917
private Map<String, List<PortBinding>> portBindings() {
    final Map<String, List<PortBinding>> bindings = Maps.newHashMap();
    for (final Map.Entry<String, PortMapping> e : job.getPorts().entrySet()) {
      final PortMapping mapping = e.getValue();
      final Integer jobDefinedExtPort = mapping.getExternalPort();

      // If the job didn't specify an external port, use dynamically allocated ports
      final String externalPort = jobDefinedExtPort == null
                                  ? ports.get(e.getKey()).toString() : jobDefinedExtPort.toString();

      final PortBinding binding = PortBinding.of(mapping.getIp(), externalPort);
      final String entry = containerPort(mapping.getInternalPort(), mapping.getProtocol());
      bindings.put(entry, Collections.singletonList(binding));
    }
    return bindings;
  }
643676
private static List<String> resolveDeviceAddress(String deviceName,
           Enumeration<NetworkInterface> networkInterfaces, boolean allowIPv6) {
        List<String> resolvedAddresses = new ArrayList<>();
        if (deviceName.startsWith("[@") && deviceName.endsWith("]")) {
            deviceName = deviceName.substring(2, deviceName.lastIndexOf(']'));
        } else if (deviceName.startsWith("@")) {
            deviceName = deviceName.substring(1);
        }

        while (networkInterfaces.hasMoreElements()) {
            NetworkInterface networkInterface = networkInterfaces.nextElement();
            if (deviceName.toLowerCase().equals(networkInterface.getDisplayName().toLowerCase())) {
                Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
                while (inetAddresses.hasMoreElements()) {
                    InetAddress inetAddress = inetAddresses.nextElement();
                    if (inetAddress instanceof Inet6Address) {
                        if (!allowIPv6) {
                            continue;
                        }
                        String inet6HostAddress = inetAddress.getHostAddress();
                        resolvedAddresses.add(String.format("[%s]", inet6HostAddress));
                    } else {
                        resolvedAddresses.add(inetAddress.getHostAddress());
                    }
                }
            }

            // add an internal URI for any sub interfaces that match the hostAddress
            Enumeration<NetworkInterface> subInterfaces = networkInterface.getSubInterfaces();
            if (subInterfaces.hasMoreElements()) {
                resolvedAddresses.addAll(resolveDeviceAddress(deviceName, subInterfaces, allowIPv6));
            }
        }

        return resolvedAddresses;
    }
440357
public static Collection<InetAddress> getAllByName(String host, boolean allowIPv6) {
       Enumeration<NetworkInterface> networkInterfaces = cloneInterfaces(ResolutionUtils.networkInterfaces);
       List<String> resolvedAddresses = resolveDeviceAddress(host, networkInterfaces, allowIPv6);
       List<InetAddress> resolvedDeviceURIs = new ArrayList<>();
       List<InetAddress> resolvedHosts = resolvedDeviceURIs;
       for (String resolvedAddress : resolvedAddresses) {
           try {
               resolvedHosts.addAll(asList(InetAddress.getAllByName(resolvedAddress)));
           } catch (UnknownHostException e) {
               e.printStackTrace();
           }
       }
       return resolvedHosts;
   }
585918
private List<InetAddress> findAddresses() throws HarvestException {
		// Stores found addresses
		List<InetAddress> found = new ArrayList<InetAddress>(3);

		// Retrieve list of available network interfaces
		Enumeration<NetworkInterface> interfaces = getNetworkInterfaces();
		while (interfaces.hasMoreElements()) {
			NetworkInterface iface = interfaces.nextElement();

			// Evaluate network interface
			if (!useNetworkInterface(iface)) {
				continue;
			}

			// Retrieve list of available addresses from the network interface
			Enumeration<InetAddress> addresses = iface.getInetAddresses();

			while (addresses.hasMoreElements()) {
				InetAddress address = addresses.nextElement();

				// loopback addresses are discarded
				if (address.isLoopbackAddress()) {
					continue;
				}

				// Ignore IPv6 addresses for now
				if (address instanceof Inet4Address) {
					found.add(address);
				}
			}
		}
		return found;
	}
663875
public String getProxyRemoteAddr(String realIpHeader) {
        String ip = null;
        if (realIpHeader != null && realIpHeader.length() != 0) {
            ip = getHeaderString(realIpHeader);
        }
        if (StringUtils.isBlank(ip)) {
            ip = getHeaderString("X-Real-IP");
            if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
                ip = getHeaderString("X-Forwarded-For");
                if (StringUtils.isNotBlank(ip) && !"unknown".equalsIgnoreCase(ip)) {
                    ip = ip.split(",")[0];
                }
            }
            if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
                ip = getHeaderString("Proxy-Client-IP");
            }
            if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
                ip = getHeaderString("WL-Proxy-Client-IP");
            }
            if (StringUtils.isNotBlank(ip)) {
                ip = ip.toLowerCase();
            }
        }
        return ip;
    }
1131630
protected SynchronizedSet<ADDRESST> getAdresses() {
		final Object mutex = mutex();
		synchronized (mutex) {
			return Collections3.synchronizedSet(this.listeners.keySet(), mutex);
		}
	}
169073
protected List getConvertedFRP() {

        List theList = null;
        StringArrayWrapper saw = (StringArrayWrapper) properties.get(FORWARD_ROUTING_PATH);
        if (saw != null) {
            // This list is the forward routing path for the message.
            theList = saw.getMsgForwardRoutingPath();
        }
        return theList;
    }
911989
def GetForwardedIps(self, interface, interface_ip=None):
    
    try:
      ips = netifaces.ifaddresses(interface)
      ips = ips[netifaces.AF_INET]
    except (ValueError, IndexError):
      return []
    forwarded_ips = []
    for ip in ips:
      if ip['addr'] != interface_ip:
        full_addr = '%s/%d' % (ip['addr'], netaddr.IPAddress(ip['netmask']).netmask_bits())
        forwarded_ips.append(full_addr)
    return self.ParseForwardedIps(forwarded_ips)