Return the public IP

@return {Promise}
769639
function getPublicIp() {
  return new Promise((resolve, reject) => {
    const options = {
      host: 'api.ipify.org',
      port: 80,
      path: '/',
    };
    http
      .get(options, res => {
        res.setEncoding('utf8');

        let body = '';
        res.on('data', chunk => {
          body += chunk;
        });

        res.on('end', () => {
          resolve(body);
        });
      })
      .on('error', err => {
        reject(err);
      });
  });
}
1317916
def get_public_agents_public_ip():
    """"""
    public_ip_list = []
    agents = get_public_agents()
    for agent in agents:
        status, public_ip = shakedown.run_command_on_agent(agent, "/opt/mesosphere/bin/detect_ip_public")
        public_ip_list.append(public_ip)

    return public_ip_list
989520
def get_ip(self, access='public', addr_family=None, strict=None):
        
        if addr_family not in ['IPv4', 'IPv6', None]:
            raise Exception("`addr_family` must be 'IPv4', 'IPv6' or None")

        if access not in ['private', 'public']:
            raise Exception("`access` must be 'public' or 'private'")

        if not hasattr(self, 'ip_addresses'):
            self.populate()

        # server can have several public or private IPs
        ip_addrs = [
            ip_addr for ip_addr in self.ip_addresses
            if ip_addr.access == access
        ]

        # prefer addr_family (or IPv4 if none given)
        preferred_family = addr_family if addr_family else 'IPv4'
        for ip_addr in ip_addrs:
            if ip_addr.family == preferred_family:
                return ip_addr.address

        # any IP (of the right access) will do if available and addr_family is None
        return ip_addrs[0].address if ip_addrs and not addr_family else None
