Get address assigned by proxy to listen for incomming
connections, or the local machine address if doing direct
connection.
765482
public InetAddress getInetAddress(){
      if(localIP == null){
	 try{
	   localIP = InetAddress.getByName(localHost);
	 }catch(UnknownHostException e){
	   return null;
	 }
      }
      return localIP;
   }
1032031
private Proxy lookupProxy(String hostKey, String portKey, Proxy.Type type, int defaultPort) {
        String host = System.getProperty(hostKey);
        if (host == null || host.isEmpty()) {
            return null;
        }

        int port = getSystemPropertyInt(portKey, defaultPort);
        return new Proxy(type, InetSocketAddress.createUnresolved(host, port));
    }
941329
public static SocketAddress getDataPortSocketAddress(WorkerNetAddress netAddress,
      AlluxioConfiguration conf) {
    SocketAddress address;
    if (NettyUtils.isDomainSocketSupported(netAddress, conf)) {
      address = new DomainSocketAddress(netAddress.getDomainSocketPath());
    } else {
      String host = netAddress.getHost();
      int port = netAddress.getDataPort();
      address = new InetSocketAddress(host, port);
    }
    return address;
  }
629412
protected int getProxyPort(Dsn dsn) {
        return Util.parseInteger(Lookup.lookup(HTTP_PROXY_PORT_OPTION, dsn), HTTP_PROXY_PORT_DEFAULT);
    }
1098411
private static InetAddress getLocalAddress() throws UnknownHostException {
    try {
      return InetAddress.getLocalHost();  // first NIC
    } catch (Exception ignore) {
      return InetAddress.getByName(null);
    }
  }
1206003
public static String getLocalHostAddress() {
		try {
			InetAddress inet = InetAddress.getLocalHost();
			String hostAddress = inet.getHostAddress();
			return hostAddress;
		} catch (UnknownHostException e) {
			e.printStackTrace();
		}
		return null;
	}
23857
public JsDestinationAddress getProxyHandlerDestAddr() {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled()) {
            SibTr.entry(tc, "getProxyHandlerDestAddr");
            SibTr.exit(tc, "getProxyHandlerDestAddr", _proxyHandlerDestAddr);
        }
        return _proxyHandlerDestAddr;
    }
365262
def out_filter_get(self, address):
        

        func_name = 'neighbor.out_filter.get'
        param = {
            neighbors.IP_ADDRESS: address,
        }

        return call(func_name, **param)
1361187
@Override
  public InetAddress addressLocal()
  {
    SocketChannel s = _channel;
    
    if (s != null) {
      try {
        InetSocketAddress addr = (InetSocketAddress) s.getLocalAddress();
        
        return addr.getAddress();
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
    else {
      return null;
    }
  }
352192
def acquire_proxy(self, host, port, use_ssl=False, host_key=None,
                      tunnel=True):
        '''
        '''
        if self._host_filter and not self._host_filter.test(host):
            connection = yield from \
                super().acquire(host, port, use_ssl, host_key)

            return connection

        host_key = host_key or (host, port, use_ssl)
        proxy_host, proxy_port = self._proxy_address

        connection = yield from super().acquire(
            proxy_host, proxy_port, self._proxy_ssl, host_key=host_key
        )
        connection.proxied = True

        _logger.debug('Request for proxy connection.')

        if connection.closed():
            _logger.debug('Connecting to proxy.')
            yield from connection.connect()

            if tunnel:
                yield from self._establish_tunnel(connection, (host, port))

            if use_ssl:
                ssl_connection = yield from connection.start_tls(self._ssl_context)
                ssl_connection.proxied = True
                ssl_connection.tunneled = True

                self._connection_map[ssl_connection] = connection
                connection.wrapped_connection = ssl_connection

                return ssl_connection

        if connection.wrapped_connection:
            ssl_connection = connection.wrapped_connection
            self._connection_map[ssl_connection] = connection
            return ssl_connection
        else:
            return connection
813580
def get_iface_from_addr(addr):
    """"""
    for iface in netifaces.interfaces():
        addresses = netifaces.ifaddresses(iface)
        for inet_type in addresses:
            for _addr in addresses[inet_type]:
                _addr = _addr['addr']
                # link local
                ll_key = re.compile("(.+)%.*")
                raw = re.match(ll_key, _addr)
                if raw:
                    _addr = raw.group(1)

                if _addr == addr:
                    log("Address '%s' is configured on iface '%s'" %
                        (addr, iface))
                    return iface

    msg = "Unable to infer net iface on which '%s' is configured" % (addr)
    raise Exception(msg)
451342
def _set_proxy_headers(self, url, headers=None):
        
        headers_ = {'Accept': '*/*'}

        netloc = parse_url(url).netloc
        if netloc:
            headers_['Host'] = netloc

        if headers:
            headers_.update(headers)
        return headers_
1320912
function DetectLocalIPAddress(callback) {
            if (!DetectRTC.isWebRTCSupported) {
                return;
            }

            if (DetectRTC.isORTCSupported) {
                return;
            }

            getIPs(function(ip) {
                //local IPs
                if (ip.match(/^(192\.168\.|169\.254\.|10\.|172\.(1[6-9]|2\d|3[01]))/)) {
                    callback('Local: ' + ip);
                }

                //assume the rest are public IPs
                else {
                    callback('Public: ' + ip);
                }
            });
        }
408838
private boolean isLocalIpAddress(InetAddress addr) {
    if (addr.isAnyLocalAddress() || addr.isLoopbackAddress())
      return true;
    try {
      return NetworkInterface.getByInetAddress(addr) != null;
    } catch (SocketException e) {
      return false;
    }
  }
523596
def ping(self, remote):
        """"""
        try:
            self.proxies["%s-%s" % (self._interface_id, remote)].ping("%s-%s" % (self._interface_id, remote))
        except Exception as err:
            LOG.warning("ServerThread.ping: Exception: %s" % str(err))
465176
function getByAddr(addr) {
  var i;
  for(i = 0;i < this._conn.length;i++) {
    if(this._conn[i].client.addr === addr) {
      return this._conn[i];
    }
  }
  return null;
}
1264867
def get_service_address(
            self,
            block_identifier: BlockSpecification,
            index: int,
    ) -> Optional[AddressHex]:
        """"""
        try:
            result = self.proxy.contract.functions.service_addresses(index).call(
                block_identifier=block_identifier,
            )
        except web3.exceptions.BadFunctionCallOutput:
            result = None
        return result