xtonousou / ipify.sh

Unofficial client library for ipify: a simple IP address API

Home Page:https://www.ipify.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ipify.sh

FOSSA Status

Unofficial client library for ipify: A Simple IP Address API.

Features

  • Testing Internet Connection first
  • Return the Public IP address in the following formats
    • text
      • e.g. 98.207.254.136
    • json
      • e.g. {"ip":"98.207.254.136"}
    • jsonp
      • e.g. callback({"ip":"98.207.254.136"});
    • jsonp
      • e.g. getip({"ip":"98.207.254.136"});
  • Exit Codes
    • 0
      • Successful Operation
    • 1
      • Invalid or Missing Arguments
    • 2
      • Connection Issues

Getting Started

$ curl -O https://raw.githubusercontent.com/xtonousou/ipify.sh/master/ipify.sh
$ source ipify.sh
$ get_ip -h

or

$ source <(curl -s https://raw.githubusercontent.com/xtonousou/ipify.sh/master/ipify.sh) && get_ip -h

Usage

Proper Usage

COMMAND             TYPE  OUTPUT
get_ip -h, --help   text  This help message
get_ip -t, --text   text  98.207.254.136
get_ip -j, --json   json  {"ip":"98.207.254.136"}
get_ip -J, --jsonp  jsonp callback({"ip":"98.207.254.136"});
get_ip -g, --get-ip jsonp getip({"ip":"98.207.254.136"});

Importing Library

You can source the script to anywhere and use its function to get the Public IP. Put the following line at the beginning of your script. Of course replace the path with the right one first.

source /path/to/ipify.sh

or

. /path/to/ipify.sh

More Like This

  • ship - A simple, handy network addressing multitool with plenty of features

License

MIT © Sotirios M. Roussis (xtonousou)

FOSSA Status

About

Unofficial client library for ipify: a simple IP address API

https://www.ipify.org/

License:MIT License


Languages

Language:Shell 100.0%