myip

command module
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: LGPL-2.1 Imports: 9 Imported by: 0

README

myip

This is an HTTP endpoint which returns the requester's own IP address in JSON format.

Config

In addition to the CLI flags described below, the following envvars can configure the endpoint:

ENVVAR Default Description
LOG_LEVEL INFO how verbosely to log, one of: DEBUG, INFO, WARN, ERROR
LISTEN_ADDR 0.0.0.0:8000 the host and port number to receive request on
TRUST_XFF false trust X-Forwarded-For headers in the request (only enable if running behind a proxy)
TRUSTED_PROXIES `` comma-separated list of IP blocks (in CIDR-notation) that upstream proxy request come from
TRUSTED_HEADER `` the name of a trusted header which provides the client IP address directly

Usage

This is the output of the program when it is invoked with the -h argument:

NAME:
   myip - HTTP endpoint that reports the user's IP address back to the user

USAGE:
   myip [global options]

VERSION:
   dev

GLOBAL OPTIONS:
   --loglevel string        how verbosely to log, one of: DEBUG, INFO, WARN, ERROR (default: "INFO") [$LOG_LEVEL]
   --listenaddr string      IP address and port to listen on (default: "0.0.0.0:8000") [$LISTEN_ADDR]
   --trustedheader string   the name of a trusted header which provides the client IP address directly [$TRUSTED_HEADER]
   --trustxff               trust X-Forwarded-For headers in the request (only enable if running behind a proxy) (default: false) [$TRUST_XFF]
   --trustedproxies string  comma-separated list of IP blocks (in CIDR-notation) that upstream proxy request come from [$TRUSTED_PROXIES]
   --help, -h               show help
   --version, -v            print the version

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
clientip remote-client-ip determination which handles complex issues around the X-Forwarded-For header, as described here: https://adam-p.ca/blog/2022/03/x-forwarded-for/
clientip remote-client-ip determination which handles complex issues around the X-Forwarded-For header, as described here: https://adam-p.ca/blog/2022/03/x-forwarded-for/

Jump to

Keyboard shortcuts

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