g3/g3iploc
Zhang Jingqiang 0f285d58f1
Some checks failed
CrossCompiling / Build (push) Has been cancelled
CrossCompiling / Build-1 (push) Has been cancelled
CrossCompiling / Build-2 (push) Has been cancelled
CrossCompiling / Build-3 (push) Has been cancelled
CrossCompiling / Build-4 (push) Has been cancelled
CrossCompiling / Build-5 (push) Has been cancelled
CrossCompiling / Build-6 (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeCoverage / lib unit test (push) Has been cancelled
CodeCoverage / g3mkcert test (push) Has been cancelled
CodeCoverage / g3keymess test (push) Has been cancelled
CodeCoverage / g3proxy test (push) Has been cancelled
CodeCoverage / g3bench test (push) Has been cancelled
CodeCoverage / g3statsd test (push) Has been cancelled
CodeQL Advanced / Analyze (java-kotlin) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
CodeQL Advanced / Analyze (rust) (push) Has been cancelled
CrossCompiling / Build-7 (push) Has been cancelled
CrossCompiling / Build-8 (push) Has been cancelled
CrossCompiling / Build-9 (push) Has been cancelled
Linux-CI / Build (push) Has been cancelled
Linux-CI / Build-1 (push) Has been cancelled
Linux-CI / Build-2 (push) Has been cancelled
Linux-CI / Build-3 (push) Has been cancelled
Linux-CI / Clippy (push) Has been cancelled
Linux-CI / Build vendored (push) Has been cancelled
Linux-CI / Build vendored-1 (push) Has been cancelled
Linux-CI / Build vendored-2 (push) Has been cancelled
Linux-CI / Build vendored-3 (push) Has been cancelled
Linux-CI / Build vendored-4 (push) Has been cancelled
Linux-CI / Build vendored-5 (push) Has been cancelled
Linux-CI / Build vendored-6 (push) Has been cancelled
Linux-CI / Build vendored-7 (push) Has been cancelled
Linux-CI / Build vendored-8 (push) Has been cancelled
Linux-CI / Build vendored-9 (push) Has been cancelled
Linux-CI / Build vendored-10 (push) Has been cancelled
Linux-CI / Build vendored-11 (push) Has been cancelled
Linux-CI / Build vendored-12 (push) Has been cancelled
Linux-CI / Build vendored-13 (push) Has been cancelled
Linux-CI / Build vendored-14 (push) Has been cancelled
Linux-CI / Build vendored-15 (push) Has been cancelled
Linux-CI / Build vendored-16 (push) Has been cancelled
Linux-CI / Build vendored-17 (push) Has been cancelled
Linux-CI / Build vendored-18 (push) Has been cancelled
Linux-CI / Build vendored-19 (push) Has been cancelled
Linux-CI / Build vendored-20 (push) Has been cancelled
Linux-CI / Build vendored-21 (push) Has been cancelled
Linux-CI / Build vendored-22 (push) Has been cancelled
Linux-CI / Build vendored-23 (push) Has been cancelled
Linux-CI / Build vendored-24 (push) Has been cancelled
Linux-CI / Build vendored-25 (push) Has been cancelled
Linux-CI / Build vendored-26 (push) Has been cancelled
Linux-CI / Build vendored-27 (push) Has been cancelled
Linux-CI / Build vendored-28 (push) Has been cancelled
Linux-CI / Build vendored-29 (push) Has been cancelled
Linux-CI / Build vendored-30 (push) Has been cancelled
Linux-CI / Build with OpenSSL Async Job (push) Has been cancelled
Linux-CI / Build with OpenSSL Async Job-1 (push) Has been cancelled
MacOS-CI / Build (push) Has been cancelled
MacOS-CI / Build vendored (push) Has been cancelled
MacOS-CI / Build vendored-1 (push) Has been cancelled
MacOS-CI / Build vendored-2 (push) Has been cancelled
MacOS-CI / Build vendored-3 (push) Has been cancelled
MacOS-CI / Build vendored-4 (push) Has been cancelled
MacOS-CI / Build vendored-5 (push) Has been cancelled
MacOS-CI / Build vendored-6 (push) Has been cancelled
MacOS-CI / Build vendored-7 (push) Has been cancelled
MacOS-CI / Build vendored-8 (push) Has been cancelled
MacOS-CI / Build vendored-9 (push) Has been cancelled
MacOS-CI / Build vendored-10 (push) Has been cancelled
MacOS-CI / Build vendored-11 (push) Has been cancelled
MacOS-CI / Build vendored-12 (push) Has been cancelled
MacOS-CI / Build vendored-13 (push) Has been cancelled
MacOS-CI / Build vendored-14 (push) Has been cancelled
MacOS-CI / Build vendored-15 (push) Has been cancelled
MacOS-CI / Build vendored-16 (push) Has been cancelled
MacOS-CI / Build vendored-17 (push) Has been cancelled
MacOS-CI / Build vendored-18 (push) Has been cancelled
MacOS-CI / Build vendored-19 (push) Has been cancelled
MacOS-CI / Build vendored-20 (push) Has been cancelled
MacOS-CI / Build vendored-21 (push) Has been cancelled
MacOS-CI / Build vendored-22 (push) Has been cancelled
MacOS-CI / Build vendored-23 (push) Has been cancelled
MacOS-CI / Build vendored-24 (push) Has been cancelled
StaticLinking / musl (push) Has been cancelled
StaticLinking / musl-1 (push) Has been cancelled
StaticLinking / msvc-vcpkg (push) Has been cancelled
StaticLinking / msvc-vendored (push) Has been cancelled
StaticLinking / msvc-vendored-1 (push) Has been cancelled
StaticLinking / msvc-vendored-2 (push) Has been cancelled
StaticLinking / msvc-vendored-3 (push) Has been cancelled
Windows-CI / Build (push) Has been cancelled
Windows-CI / Build vendored (push) Has been cancelled
Windows-CI / Build vendored-1 (push) Has been cancelled
Windows-CI / Build vendored-2 (push) Has been cancelled
Windows-CI / Build vendored-3 (push) Has been cancelled
Windows-CI / Build vendored-4 (push) Has been cancelled
Windows-CI / Build vendored-5 (push) Has been cancelled
Windows-CI / Build vendored-6 (push) Has been cancelled
Windows-CI / Build vendored-7 (push) Has been cancelled
Windows-CI / Build vendored-8 (push) Has been cancelled
Windows-CI / Build vendored-9 (push) Has been cancelled
Windows-CI / Build vendored-10 (push) Has been cancelled
Windows-CI / Build vendored-11 (push) Has been cancelled
Windows-CI / Build vendored-12 (push) Has been cancelled
Windows-CI / Build vendored-13 (push) Has been cancelled
Windows-CI / Build vendored-14 (push) Has been cancelled
Windows-CI / Build vendored-15 (push) Has been cancelled
Windows-CI / Build vendored-16 (push) Has been cancelled
Windows-CI / Build vendored-17 (push) Has been cancelled
Windows-CI / Build vendored-18 (push) Has been cancelled
Windows-CI / Build vendored-19 (push) Has been cancelled
Windows-CI / Build vendored-20 (push) Has been cancelled
Windows-CI / Build vendored-21 (push) Has been cancelled
Windows-CI / Build vendored-22 (push) Has been cancelled
Windows-CI / Build vendored-23 (push) Has been cancelled
bump MSRV to 1.90
2025-12-26 22:53:05 +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 MSRV to 1.90 2025-12-26 22:53:05 +08:00
g3iploc.spec update rpm build file 2025-08-17 23:39:22 +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.