getip {getip}R Documentation

ip_external

Description

Get your internal/local or external/public IP address. Currently only IPv4 addresses are supported.

Usage

getip(type = "local")

Arguments

type

One of "local" or "internal" for the local/internal IP, or one of "external" or "public" for the external/public IP.

Details

The internal/local IP lookup is done in-process, i.e., it does not call system() or the like.

For an external address, the function returns a lookup from one of several services, including Amazon AWS http://checkip.amazonaws.com/, httpbin http://httpbin.org/ip, ipify https://www.ipify.org/, and "My External IP address is ..." http://myexternalip.com/. You must be connected to the internet for this to work. Please note that pathological use could end up in your getting banned from these services, rendering the function useless. So don't call this function a billion times in a loop or something.

Value

Returns the requested IP address as a string.

Examples

library(getip)

# internal/local address
getip("local") # same as getip("internal")


# external/public
getip("public") # same as getip("external")



[Package getip version 0.1-4 Index]