1308003
public java.util.List<String> getPublicIps() {
        if (publicIps == null) {
            publicIps = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return publicIps;
    }
1221725
def get_private_ip(self, addr_family=None, *args, **kwargs):
        """"""
        return self.get_ip('private', addr_family, *args, **kwargs)
288521
function getDefaultRoute() {
  try {
    const fileContents = fs.readFileSync('/proc/net/route', 'utf8'); // eslint-disable-line no-sync
    const routes = fileContents.split('\n');
    for (const routeIdx in routes) {
      const fields = routes[routeIdx].trim().split('\t');
      if (fields[1] === '00000000') {
        const address = fields[2];
        // Convert to little endian by splitting every 2 digits and reversing that list
        const littleEndianAddress = address.match(/.{2}/g).reverse().join('');
        return intToIP(parseInt(littleEndianAddress, 16));
      }
    }
  } catch (e) {
    console.error('Could not get default route from /proc/net/route');
  }
  return null;
}
939803
function getMyIPs() {
	var ips = [];
	var ifs = os.networkInterfaces();
	for (var i in ifs) {
		for (var j in ifs[i]) {
			ips.push(ifs[i][j].address);
		}
	}
	return ips;
}
638904
protected function _getIp()
    {
        if (!$this->_request()) {
            return null;
        }
        $ip = $this->_request()->getClientIp();

        if ($this->_isValidIpv4($ip)) {
            return $ip;
        }

        // sometimes the value is multiple IPs separated by commas
        // (when there are multiple proxies, for example)
        $ips = explode(',', $ip, 2);
        $ip = trim($ips[0]);
        if ($this->_isValidIpv4($ip)) {
            return $ip;
        }

        return null;
    }
703067
public function get_callback_ip(){
        $access_token = $this->get_access_token();
        if (!$access_token){
            if ($this->business_interface) $this->business_interface->log('access_token is null');
            return null;
        }
        $url = self::API_CALLBACK_IP.'access_token='.$access_token;
        $result = $this->curl($url);
        return $result;
    }
1229567
public static function ip()
    {
        $whip = new Whip(
            Whip::CLOUDFLARE_HEADERS | Whip::REMOTE_ADDR,
            [
                Whip::CLOUDFLARE_HEADERS => self::CLOUDFLARE_IP,
            ]
        );

        return $whip->getValidIpAddress();
    }
1281116
def get_public(self):
        '''
        
        '''
        node = self.node.find('public')
        if node is not None:
            return Cpublic(node=node)
        else:
            return None
1096980
function() {
            var result = [];
            var hostname = spec.env.allPublicNodeIds.publicHostname ||
                    $._.__ca_getAppFullName__();
            var start = spec.env.allPublicNodeIds.publicRangeStart;
            var end = spec.env.allPublicNodeIds.publicRangeEnd;
            for (var i = start; i<= end; i++) {
                result.push(hostname + ':' + i);
            }
            return result;
        }
1252464
function() {
      var waitForLoaded = this.waitForLoaded;

      /** Index page. */
      app.get("/", function(request, response) {
        response.render("index", { hostname: hostname, port: port });
      });

      /** Send an open request, url is provided via query parameter url. */
      app.get("/open/*", function(request, response) {
        var url     = request.query.url,
            timeout = parseInt(request.query.timeout, 10) || TIMEOUT,
            id, entry, waitCallback;

        if (url) {
          if ( !connections) {
            console.log("   error -".red, "No browsers connected to open".yellow, url);
            return response.json({ success: false, error: "No browsers connected to open " + url });
          }

          // broadcast clear request for the first time
          if ( !clear && !Object.keys(urlData).length) {
            io.sockets.emit("clear");
            clear = true;
          }

          id    = crypto.createHash("md5").update(url).digest("hex");
          entry = { type: "open", success: true, id: id, url: url, timeout: timeout };
          io.sockets.emit("open", entry);
          urlData[id]  = { id: id, timeout: timeout, url: url, counter: connections };

          setTimeout(waitForLoaded(id, url, entry, response), WAIT_TIMEOUT);
          console.log("   info  -".cyan, "open".yellow, JSON.stringify(entry));
        } else {
          response.json({ success: false, error: "Invalid url" });
        }
      });

      /** Send a close request, url is provided via query parameter url. */
      app.get("/close/*", function(request, response) {
        var url = request.query.url, id, entry;

        if (url) {
          id    = crypto.createHash("md5").update(url).digest("hex");
          if (urlData[id]) {
            entry = { type: "close", id: id, url: url };
            io.sockets.emit("close", entry);
            console.log("   info  -".cyan, "close".yellow, JSON.stringify(entry));
            delete urlData[id];
          }
        } else {
          entry = {};
        }
        response.json(entry);
      });

      /** Send clear request to all browsers - close all open urls. */
      app.get("/clear/*", function(request, response) {
        io.sockets.emit("clear");
        console.log("   info  -".cyan, "clear".yellow);
        response.json({ success: true });
      });

      /** Return number of connections connecting to InsFrame */
      app.get("/connections", function(request, response) {
        response.json({ connections: connections });
      });
    }
405253
function getClientIP()
    {
        if (isset($this->server["HTTP_X_REAL_IP"]) and strcasecmp($this->server["HTTP_X_REAL_IP"], "unknown"))
        {
            return $this->server["HTTP_X_REAL_IP"];
        }
        if (isset($this->server["HTTP_CLIENT_IP"]) and strcasecmp($this->server["HTTP_CLIENT_IP"], "unknown"))
        {
            return $this->server["HTTP_CLIENT_IP"];
        }
        if (isset($this->server["HTTP_X_FORWARDED_FOR"]) and strcasecmp($this->server["HTTP_X_FORWARDED_FOR"], "unknown"))
        {
            return $this->server["HTTP_X_FORWARDED_FOR"];
        }
        if (isset($this->server["REMOTE_ADDR"]))
        {
            return $this->server["REMOTE_ADDR"];
        }
        return "";
    }
1240436
function getClient(credentials) {
	return new Promise((resolve, reject) => {
		const ftp = new Ftp(credentials);
		ftp.once('connect', () => {
			resolve(ftp);
		});
	});
}
1043800
public PublicKey
getPublicKey() throws DNSSEC.DNSSECException {
	if (publicKey != null)
		return publicKey;

	publicKey = DNSSEC.toPublicKey(this);
	return publicKey;
}
1238357
def get_ip(self, use_cached=True):
        """"""
        device_json = self.get_device_json(use_cached)
        return device_json.get("dpLastKnownIp")