Code Monkey home page Code Monkey logo

ip-utils's Introduction

ip-utils

About

This repository contains some utilities for determining (public) IP addresses and updating a dynamic DNS entry.

Dependencies

The scripts in this repository require accounts at the following excellent and free services:

  • ipinfo - "IP Address API and Data Solutions"
  • DuckDNS - "Free dynamic DNS hosted on Amazon VPC"

You will require accounts at these services to use this script. Each of these services provide a user token, which are required by the scripts:

  • $IPINFO_TOKEN
  • $DUCKDNS_TOKEN

These tokens must be set in the calling environment, otherwise the scripts will execute and record an error.

get_ip_info works best with the json parser jq installed. Both scripts use curl.

Usage

get_ip_info

Script contains two functions:

  • get_host_ip() - seeks to retrieve the current host IP from ifconfig
  • get_external_ip() - uses ipinfo.io to retrieve the public IP

The script can be sourced, or called directly from the command line, in which case both get_host_ip() and get_external_ip() are called. Executed in either fashion, get_external_ip() requires token $IPINFO_TOKEN to function.

update_dns

Script contains a single function, updatedns() to set the specified domain to the given IP address:

updatedns <domain-name> <ip-address>

Returns 0 upon update success (OK 200 from DuckDNS) and 1 in all other cases.

The script can be sourced, or called directly from the command line. Executed in either fashion, updatedns() requires token $DUCKDNS_TOKEN to function.

Support and feature requests

Ping me if you have any questions, suggestions or requests for new features.

License

Distributed under the MIT License, see LICENSE file in the repository root for more information.

ip-utils's People

Contributors

jjo93sa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.