/*
Environment.droid_use_private_net is used to instruct Droid to connect to
Inventory hosts by their private_ip, so long as the host does not already
have a droid_ip set.
973917
private function setDroidIpToPrivateIp($host)
    {
        if ($host->droid_ip
            || ! $this->getEnvironment()
            || $this->getEnvironment()->droid_use_private_net !== true
        ) {
            return;
        }

        if (! $host->private_ip) {
            throw new RuntimeException(
                sprintf(
                    'I am unable to add "%s" to the Inventory because it is missing the "private_ip" required by the environment setting "droid_use_private_net".',
                    $host->getName()
                )
            );
        }

        $host->droid_ip = $host->private_ip;
    }
25680
private boolean isPrivateHeaderTrusted(HeaderKeys key) {
        HttpServiceContextImpl hisc = getServiceContext();
        InetAddress remoteAddr = null;       
        String address = null;
        if (hisc != null && (remoteAddr = hisc.getRemoteAddr()) != null) {
            address = remoteAddr.getHostAddress();
        }

        boolean trusted = false;
        if (address != null) {
            trusted = HttpDispatcher.usePrivateHeaders(address, key.getName());
        }

        if (!trusted) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "isPrivateHeaderTrusted: " + key.getName() + " is not trusted for host " + address);
            }
            return false;
        }
        return true;
    }
76281
def reply_privately(*strings)
      private_source = source.clone
      private_source.private_message!
      @robot.send_messages(private_source, *strings)
    end
427255
public static String getPrivateInput(String prompt) {
        System.out.print(prompt);

        PrivateInputThread privateInput = new PrivateInputThread();
        BufferedReader in =
            new BufferedReader(new InputStreamReader(System.in));

        privateInput.start();
        try {
            return in.readLine();
        } catch(Exception e) {
            return null;
        } finally {
            privateInput.kill();
        }
    }
550758
public static Matcher isPrivate() {
    return new Matcher() {
      @Override public boolean matches(Node node, NodeMetadata metadata) {
        JSDocInfo jsDoc = NodeUtil.getBestJSDocInfo(node);
        if (jsDoc != null) {
          return jsDoc.getVisibility() == Visibility.PRIVATE;
        }
        return false;
      }
    };
  }
85457
@Override
  public InetSocketAddress ipRemote()
  {
    if (_ipRemote == null) {
      try {
        _ipRemote = InetSocketAddress.createUnresolved(getLocalHost(),
                                                      portLocal());
      } catch (Exception e) {
        log.log(Level.FINE, e.toString(), e);
      }
    }

    return _ipLocal;
  }
833102
public void setHostReservationIdSet(java.util.Collection<String> hostReservationIdSet) {
        if (hostReservationIdSet == null) {
            this.hostReservationIdSet = null;
            return;
        }

        this.hostReservationIdSet = new com.amazonaws.internal.SdkInternalList<String>(hostReservationIdSet);
    }
1186085
public OvhPrice hosting_privateDatabase_privateDatabaseName_GET(net.minidev.ovh.api.price.hosting.OvhPrivateDatabaseEnum privateDatabaseName) throws IOException {
		String qPath = "/price/hosting/privateDatabase/{privateDatabaseName}";
		StringBuilder sb = path(qPath, privateDatabaseName);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhPrice.class);
	}
86846
def _is_private_ip(ip):
	
	networks = [
		"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",
		"240.0.0.0/4",
		"255.255.255.255/32",
		"224.0.0.0/4",
	]

	for network in networks:
		try:
			ipaddr = struct.unpack(">I", socket.inet_aton(ip))[0]

			netaddr, bits = network.split("/")

			network_low = struct.unpack(">I", socket.inet_aton(netaddr))[0]
			network_high = network_low | 1 << (32 - int(bits)) - 1

			if ipaddr <= network_high and ipaddr >= network_low:
				return True
		except Exception:
			continue

	return False
694913
public static void setPrivateField(final Object obj, final String name, final Object value) {
        try {
            final Field field = obj.getClass().getDeclaredField(name);
            field.setAccessible(true);
            field.set(obj, value);
        } catch (final Exception ex) {
            throw new RuntimeException("Couldn't set field '" + name + "' in class '" + obj.getClass() + "'", ex);
        }
    }
1076999
private boolean isPrivateIp(String address) {
    InetAddress ip;
    try {
      ip = InetAddress.getByName(address);
    } catch (UnknownHostException e) {
      return false;
    }

    return ip.isLoopbackAddress() || ip.isLinkLocalAddress() || ip.isSiteLocalAddress();
  }
425362
@CheckForNull
    private static PrivateKeyInfo getPrivateKeyInfoOrNull(Object pemObject) throws NoSuchAlgorithmException {
        PrivateKeyInfo privateKeyInfo = null;
        if (pemObject instanceof PEMKeyPair) {
            PEMKeyPair pemKeyPair = (PEMKeyPair) pemObject;
            privateKeyInfo = pemKeyPair.getPrivateKeyInfo();
        } else if (pemObject instanceof PrivateKeyInfo) {
            privateKeyInfo = (PrivateKeyInfo) pemObject;
        } else if (pemObject instanceof ASN1ObjectIdentifier) {
            // no idea how it can be used
            final ASN1ObjectIdentifier asn1ObjectIdentifier = (ASN1ObjectIdentifier) pemObject;
            LOG.trace("Ignoring asn1ObjectIdentifier {}", asn1ObjectIdentifier);
        } else {
            LOG.warn("Unknown object '{}' from PEMParser", pemObject);
        }
        return privateKeyInfo;
    }
1056818
void resolveNetworkLocation(DatanodeInfo node) {
    List<String> names = new ArrayList<String>(1);
    if (dnsToSwitchMapping instanceof CachedDNSToSwitchMapping) {
      // get the node's IP address
      names.add(node.getHost());
    } else if (dnsToSwitchMapping instanceof StaticMapping) {
      names.add(toHostPort(node));
    } else {
      // get the node's host name
      String hostName = node.getHostName();
      int colon = hostName.indexOf(":");
      hostName = (colon == -1) ? hostName : hostName.substring(0, colon);
      names.add(hostName);
    }

    // resolve its network location
    List<String> rName = dnsToSwitchMapping.resolve(names);
    String networkLocation;
    if (rName == null) {
      LOG.error("The resolve call returned null! Using " +
        NetworkTopology.DEFAULT_RACK + " for host " + names);
      networkLocation = NetworkTopology.DEFAULT_RACK;
    } else {
      networkLocation = rName.get(0);
    }
    node.setNetworkLocation(networkLocation);
  }
221318
def is_private(ip):
    
    if matches_prefix(ip, '10.0.0.0/8'):
        return True
    if matches_prefix(ip, '172.16.0.0/12'):
        return True
    if matches_prefix(ip, '192.168.0.0/16'):
        return True
    return False
1236763
public java.util.List<InstancePrivateIpAddress> getPrivateIpAddresses() {
        if (privateIpAddresses == null) {
            privateIpAddresses = new com.amazonaws.internal.SdkInternalList<InstancePrivateIpAddress>();
        }
        return privateIpAddresses;
    }
50112
def private(self):
        
        req = self.request(self.mist_client.uri+'/keys/'+self.id+"/private")
        private = req.get().json()
        return private
104511
private void setOfflinePresences() {
        Presence packetUnavailable;
        outerloop: for (Jid user : presenceMap.keySet()) {
            Map<Resourcepart, Presence> resources = presenceMap.get(user);
            if (resources != null) {
                for (Resourcepart resource : resources.keySet()) {
                    packetUnavailable = new Presence(Presence.Type.unavailable);
                    EntityBareJid bareUserJid = user.asEntityBareJidIfPossible();
                    if (bareUserJid == null) {
                        LOGGER.warning("Can not transform user JID to bare JID: '" + user + "'");
                        continue;
                    }
                    packetUnavailable.setFrom(JidCreate.fullFrom(bareUserJid, resource));
                    try {
                        presencePacketListener.processStanza(packetUnavailable);
                    }
                    catch (NotConnectedException e) {
                        throw new IllegalStateException(
                                        "presencePacketListener should never throw a NotConnectedException when processStanza is called with a presence of type unavailable",
                                        e);
                    }
                    catch (InterruptedException e) {
                        break outerloop;
                    }
                }
            }
        }
    }