command module
Version: v0.0.0-...-e37c360 Latest Latest

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

Go to latest
Published: Feb 22, 2022 License: GPL-3.0 Imports: 18 Imported by: 0



Menshen is a geolocation and gateway status service for LEAP VPN.

In chinese folk religions, `menshen <>`_
are guardians of doors and gates.

The geolocation service provides the remote IP (via X-Forwarded-For header, if
present), country code, city, and geographical coordinates. Information is
provided in plain text format, under ``/``, and in json, under ``/json``.

Menshen will also soon provide a "gateway health" service to help clients choose the
nearest, less congested gateway. This feature is currently undergoing heavy changes.


You can use ``geoipupdate`` to download MaxMind's City database::

    sudo apt install geoipupdate
    sudo cp /usr/share/doc/geoipupdate/examples/GeoIP.conf.default /etc/GeoIP.conf
    sudo sed -i 's/YOUR_ACCOUNT_ID_HERE/xxxxxx/' /etc/GeoIP.conf
    sudo sed -i 's/YOUR_LICENSE_KEY_HERE/xxxxxx/' /etc/GeoIP.conf
    sudo geoipupdate -v

Note: downloading the city database requires a free license key.


-api <tld>
	domain for the api. Default: It can be also set via MENSHEN_API env var.
-geodb <path>
	path to the GeoLite2-City database (default is "/var/lib/GeoIP/GeoLite2-City.mmdb")
-port <port>
	port where the service listens on (default is 9001)
	disable TLS on the service
-server_crt string
	path to the cert file for TLS
-server_key string
	path to the key file for TLS

Running Locally

There are several options for running menshen locally for development.

As a container from the registry::

    docker pull
    docker run -p 9001:9001 -v /var/lib/GeoIP/:/var/lib/GeoIP/ -e "MENSHEN_API="

As a container built locally::

    docker build -t menshen:latest .
    docker run -p 9001:9001 -v /var/lib/GeoIP/:/var/lib/GeoIP/ -e "MENSHEN_API=" menshen:latest

Run without container::

    go build
    ./menshen -notls -api

Fetch the results::

    curl -H "X-Forwarded-For:" localhost:9001/json

See Also



The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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