g3/g3iploc
Zhang Jingqiang 145fe58db4
Some checks are pending
Linux-CI / Clippy (push) Waiting to run
Linux-CI / Build vendored (push) Waiting to run
Linux-CI / Build (push) Waiting to run
Linux-CI / Build with OpenSSL Async Job (push) Waiting to run
CodeCoverage / lib unit test (push) Waiting to run
CodeCoverage / g3mkcert test (push) Waiting to run
CodeCoverage / g3keymess test (push) Waiting to run
CodeCoverage / g3proxy test (push) Waiting to run
CodeCoverage / g3bench test (push) Waiting to run
CodeCoverage / g3statsd test (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (java-kotlin) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
CodeQL Advanced / Analyze (rust) (push) Waiting to run
CrossCompiling / Build (push) Waiting to run
MacOS-CI / Build (push) Waiting to run
MacOS-CI / Build vendored (push) Waiting to run
StaticLinking / musl (push) Waiting to run
StaticLinking / msvc (push) Waiting to run
Windows-CI / Build (push) Waiting to run
Windows-CI / Build vendored (push) Waiting to run
fix deb build for tarball
2025-08-10 23:41:31 +08:00
..
debian fix deb build for tarball 2025-08-10 23:41:31 +08:00
docker switch to use dynamic linking for alpine docker image 2024-08-22 19:11:39 +08:00
examples/basic g3proxy: fix iploc service integration 2024-06-19 17:32:56 +08:00
service update systemd service files 2025-05-13 21:25:13 +08:00
src g3iploc: bump msrv to 1.88 2025-08-10 08:56:57 +08:00
build.rs switch to use SPDX license identifier and update copyright year 2025-05-16 18:30:35 +08:00
Cargo.toml bump version for binaries and use workspace level MSRV 2025-08-10 08:56:57 +08:00
CHANGELOG bump version for binaries and use workspace level MSRV 2025-08-10 08:56:57 +08:00
g3iploc.spec g3iploc version 0.3.0 2025-08-09 16:54:48 +08:00
README.md update doc and pkg 2025-06-25 15:46:24 +08:00

g3iploc

g3iploc is an IP address location lookup service to be used with g3proxy to enable GeoIP support. The protocol is defined here.

g3iploc is designed to run with g3proxy on the same host. It is recommended to write you own implementation if you need to serve a cluster of g3proxy instances.

How to build

To build debug binaries:

cargo build -p g3iploc -p g3iploc-db

To build release binaries:

cargo build --profile release-lto -p g3iploc -p g3iploc-db

How to run

Example

See this simple basic.

You can run cargo run --bin g3iploc -- -c g3iploc/examples/basic/ -G port2888 -vv to start it.

Set UDP listen address

The default UDP listen address is 127.0.0.1:2888, which is also the same default connect address in g3proxy.

There are two ways to change the UDP listen port:

  • Via command line options

    You can set -G port or --group-name port to change the UDP listen port, the final listen address will be [::]:.

    You can set the systemd instance name to port, so when you run systemctl start g3iploc@port<port>, it will listen to the correct port automatically.

  • Via environment variables

    You can use the environment variable UDP_LISTEN_ADDR to change the UDP listen address. You can add this environment variable to /etc/g3iploc/<instance name>/env file to use this with systemd managed g3iploc service.

Hot Restart

It is not possible to do hot restart gracefully without using two ports.

If g3iploc is running at port 3000, and g3proxy is also using port 3000, the steps are:

  1. start a new g3iploc service at port 3001 with the new config
  2. reload g3proxy to use g3iploc port 3001
  3. stop g3iploc running at port 3000

GeoIP Database

g3iploc can only load databases in G3 native CSV format, which can be generated by using geoip-dump scripts.

The following vendors are supported:

Command line options

Just run g3iploc -h to see all supported command line options.