ipcheck

command module
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2018 License: GPL-3.0 Imports: 1 Imported by: 0

README

ipcheck

CircleCI Go Report Card codecov

A statically linked binary which, given a string decides if it is

  • malformed: not an IPv4 address
  • public: a routable IPv4 address
  • private: a non-routable IPv4 per rfc1918
  • loopback: rfc1700
  • linklocal: rfc3927
  • 6to4: rfc3068
  • documentation: rfc5737

See wikipedia for all the gory details.

Usage

In your dockerfile, add something like this:

FROM alpine

ENV IPCHECK_VERSION="0.1"

RUN apk --no-cache add curl  \
 && curl -o /usr/local/sbin/ipcheck https://github.com/ahammond/ipcheck/releases/download/v$IPCHECK_VERSION/ipcheck

CMD [ "entrypoint.sh" ]

And then in your entrypoint.sh or wherever you're doing validation:

IP_TYPE=$(ipcheck "$MY_IP")
if [ "public" != "$IP_TYPE" ]; then
  echo "I need a public IP, but $MY_IP is $IP_TYPE"
  exit 1
fi

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL