├── .cargo └── config.toml ├── .cirrus.yml ├── .clippy.toml ├── .dockerignore ├── .github ├── dependabot.yml └── workflows │ ├── cargo.yml │ ├── codecov.yml │ ├── cross.yml │ ├── linux.yml │ ├── macos.yml │ ├── sphinx.yml │ ├── static.yml │ └── windows.yml ├── .gitignore ├── .readthedocs.yaml ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Cargo.lock ├── Cargo.toml ├── G3-FEISHU-USER-GROUP.png ├── LICENSE ├── LICENSE-FOREIGN ├── NOTICE ├── README.ja_JP.md ├── README.md ├── README.zh_CN.md ├── ansible ├── benchmark.yml ├── border-classic.yml ├── border-concise.yml ├── border-stream.yml ├── border-transit.yml ├── g3proxy.yml ├── roles │ ├── benchmark │ │ ├── defaults │ │ │ └── main.yml │ │ ├── tasks │ │ │ ├── config-all.yml │ │ │ ├── config-server.yml │ │ │ ├── deploy.yml │ │ │ └── main.yml │ │ └── templates │ │ │ ├── escaper.d │ │ │ └── default.yaml │ │ │ ├── main.yaml │ │ │ ├── resolver.d │ │ │ └── default.yaml │ │ │ └── server.d │ │ │ ├── http_proxy.yaml │ │ │ ├── https_proxy.yaml │ │ │ ├── tcp_stream.yaml │ │ │ └── tls_stream.yaml │ ├── border-classic │ │ ├── tasks │ │ │ ├── config-all.yml │ │ │ ├── config-escaper.yml │ │ │ ├── config-resolver.yml │ │ │ ├── config-server.yml │ │ │ ├── config-user.yml │ │ │ ├── deploy.yml │ │ │ └── main.yml │ │ └── templates │ │ │ ├── escaper.d │ │ │ ├── default.yaml │ │ │ └── select.yaml │ │ │ ├── main.yaml │ │ │ ├── resolver.d │ │ │ ├── direct.yaml │ │ │ └── failover.yaml │ │ │ ├── server.d │ │ │ ├── http.yaml │ │ │ └── socks.yaml │ │ │ └── user-group.d │ │ │ └── default.yaml │ ├── border-concise │ │ ├── tasks │ │ │ ├── config-all.yml │ │ │ ├── config-resolver.yml │ │ │ ├── config-server.yml │ │ │ ├── config-user.yml │ │ │ ├── deploy.yml │ │ │ └── main.yml │ │ └── templates │ │ │ ├── escaper.d │ │ │ └── default.yaml │ │ │ ├── main.yaml │ │ │ ├── resolver.d │ │ │ ├── direct.yaml │ │ │ └── failover.yaml │ │ │ ├── server.d │ │ │ ├── http.yaml │ │ │ └── socks.yaml │ │ │ └── user-group.d │ │ │ └── default.yaml │ ├── border-stream │ │ ├── tasks │ │ │ ├── config-all.yml │ │ │ ├── config-resolver.yml │ │ │ ├── config-server-per-net.yml │ │ │ ├── config-server.yml │ │ │ ├── deploy.yml │ │ │ └── main.yml │ │ └── templates │ │ │ ├── escaper.d │ │ │ └── default.yaml │ │ │ ├── main.yaml │ │ │ ├── resolver.d │ │ │ ├── direct.yaml │ │ │ └── failover.yaml │ │ │ └── server.d │ │ │ └── tcp.yaml │ ├── border-transit │ │ ├── tasks │ │ │ ├── config-all.yml │ │ │ ├── config-resolver.yml │ │ │ ├── config-server.yml │ │ │ ├── config-user.yml │ │ │ ├── deploy.yml │ │ │ └── main.yml │ │ └── templates │ │ │ ├── escaper.d │ │ │ └── default.yaml │ │ │ ├── main.yaml │ │ │ ├── resolver.d │ │ │ ├── direct.yaml │ │ │ └── failover.yaml │ │ │ ├── server.d │ │ │ └── http.yaml │ │ │ └── user-group.d │ │ │ └── default.yaml │ ├── common │ │ └── tasks │ │ │ └── merge_ipmap.yml │ ├── g3proxy │ │ ├── defaults │ │ │ └── main.yml │ │ ├── handlers │ │ │ ├── main.yml │ │ │ ├── reload-escaper.yml │ │ │ ├── reload-resolver.yml │ │ │ ├── reload-server.yml │ │ │ ├── reload-user-group.yml │ │ │ └── restart.yml │ │ ├── tasks │ │ │ ├── clean-config.yml │ │ │ ├── config-escaper-cert.yml │ │ │ ├── config-escaper.yml │ │ │ ├── config-log.yml │ │ │ ├── config-resolver.yml │ │ │ ├── config-server-cert.yml │ │ │ ├── config-server.yml │ │ │ ├── config-user-group.yml │ │ │ ├── deploy-apt.yml │ │ │ ├── deploy-dnf.yml │ │ │ ├── deploy-yum.yml │ │ │ ├── deploy.yml │ │ │ ├── main.yml │ │ │ ├── query-installed-version.yml │ │ │ ├── query-running-version.yml │ │ │ ├── restart.yml │ │ │ ├── start-after-deploy.yml │ │ │ ├── stop.yml │ │ │ ├── uninstall-daemon.yml │ │ │ └── upgrade.yml │ │ └── templates │ │ │ ├── logrotate.d │ │ │ └── g3proxy │ │ │ └── rsyslog.d │ │ │ ├── g3proxy-rfc3164.conf │ │ │ └── g3proxy-rfc5424.conf │ ├── rsyslog │ │ ├── handlers │ │ │ └── main.yml │ │ └── tasks │ │ │ ├── main.yml │ │ │ ├── upgrade-apt.yml │ │ │ ├── upgrade-dnf.yml │ │ │ ├── upgrade-yum.yml │ │ │ └── upgrade.yml │ └── sysconf-idc │ │ ├── handlers │ │ └── main.yml │ │ ├── tasks │ │ ├── config-apt.yml │ │ ├── config-repo.yml │ │ ├── config-sysctl.yml │ │ ├── config-yum.yml │ │ └── main.yml │ │ └── templates │ │ ├── apt.conf.d │ │ └── 80g3-proxy │ │ └── sysctl.d │ │ └── 99-proxy.conf ├── rsyslog.yml └── sysconf-idc.yml ├── deny.toml ├── doc ├── code_coverage.md ├── dev-setup.md ├── easy-proxy.md ├── long-term_support.md ├── openssl-variants.md ├── packaging.md ├── standards.md └── static-linking.md ├── g3bench ├── CHANGELOG ├── Cargo.toml ├── README.md ├── build.rs ├── debian │ ├── changelog │ ├── compat │ ├── control │ ├── g3bench.docs │ ├── g3bench.install │ ├── rules │ └── source │ │ └── format ├── g3bench.spec └── src │ ├── build.rs │ ├── lib.rs │ ├── main.rs │ ├── module │ ├── http │ │ ├── mod.rs │ │ └── stats │ │ │ ├── histogram.rs │ │ │ ├── mod.rs │ │ │ └── runtime.rs │ ├── mod.rs │ ├── openssl.rs │ ├── proxy_protocol.rs │ ├── rustls.rs │ ├── socket.rs │ └── ssl │ │ ├── mod.rs │ │ └── stats │ │ ├── histogram.rs │ │ ├── mod.rs │ │ ├── runtime.rs │ │ └── session.rs │ ├── opts.rs │ ├── progress.rs │ ├── target │ ├── dns │ │ ├── mod.rs │ │ ├── opts.rs │ │ ├── stats │ │ │ ├── histogram.rs │ │ │ ├── mod.rs │ │ │ └── runtime.rs │ │ └── task.rs │ ├── h1 │ │ ├── connection.rs │ │ ├── mod.rs │ │ ├── opts.rs │ │ └── task.rs │ ├── h2 │ │ ├── mod.rs │ │ ├── opts.rs │ │ ├── pool.rs │ │ └── task.rs │ ├── h3 │ │ ├── mod.rs │ │ ├── opts.rs │ │ ├── pool.rs │ │ └── task.rs │ ├── keyless │ │ ├── cloudflare │ │ │ ├── connection │ │ │ │ ├── mod.rs │ │ │ │ ├── multiplex.rs │ │ │ │ └── simplex.rs │ │ │ ├── message │ │ │ │ ├── mod.rs │ │ │ │ ├── request.rs │ │ │ │ └── response.rs │ │ │ ├── mod.rs │ │ │ ├── opts.rs │ │ │ ├── pool.rs │ │ │ ├── stats │ │ │ │ ├── histogram.rs │ │ │ │ ├── mod.rs │ │ │ │ └── runtime.rs │ │ │ └── task.rs │ │ ├── mod.rs │ │ ├── openssl │ │ │ ├── async_job.rs │ │ │ ├── mod.rs │ │ │ ├── opts.rs │ │ │ ├── stats │ │ │ │ ├── histogram.rs │ │ │ │ ├── mod.rs │ │ │ │ └── runtime.rs │ │ │ └── task.rs │ │ └── opts.rs │ ├── mod.rs │ ├── no_h3.rs │ ├── openssl │ │ ├── mod.rs │ │ ├── opts.rs │ │ └── task.rs │ ├── rustls │ │ ├── mod.rs │ │ ├── opts.rs │ │ └── task.rs │ └── stats.rs │ └── worker.rs ├── g3fcgen ├── CHANGELOG ├── Cargo.toml ├── README.md ├── build.rs ├── debian │ ├── changelog │ ├── compat │ ├── control │ ├── g3fcgen.docs │ ├── g3fcgen.install │ ├── g3fcgen@.service │ ├── rules │ └── source │ │ └── format ├── docker │ ├── alpine.Dockerfile │ └── debian.Dockerfile ├── examples │ └── simple │ │ ├── G3-test.crt │ │ ├── G3-test.key │ │ └── g3fcgen.yaml ├── g3fcgen.spec ├── service │ └── g3fcgen@.service └── src │ ├── backend │ ├── mod.rs │ └── stats.rs │ ├── build.rs │ ├── config │ ├── backend.rs │ └── mod.rs │ ├── frontend │ ├── mod.rs │ ├── stats.rs │ └── udp_dgram.rs │ ├── lib.rs │ ├── main.rs │ ├── opts.rs │ └── stat │ ├── metrics │ ├── backend.rs │ ├── frontend.rs │ └── mod.rs │ └── mod.rs ├── g3iploc ├── CHANGELOG ├── Cargo.toml ├── README.md ├── build.rs ├── debian │ ├── changelog │ ├── compat │ ├── control │ ├── g3iploc.docs │ ├── g3iploc.install │ ├── g3iploc@.service │ ├── rules │ └── source │ │ └── format ├── docker │ ├── alpine.Dockerfile │ └── debian.Dockerfile ├── examples │ └── basic │ │ ├── g3iploc.yaml │ │ └── simple.csv ├── g3iploc.spec ├── service │ └── g3iploc@.service ├── src │ ├── build.rs │ ├── config │ │ ├── geoip.rs │ │ └── mod.rs │ ├── frontend │ │ ├── mod.rs │ │ ├── stats.rs │ │ └── udp_dgram.rs │ ├── lib.rs │ ├── main.rs │ ├── opts.rs │ └── stat │ │ ├── metrics │ │ ├── frontend.rs │ │ └── mod.rs │ │ └── mod.rs └── utils │ └── db │ ├── Cargo.toml │ └── src │ └── main.rs ├── g3keymess ├── CHANGELOG ├── Cargo.toml ├── IntelQatEngine.md ├── README.md ├── build.rs ├── debian │ ├── changelog │ ├── compat │ ├── control │ ├── g3keymess.docs │ ├── g3keymess.install │ ├── g3keymess@.service │ ├── rules │ └── source │ │ └── format ├── examples │ ├── simple_openssl │ │ ├── g3keymess.yaml │ │ └── keys │ │ │ └── rsa.key │ └── worker_openssl │ │ ├── g3keymess.yaml │ │ └── keys │ │ └── rsa.key ├── g3keymess.spec ├── proto │ ├── .gitignore │ ├── Cargo.toml │ ├── build.rs │ ├── schema │ │ ├── proc.capnp │ │ ├── server.capnp │ │ └── types.capnp │ └── src │ │ └── lib.rs ├── service │ ├── g3keymess@.latest.service │ ├── g3keymess@.pre240.service │ └── generate_systemd.sh ├── src │ ├── backend │ │ ├── async_job.rs │ │ ├── dispatch.rs │ │ ├── mod.rs │ │ └── simple.rs │ ├── build.rs │ ├── config │ │ ├── backend │ │ │ ├── async_job.rs │ │ │ └── mod.rs │ │ ├── log.rs │ │ ├── mod.rs │ │ ├── server │ │ │ ├── mod.rs │ │ │ └── registry.rs │ │ └── store │ │ │ ├── local.rs │ │ │ ├── mod.rs │ │ │ ├── redis.rs │ │ │ └── registry.rs │ ├── control │ │ ├── bridge │ │ │ └── mod.rs │ │ ├── capnp │ │ │ ├── common.rs │ │ │ ├── mod.rs │ │ │ ├── proc.rs │ │ │ └── server.rs │ │ ├── local │ │ │ └── mod.rs │ │ ├── mod.rs │ │ ├── quit.rs │ │ └── upgrade.rs │ ├── lib.rs │ ├── log │ │ ├── mod.rs │ │ ├── request.rs │ │ ├── shared.rs │ │ └── task.rs │ ├── main.rs │ ├── opts.rs │ ├── protocol │ │ ├── mod.rs │ │ ├── request.rs │ │ └── response.rs │ ├── register.rs │ ├── serve │ │ ├── error.rs │ │ ├── mod.rs │ │ ├── ops.rs │ │ ├── registry.rs │ │ ├── runtime.rs │ │ ├── server.rs │ │ ├── stats.rs │ │ └── task │ │ │ ├── mod.rs │ │ │ ├── multiplex.rs │ │ │ └── simplex.rs │ ├── signal.rs │ ├── stat │ │ ├── metrics │ │ │ ├── mod.rs │ │ │ └── server.rs │ │ └── mod.rs │ └── store │ │ ├── mod.rs │ │ ├── ops.rs │ │ └── registry.rs └── utils │ └── ctl │ ├── Cargo.toml │ └── src │ ├── common.rs │ ├── local.rs │ ├── main.rs │ ├── proc.rs │ └── server.rs ├── g3mkcert ├── CHANGELOG ├── Cargo.toml ├── README.md ├── build.rs ├── debian │ ├── changelog │ ├── compat │ ├── control │ ├── g3mkcert.docs │ ├── g3mkcert.install │ ├── rules │ └── source │ │ └── format ├── g3mkcert.spec └── src │ ├── build.rs │ └── main.rs ├── g3proxy ├── CHANGELOG ├── Cargo.toml ├── README.md ├── UserGuide.en_US.md ├── UserGuide.zh_CN.md ├── build.rs ├── ci │ ├── Java+HttpComponents-Client-4.5 │ │ ├── AuthNoCachePostFile.java │ │ └── README.md │ ├── Java+OkHttp-3 │ │ ├── AuthPostFile.java │ │ ├── README.md │ │ ├── SimpleAuthenticator.java │ │ └── SimpleProxySelector.java │ ├── python3+curl │ │ ├── test_ftp_over_http.py │ │ ├── test_httpbin.py │ │ └── test_httpbin_h2.py │ └── python3+requests │ │ └── test_httpbin.py ├── debian │ ├── changelog │ ├── compat │ ├── control │ ├── g3proxy.docs │ ├── g3proxy.install │ ├── g3proxy@.service │ ├── rules │ └── source │ │ └── format ├── docker │ ├── alpine.Dockerfile │ ├── debian.Dockerfile │ └── lua.alpine.Dockerfile ├── examples │ ├── README.md │ ├── benchmark │ │ ├── main.yaml │ │ └── server.d │ │ │ ├── bench.example.net-ec256.crt │ │ │ ├── bench.example.net-ec256.key │ │ │ ├── http_proxy.yaml │ │ │ ├── https_proxy.yaml │ │ │ ├── rootCA.pem │ │ │ ├── tcp_stream.yaml │ │ │ └── tls_stream.yaml │ ├── chain_proxy_protocol │ │ └── g3proxy.yaml │ ├── chain_socks_proxy │ │ └── g3proxy.yaml │ ├── chain_squid │ │ └── g3proxy.yaml │ ├── dynamic_from_redis │ │ └── g3proxy.yaml │ ├── escaper_proxy_http │ │ └── g3proxy.yaml │ ├── escaper_proxy_socks5 │ │ └── g3proxy.yaml │ ├── escaper_route_geoip │ │ └── g3proxy.yaml │ ├── escaper_route_resolved │ │ └── g3proxy.yaml │ ├── escaper_route_select │ │ └── g3proxy.yaml │ ├── escaper_upstream │ │ └── g3proxy.yaml │ ├── hybrid_direct_float │ │ ├── escaper.d │ │ │ └── default.yaml │ │ ├── g3proxy.yaml │ │ ├── resolver.d │ │ │ └── default.yaml │ │ └── server.d │ │ │ └── default.yaml │ ├── hybrid_https_proxy │ │ ├── escaper.d │ │ │ └── default.yaml │ │ ├── g3proxy.yaml │ │ ├── resolver.d │ │ │ └── default.yaml │ │ └── server.d │ │ │ ├── cert.pem │ │ │ ├── key.pem │ │ │ └── test-tls.yaml │ ├── hybrid_intelli_proxy │ │ ├── escaper.d │ │ │ └── default.yaml │ │ ├── g3proxy.yaml │ │ ├── resolver.d │ │ │ └── default.yaml │ │ └── server.d │ │ │ └── test.yaml │ ├── hybrid_socks_proxy │ │ ├── escaper.d │ │ │ └── default.yaml │ │ ├── g3proxy.yaml │ │ ├── resolver.d │ │ │ └── default.yaml │ │ └── server.d │ │ │ └── test.yaml │ ├── hybrid_tcp_stream │ │ ├── escaper.d │ │ │ └── default.yaml │ │ ├── g3proxy.yaml │ │ ├── resolver.d │ │ │ └── default.yaml │ │ └── server.d │ │ │ └── test.yaml │ ├── hybrid_user_auth │ │ ├── escaper.d │ │ │ └── default.yaml │ │ ├── g3proxy.yaml │ │ ├── resolver.d │ │ │ └── default.yaml │ │ ├── server.d │ │ │ ├── extra_port.yaml │ │ │ ├── http.yaml │ │ │ ├── intelli.yaml │ │ │ └── socks.yaml │ │ └── user-group.d │ │ │ ├── default.yaml │ │ │ └── dynamic_users.json │ ├── inspect_http_proxy │ │ └── g3proxy.yaml │ ├── inspect_tcp_stream │ │ └── g3proxy.yaml │ ├── resolver_fail_over │ │ ├── g3proxy.yaml │ │ └── resolver.d │ │ │ ├── alidns.yaml │ │ │ ├── dnspod.yaml │ │ │ └── virtual.yaml │ ├── simple_http_gateway │ │ └── g3proxy.yaml │ ├── simple_http_proxy │ │ ├── cert.pem │ │ ├── g3proxy.yaml │ │ └── key.pem │ ├── simple_sni_proxy │ │ └── g3proxy.yaml │ ├── simple_socks_proxy │ │ └── g3proxy.yaml │ ├── simple_tcp_stream │ │ └── g3proxy.yaml │ ├── simple_to_statsd │ │ ├── dynamic_users.json │ │ └── g3proxy.yaml │ └── simple_user_auth │ │ ├── dynamic_users.json │ │ └── g3proxy.yaml ├── g3proxy.spec ├── proto │ ├── .gitignore │ ├── Cargo.toml │ ├── build.rs │ ├── schema │ │ ├── escaper.capnp │ │ ├── proc.capnp │ │ ├── resolver.capnp │ │ ├── server.capnp │ │ ├── types.capnp │ │ └── user_group.capnp │ └── src │ │ └── lib.rs ├── service │ ├── g3proxy@.latest.service │ ├── g3proxy@.pre240.service │ └── generate_systemd.sh ├── src │ ├── audit │ │ ├── detour │ │ │ ├── connect.rs │ │ │ ├── mod.rs │ │ │ ├── pool.rs │ │ │ └── stream.rs │ │ ├── handle.rs │ │ ├── mod.rs │ │ ├── ops.rs │ │ └── registry.rs │ ├── auth │ │ ├── mod.rs │ │ ├── ops.rs │ │ ├── registry.rs │ │ ├── site.rs │ │ ├── source │ │ │ ├── lua.rs │ │ │ ├── mod.rs │ │ │ └── python.rs │ │ ├── stats │ │ │ ├── duration.rs │ │ │ ├── forbidden.rs │ │ │ ├── mod.rs │ │ │ ├── request.rs │ │ │ ├── site.rs │ │ │ └── traffic.rs │ │ └── user.rs │ ├── build.rs │ ├── config │ │ ├── audit │ │ │ ├── auditor.rs │ │ │ ├── detour.rs │ │ │ ├── mod.rs │ │ │ └── registry.rs │ │ ├── auth │ │ │ ├── audit │ │ │ │ ├── json.rs │ │ │ │ ├── mod.rs │ │ │ │ └── yaml.rs │ │ │ ├── group.rs │ │ │ ├── mod.rs │ │ │ ├── registry.rs │ │ │ ├── site │ │ │ │ ├── json.rs │ │ │ │ ├── mod.rs │ │ │ │ └── yaml.rs │ │ │ ├── source │ │ │ │ ├── cache.rs │ │ │ │ ├── file.rs │ │ │ │ ├── lua.rs │ │ │ │ ├── mod.rs │ │ │ │ └── python.rs │ │ │ ├── token │ │ │ │ ├── json.rs │ │ │ │ ├── mod.rs │ │ │ │ └── yaml.rs │ │ │ └── user │ │ │ │ ├── json.rs │ │ │ │ ├── mod.rs │ │ │ │ └── yaml.rs │ │ ├── escaper │ │ │ ├── comply_audit.rs │ │ │ ├── direct_fixed.rs │ │ │ ├── direct_float │ │ │ │ ├── bind │ │ │ │ │ ├── json.rs │ │ │ │ │ └── mod.rs │ │ │ │ └── mod.rs │ │ │ ├── divert_tcp.rs │ │ │ ├── dummy_deny.rs │ │ │ ├── mod.rs │ │ │ ├── proxy_float │ │ │ │ ├── mod.rs │ │ │ │ └── source │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── redis.rs │ │ │ ├── proxy_http.rs │ │ │ ├── proxy_https.rs │ │ │ ├── proxy_socks5.rs │ │ │ ├── proxy_socks5s.rs │ │ │ ├── registry.rs │ │ │ ├── route_client.rs │ │ │ ├── route_failover.rs │ │ │ ├── route_geoip.rs │ │ │ ├── route_mapping.rs │ │ │ ├── route_query.rs │ │ │ ├── route_resolved.rs │ │ │ ├── route_select.rs │ │ │ ├── route_upstream │ │ │ │ ├── child_match.rs │ │ │ │ ├── exact_match.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── regex_match.rs │ │ │ │ ├── subnet_match.rs │ │ │ │ └── suffix_match.rs │ │ │ ├── trick_float.rs │ │ │ └── verify.rs │ │ ├── graphviz.rs │ │ ├── log.rs │ │ ├── mermaid.rs │ │ ├── mod.rs │ │ ├── plantuml.rs │ │ ├── resolver │ │ │ ├── c_ares.rs │ │ │ ├── deny_all.rs │ │ │ ├── fail_over.rs │ │ │ ├── hickory.rs │ │ │ ├── mod.rs │ │ │ └── registry.rs │ │ └── server │ │ │ ├── dummy_close.rs │ │ │ ├── http_proxy.rs │ │ │ ├── http_rproxy │ │ │ ├── host.rs │ │ │ └── mod.rs │ │ │ ├── intelli_proxy.rs │ │ │ ├── mod.rs │ │ │ ├── native_tls_port.rs │ │ │ ├── plain_quic_port.rs │ │ │ ├── plain_tcp_port.rs │ │ │ ├── plain_tls_port.rs │ │ │ ├── registry.rs │ │ │ ├── sni_proxy │ │ │ ├── host.rs │ │ │ └── mod.rs │ │ │ ├── socks_proxy.rs │ │ │ ├── tcp_stream.rs │ │ │ ├── tcp_tproxy.rs │ │ │ └── tls_stream.rs │ ├── control │ │ ├── bridge │ │ │ ├── mod.rs │ │ │ └── reload.rs │ │ ├── capnp │ │ │ ├── common.rs │ │ │ ├── escaper.rs │ │ │ ├── mod.rs │ │ │ ├── proc.rs │ │ │ ├── resolver.rs │ │ │ ├── server.rs │ │ │ └── user_group.rs │ │ ├── local │ │ │ └── mod.rs │ │ ├── mod.rs │ │ ├── quit.rs │ │ └── upgrade.rs │ ├── escape │ │ ├── comply_audit │ │ │ └── mod.rs │ │ ├── direct_fixed │ │ │ ├── ftp_connect │ │ │ │ └── mod.rs │ │ │ ├── http_forward │ │ │ │ ├── mod.rs │ │ │ │ ├── reader.rs │ │ │ │ └── writer.rs │ │ │ ├── mod.rs │ │ │ ├── stats.rs │ │ │ ├── tcp_connect │ │ │ │ └── mod.rs │ │ │ ├── tls_connect │ │ │ │ └── mod.rs │ │ │ ├── udp_connect │ │ │ │ ├── mod.rs │ │ │ │ ├── recv.rs │ │ │ │ └── send.rs │ │ │ └── udp_relay │ │ │ │ ├── mod.rs │ │ │ │ ├── recv.rs │ │ │ │ └── send.rs │ │ ├── direct_float │ │ │ ├── ftp_connect │ │ │ │ └── mod.rs │ │ │ ├── http_forward │ │ │ │ ├── mod.rs │ │ │ │ └── writer.rs │ │ │ ├── mod.rs │ │ │ ├── publish.rs │ │ │ ├── tcp_connect │ │ │ │ └── mod.rs │ │ │ ├── tls_connect │ │ │ │ └── mod.rs │ │ │ ├── udp_connect │ │ │ │ └── mod.rs │ │ │ └── udp_relay │ │ │ │ └── mod.rs │ │ ├── divert_tcp │ │ │ ├── http_forward │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ ├── stats.rs │ │ │ ├── tcp_connect │ │ │ │ └── mod.rs │ │ │ └── tls_connect │ │ │ │ └── mod.rs │ │ ├── dummy_deny │ │ │ ├── mod.rs │ │ │ └── stats.rs │ │ ├── egress_path.rs │ │ ├── mod.rs │ │ ├── ops.rs │ │ ├── proxy_float │ │ │ ├── mod.rs │ │ │ ├── peer │ │ │ │ ├── http │ │ │ │ │ ├── http_connect │ │ │ │ │ │ └── mod.rs │ │ │ │ │ ├── http_forward │ │ │ │ │ │ ├── mod.rs │ │ │ │ │ │ ├── reader.rs │ │ │ │ │ │ └── writer.rs │ │ │ │ │ └── mod.rs │ │ │ │ ├── https │ │ │ │ │ ├── http_connect │ │ │ │ │ │ └── mod.rs │ │ │ │ │ ├── http_forward │ │ │ │ │ │ ├── mod.rs │ │ │ │ │ │ └── writer.rs │ │ │ │ │ └── mod.rs │ │ │ │ ├── json.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── socks5 │ │ │ │ │ ├── http_forward │ │ │ │ │ │ ├── mod.rs │ │ │ │ │ │ └── writer.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── socks5_connect │ │ │ │ │ │ └── mod.rs │ │ │ │ │ ├── udp_connect │ │ │ │ │ │ └── mod.rs │ │ │ │ │ └── udp_relay │ │ │ │ │ │ └── mod.rs │ │ │ │ └── socks5s │ │ │ │ │ ├── http_forward │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── writer.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── socks5_connect │ │ │ │ │ └── mod.rs │ │ │ │ │ ├── udp_connect │ │ │ │ │ └── mod.rs │ │ │ │ │ └── udp_relay │ │ │ │ │ └── mod.rs │ │ │ ├── source │ │ │ │ ├── file.rs │ │ │ │ ├── mod.rs │ │ │ │ └── redis.rs │ │ │ ├── stats.rs │ │ │ ├── tcp_connect.rs │ │ │ ├── tls_connect.rs │ │ │ └── tls_handshake.rs │ │ ├── proxy_http │ │ │ ├── http_connect │ │ │ │ └── mod.rs │ │ │ ├── http_forward │ │ │ │ ├── mod.rs │ │ │ │ ├── reader.rs │ │ │ │ └── writer.rs │ │ │ ├── mod.rs │ │ │ ├── stats.rs │ │ │ └── tcp_connect │ │ │ │ └── mod.rs │ │ ├── proxy_https │ │ │ ├── http_connect │ │ │ │ └── mod.rs │ │ │ ├── http_forward │ │ │ │ ├── mod.rs │ │ │ │ ├── reader.rs │ │ │ │ └── writer.rs │ │ │ ├── mod.rs │ │ │ ├── stats.rs │ │ │ ├── tcp_connect │ │ │ │ └── mod.rs │ │ │ └── tls_handshake │ │ │ │ └── mod.rs │ │ ├── proxy_socks5 │ │ │ ├── http_forward │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ ├── socks5_connect │ │ │ │ └── mod.rs │ │ │ ├── stats.rs │ │ │ ├── tcp_connect │ │ │ │ └── mod.rs │ │ │ ├── udp_connect │ │ │ │ ├── mod.rs │ │ │ │ ├── recv.rs │ │ │ │ └── send.rs │ │ │ └── udp_relay │ │ │ │ ├── mod.rs │ │ │ │ ├── recv.rs │ │ │ │ └── send.rs │ │ ├── proxy_socks5s │ │ │ ├── http_forward │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ ├── socks5_connect │ │ │ │ └── mod.rs │ │ │ ├── stats.rs │ │ │ ├── tcp_connect │ │ │ │ └── mod.rs │ │ │ ├── tls_handshake │ │ │ │ └── mod.rs │ │ │ ├── udp_connect │ │ │ │ └── mod.rs │ │ │ └── udp_relay │ │ │ │ └── mod.rs │ │ ├── registry.rs │ │ ├── route_client │ │ │ └── mod.rs │ │ ├── route_failover │ │ │ ├── ftp_connect.rs │ │ │ ├── mod.rs │ │ │ ├── tcp_connect.rs │ │ │ ├── tls_connect.rs │ │ │ ├── udp_connect.rs │ │ │ └── udp_relay.rs │ │ ├── route_geoip │ │ │ └── mod.rs │ │ ├── route_mapping │ │ │ └── mod.rs │ │ ├── route_query │ │ │ ├── cache.rs │ │ │ ├── mod.rs │ │ │ └── query.rs │ │ ├── route_resolved │ │ │ └── mod.rs │ │ ├── route_select │ │ │ └── mod.rs │ │ ├── route_upstream │ │ │ └── mod.rs │ │ ├── stats.rs │ │ └── trick_float │ │ │ └── mod.rs │ ├── inspect │ │ ├── error.rs │ │ ├── http │ │ │ ├── mod.rs │ │ │ ├── v1 │ │ │ │ ├── connect │ │ │ │ │ └── mod.rs │ │ │ │ ├── error.rs │ │ │ │ ├── forward │ │ │ │ │ ├── adaptation.rs │ │ │ │ │ └── mod.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── pipeline │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── request.rs │ │ │ │ │ └── stats.rs │ │ │ │ └── upgrade │ │ │ │ │ └── mod.rs │ │ │ └── v2 │ │ │ │ ├── connect │ │ │ │ ├── extended.rs │ │ │ │ ├── mod.rs │ │ │ │ └── standard.rs │ │ │ │ ├── error.rs │ │ │ │ ├── forward │ │ │ │ └── mod.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── ping.rs │ │ │ │ ├── stats.rs │ │ │ │ └── stream.rs │ │ ├── imap │ │ │ ├── authenticated.rs │ │ │ ├── capability.rs │ │ │ ├── ext.rs │ │ │ ├── forward.rs │ │ │ ├── greeting.rs │ │ │ ├── logout.rs │ │ │ ├── mod.rs │ │ │ └── not_authenticated.rs │ │ ├── mod.rs │ │ ├── smtp │ │ │ ├── ending.rs │ │ │ ├── ext.rs │ │ │ ├── forward.rs │ │ │ ├── greeting.rs │ │ │ ├── initiation.rs │ │ │ ├── mod.rs │ │ │ └── transaction │ │ │ │ └── mod.rs │ │ ├── start_tls │ │ │ └── mod.rs │ │ ├── stream │ │ │ ├── mod.rs │ │ │ └── object.rs │ │ ├── tls │ │ │ ├── error.rs │ │ │ ├── mod.rs │ │ │ ├── modern.rs │ │ │ └── tlcp.rs │ │ └── websocket │ │ │ ├── close.rs │ │ │ ├── h1.rs │ │ │ ├── h2.rs │ │ │ └── mod.rs │ ├── lib.rs │ ├── log │ │ ├── audit.rs │ │ ├── escape │ │ │ ├── mod.rs │ │ │ ├── tcp_connect.rs │ │ │ ├── tls_handshake.rs │ │ │ └── udp_sendto.rs │ │ ├── inspect │ │ │ ├── mod.rs │ │ │ └── stream.rs │ │ ├── intercept │ │ │ └── mod.rs │ │ ├── mod.rs │ │ ├── resolve.rs │ │ ├── shared.rs │ │ └── task │ │ │ ├── ftp_over_http.rs │ │ │ ├── http_forward.rs │ │ │ ├── mod.rs │ │ │ ├── tcp_connect.rs │ │ │ ├── udp_associate.rs │ │ │ └── udp_connect.rs │ ├── main.rs │ ├── module │ │ ├── ftp_over_http │ │ │ ├── connection.rs │ │ │ ├── context │ │ │ │ ├── deny.rs │ │ │ │ ├── direct.rs │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ ├── path.rs │ │ │ ├── stats.rs │ │ │ └── task.rs │ │ ├── http_forward │ │ │ ├── connection │ │ │ │ ├── eof_poller.rs │ │ │ │ ├── mod.rs │ │ │ │ └── writer.rs │ │ │ ├── context │ │ │ │ ├── direct.rs │ │ │ │ ├── failover.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── proxy.rs │ │ │ │ └── route.rs │ │ │ ├── mod.rs │ │ │ ├── response │ │ │ │ ├── client.rs │ │ │ │ └── mod.rs │ │ │ ├── stats.rs │ │ │ └── task.rs │ │ ├── http_header │ │ │ ├── custom.rs │ │ │ ├── mod.rs │ │ │ └── standard.rs │ │ ├── mod.rs │ │ ├── tcp_connect │ │ │ ├── error.rs │ │ │ ├── mod.rs │ │ │ ├── stats.rs │ │ │ └── task.rs │ │ ├── udp_connect │ │ │ ├── error.rs │ │ │ ├── mod.rs │ │ │ ├── stats.rs │ │ │ └── task.rs │ │ └── udp_relay │ │ │ ├── error.rs │ │ │ ├── mod.rs │ │ │ ├── stats.rs │ │ │ └── task.rs │ ├── opts.rs │ ├── resolve │ │ ├── c_ares │ │ │ ├── handle.rs │ │ │ ├── mod.rs │ │ │ └── resolver.rs │ │ ├── deny_all.rs │ │ ├── fail_over │ │ │ ├── handle.rs │ │ │ ├── mod.rs │ │ │ └── resolver.rs │ │ ├── handle.rs │ │ ├── hickory │ │ │ ├── handle.rs │ │ │ ├── mod.rs │ │ │ └── resolver.rs │ │ ├── mod.rs │ │ ├── ops.rs │ │ ├── registry.rs │ │ └── stats.rs │ ├── serve │ │ ├── dummy_close │ │ │ ├── mod.rs │ │ │ └── server.rs │ │ ├── error.rs │ │ ├── http_proxy │ │ │ ├── mod.rs │ │ │ ├── server.rs │ │ │ ├── stats.rs │ │ │ └── task │ │ │ │ ├── common.rs │ │ │ │ ├── connect │ │ │ │ ├── mod.rs │ │ │ │ ├── stats │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── wrapper.rs │ │ │ │ └── task.rs │ │ │ │ ├── forward │ │ │ │ ├── mod.rs │ │ │ │ ├── stats │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── task.rs │ │ │ │ │ └── wrapper.rs │ │ │ │ └── task.rs │ │ │ │ ├── ftp │ │ │ │ ├── connection.rs │ │ │ │ ├── list.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── stats │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── task.rs │ │ │ │ │ └── wrapper.rs │ │ │ │ └── task.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── pipeline │ │ │ │ ├── mod.rs │ │ │ │ ├── reader.rs │ │ │ │ ├── stats.rs │ │ │ │ └── writer.rs │ │ │ │ ├── protocol │ │ │ │ ├── mod.rs │ │ │ │ └── request.rs │ │ │ │ └── untrusted │ │ │ │ ├── mod.rs │ │ │ │ ├── stats.rs │ │ │ │ └── task.rs │ │ ├── http_rproxy │ │ │ ├── host.rs │ │ │ ├── mod.rs │ │ │ ├── server.rs │ │ │ ├── stats.rs │ │ │ └── task │ │ │ │ ├── common.rs │ │ │ │ ├── forward │ │ │ │ ├── mod.rs │ │ │ │ ├── stats │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── task.rs │ │ │ │ │ └── wrapper.rs │ │ │ │ └── task.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── pipeline │ │ │ │ ├── mod.rs │ │ │ │ ├── reader.rs │ │ │ │ ├── stats.rs │ │ │ │ └── writer.rs │ │ │ │ ├── protocol │ │ │ │ ├── mod.rs │ │ │ │ └── request.rs │ │ │ │ └── untrusted │ │ │ │ ├── mod.rs │ │ │ │ ├── stats.rs │ │ │ │ └── task.rs │ │ ├── idle_check.rs │ │ ├── intelli_proxy │ │ │ ├── detection.rs │ │ │ ├── mod.rs │ │ │ └── server.rs │ │ ├── mod.rs │ │ ├── native_tls_port │ │ │ └── mod.rs │ │ ├── ops.rs │ │ ├── plain_quic_port │ │ │ └── mod.rs │ │ ├── plain_tcp_port │ │ │ └── mod.rs │ │ ├── plain_tls_port │ │ │ └── mod.rs │ │ ├── registry.rs │ │ ├── sni_proxy │ │ │ ├── mod.rs │ │ │ ├── server.rs │ │ │ └── task │ │ │ │ ├── accept │ │ │ │ ├── http.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── stats.rs │ │ │ │ ├── task.rs │ │ │ │ └── tls.rs │ │ │ │ ├── common.rs │ │ │ │ ├── mod.rs │ │ │ │ └── relay │ │ │ │ ├── mod.rs │ │ │ │ └── task.rs │ │ ├── socks_proxy │ │ │ ├── mod.rs │ │ │ ├── server.rs │ │ │ ├── stats.rs │ │ │ └── task │ │ │ │ ├── common.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── negotiation │ │ │ │ ├── mod.rs │ │ │ │ ├── stats.rs │ │ │ │ └── task.rs │ │ │ │ ├── tcp_connect │ │ │ │ ├── mod.rs │ │ │ │ ├── stats │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── wrapper.rs │ │ │ │ └── task.rs │ │ │ │ ├── udp_associate │ │ │ │ ├── mod.rs │ │ │ │ ├── recv.rs │ │ │ │ ├── send.rs │ │ │ │ ├── stats │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── task.rs │ │ │ │ │ └── wrapper.rs │ │ │ │ └── task.rs │ │ │ │ └── udp_connect │ │ │ │ ├── mod.rs │ │ │ │ ├── recv.rs │ │ │ │ ├── send.rs │ │ │ │ ├── stats │ │ │ │ ├── mod.rs │ │ │ │ ├── task.rs │ │ │ │ └── wrapper.rs │ │ │ │ └── task.rs │ │ ├── stats.rs │ │ ├── task.rs │ │ ├── tcp_stream │ │ │ ├── common.rs │ │ │ ├── mod.rs │ │ │ ├── server.rs │ │ │ ├── stats │ │ │ │ ├── mod.rs │ │ │ │ ├── server.rs │ │ │ │ └── wrapper.rs │ │ │ └── task.rs │ │ ├── tcp_tproxy │ │ │ ├── common.rs │ │ │ ├── mod.rs │ │ │ ├── server.rs │ │ │ └── task.rs │ │ └── tls_stream │ │ │ ├── common.rs │ │ │ ├── mod.rs │ │ │ ├── server.rs │ │ │ └── task.rs │ ├── signal.rs │ └── stat │ │ ├── metrics │ │ ├── escaper.rs │ │ ├── mod.rs │ │ ├── resolver.rs │ │ ├── server.rs │ │ ├── user.rs │ │ └── user_site.rs │ │ ├── mod.rs │ │ └── types │ │ ├── connection.rs │ │ ├── mod.rs │ │ ├── request.rs │ │ ├── traffic.rs │ │ └── untrusted.rs └── utils │ ├── ctl │ ├── Cargo.toml │ └── src │ │ ├── common.rs │ │ ├── escaper.rs │ │ ├── main.rs │ │ ├── proc.rs │ │ ├── resolver.rs │ │ ├── server.rs │ │ └── user_group.rs │ ├── ftp │ ├── Cargo.toml │ └── src │ │ ├── cmd_del.rs │ │ ├── cmd_get.rs │ │ ├── cmd_list.rs │ │ ├── cmd_put.rs │ │ ├── cmd_rmd.rs │ │ ├── cmd_stat.rs │ │ ├── connection.rs │ │ ├── logger.rs │ │ └── main.rs │ └── lua │ ├── Cargo.toml │ └── src │ ├── cmd_path.rs │ ├── cmd_run.rs │ ├── cmd_version.rs │ └── main.rs ├── g3statsd ├── CHANGELOG ├── Cargo.toml ├── README.md ├── build.rs ├── debian │ ├── changelog │ ├── compat │ ├── control │ ├── g3statsd.docs │ ├── g3statsd.install │ ├── g3statsd@.service │ ├── rules │ └── source │ │ └── format ├── examples │ ├── export_console │ │ └── g3statsd.yaml │ ├── export_graphite │ │ └── g3statsd.yaml │ ├── export_influxdb │ │ └── g3statsd.yaml │ └── export_opentsdb │ │ └── g3statsd.yaml ├── g3statsd.spec ├── proto │ ├── .gitignore │ ├── Cargo.toml │ ├── build.rs │ ├── schema │ │ ├── proc.capnp │ │ └── types.capnp │ └── src │ │ └── lib.rs ├── service │ ├── g3statsd@.latest.service │ ├── g3statsd@.pre240.service │ └── generate_systemd.sh ├── src │ ├── build.rs │ ├── collect │ │ ├── aggregate │ │ │ ├── collect.rs │ │ │ ├── mod.rs │ │ │ └── store │ │ │ │ ├── global.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── timer.rs │ │ │ │ └── worker.rs │ │ ├── discard │ │ │ └── mod.rs │ │ ├── internal │ │ │ ├── collect.rs │ │ │ ├── emit.rs │ │ │ └── mod.rs │ │ ├── mod.rs │ │ ├── ops.rs │ │ ├── registry.rs │ │ └── regulate │ │ │ └── mod.rs │ ├── config │ │ ├── collector │ │ │ ├── aggregate.rs │ │ │ ├── discard.rs │ │ │ ├── internal.rs │ │ │ ├── mod.rs │ │ │ ├── registry.rs │ │ │ └── regulate.rs │ │ ├── exporter │ │ │ ├── console.rs │ │ │ ├── discard.rs │ │ │ ├── graphite.rs │ │ │ ├── influxdb │ │ │ │ ├── mod.rs │ │ │ │ ├── precision.rs │ │ │ │ ├── v2.rs │ │ │ │ └── v3.rs │ │ │ ├── memory.rs │ │ │ ├── mod.rs │ │ │ ├── opentsdb.rs │ │ │ └── registry.rs │ │ ├── importer │ │ │ ├── dummy.rs │ │ │ ├── mod.rs │ │ │ ├── registry.rs │ │ │ └── statsd │ │ │ │ ├── mod.rs │ │ │ │ ├── udp.rs │ │ │ │ └── unix.rs │ │ └── mod.rs │ ├── control │ │ ├── bridge │ │ │ ├── mod.rs │ │ │ └── reload.rs │ │ ├── capnp │ │ │ ├── common.rs │ │ │ ├── mod.rs │ │ │ └── proc.rs │ │ ├── local.rs │ │ ├── mod.rs │ │ ├── quit.rs │ │ └── upgrade.rs │ ├── export │ │ ├── console │ │ │ └── mod.rs │ │ ├── discard │ │ │ └── mod.rs │ │ ├── graphite │ │ │ ├── format.rs │ │ │ └── mod.rs │ │ ├── influxdb │ │ │ ├── export.rs │ │ │ ├── mod.rs │ │ │ ├── v2.rs │ │ │ └── v3.rs │ │ ├── memory │ │ │ ├── mod.rs │ │ │ └── store.rs │ │ ├── mod.rs │ │ ├── opentsdb │ │ │ ├── export.rs │ │ │ └── mod.rs │ │ ├── ops.rs │ │ └── registry.rs │ ├── import │ │ ├── dummy │ │ │ └── mod.rs │ │ ├── mod.rs │ │ ├── ops.rs │ │ ├── registry.rs │ │ └── statsd │ │ │ ├── mod.rs │ │ │ ├── parser │ │ │ ├── line.rs │ │ │ └── mod.rs │ │ │ ├── udp.rs │ │ │ └── unix.rs │ ├── lib.rs │ ├── main.rs │ ├── opts.rs │ ├── runtime │ │ ├── export │ │ │ ├── aggregate │ │ │ │ └── mod.rs │ │ │ ├── http │ │ │ │ ├── config.rs │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ └── stream │ │ │ │ ├── config.rs │ │ │ │ └── mod.rs │ │ └── mod.rs │ ├── signal.rs │ └── types │ │ ├── mod.rs │ │ ├── name.rs │ │ └── value.rs └── utils │ └── ctl │ ├── Cargo.toml │ └── src │ ├── common.rs │ ├── main.rs │ └── proc.rs ├── g3tiles ├── CHANGELOG ├── Cargo.toml ├── build.rs ├── debian │ ├── changelog │ ├── compat │ ├── control │ ├── g3tiles.docs │ ├── g3tiles.install │ ├── g3tiles@.service │ ├── rules │ └── source │ │ └── format ├── examples │ ├── benchmark │ │ ├── main.yaml │ │ └── server.d │ │ │ ├── bench.example.net-ec256.crt │ │ │ ├── bench.example.net-ec256.key │ │ │ ├── openssl.yaml │ │ │ ├── rootCA.pem │ │ │ └── rustls.yaml │ ├── keyless_to_quic │ │ ├── G3-test.crt │ │ ├── G3-test.key │ │ ├── keyless.example.net-client.crt │ │ ├── keyless.example.net-client.key │ │ ├── keyless.example.net.crt │ │ ├── keyless.example.net.key │ │ └── main.yaml │ └── keyless_to_tcp │ │ └── main.yaml ├── g3tiles.spec ├── proto │ ├── .gitignore │ ├── Cargo.toml │ ├── build.rs │ ├── schema │ │ ├── backend.capnp │ │ ├── proc.capnp │ │ ├── server.capnp │ │ └── types.capnp │ └── src │ │ └── lib.rs ├── service │ ├── g3tiles@.latest.service │ ├── g3tiles@.pre240.service │ └── generate_systemd.sh ├── src │ ├── backend │ │ ├── dummy_close.rs │ │ ├── keyless_quic │ │ │ ├── connect.rs │ │ │ └── mod.rs │ │ ├── keyless_tcp │ │ │ ├── connect.rs │ │ │ └── mod.rs │ │ ├── mod.rs │ │ ├── ops.rs │ │ ├── registry.rs │ │ └── stream_tcp.rs │ ├── build.rs │ ├── config │ │ ├── backend │ │ │ ├── dummy_close.rs │ │ │ ├── keyless_quic.rs │ │ │ ├── keyless_tcp.rs │ │ │ ├── mod.rs │ │ │ ├── registry.rs │ │ │ └── stream_tcp.rs │ │ ├── discover │ │ │ ├── host_resolver │ │ │ │ ├── mod.rs │ │ │ │ └── yaml.rs │ │ │ ├── mod.rs │ │ │ ├── registry.rs │ │ │ └── static_addr │ │ │ │ ├── mod.rs │ │ │ │ └── yaml.rs │ │ ├── log.rs │ │ ├── mod.rs │ │ └── server │ │ │ ├── dummy_close.rs │ │ │ ├── keyless_proxy.rs │ │ │ ├── mod.rs │ │ │ ├── openssl_proxy │ │ │ ├── host.rs │ │ │ └── mod.rs │ │ │ ├── plain_quic_port.rs │ │ │ ├── plain_tcp_port.rs │ │ │ ├── registry.rs │ │ │ └── rustls_proxy │ │ │ ├── host.rs │ │ │ └── mod.rs │ ├── control │ │ ├── bridge │ │ │ ├── mod.rs │ │ │ └── reload.rs │ │ ├── capnp │ │ │ ├── backend.rs │ │ │ ├── common.rs │ │ │ ├── mod.rs │ │ │ ├── proc.rs │ │ │ └── server.rs │ │ ├── local │ │ │ └── mod.rs │ │ ├── mod.rs │ │ ├── quit.rs │ │ └── upgrade.rs │ ├── discover │ │ ├── host_resolver │ │ │ └── mod.rs │ │ ├── mod.rs │ │ ├── ops.rs │ │ ├── registry.rs │ │ └── static_addr │ │ │ └── mod.rs │ ├── lib.rs │ ├── log │ │ ├── mod.rs │ │ ├── shared.rs │ │ └── task │ │ │ ├── keyless.rs │ │ │ ├── mod.rs │ │ │ └── tcp_connect.rs │ ├── main.rs │ ├── module │ │ ├── keyless │ │ │ ├── backend │ │ │ │ ├── mod.rs │ │ │ │ ├── multiplex │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── recv.rs │ │ │ │ │ ├── send.rs │ │ │ │ │ └── state.rs │ │ │ │ ├── pool.rs │ │ │ │ └── stats.rs │ │ │ ├── mod.rs │ │ │ ├── protocol │ │ │ │ ├── error.rs │ │ │ │ ├── header.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── request.rs │ │ │ │ └── response.rs │ │ │ └── stats.rs │ │ ├── mod.rs │ │ └── stream │ │ │ ├── error.rs │ │ │ ├── mod.rs │ │ │ ├── stats │ │ │ ├── backend.rs │ │ │ ├── mod.rs │ │ │ ├── server.rs │ │ │ └── task.rs │ │ │ └── transit.rs │ ├── opts.rs │ ├── serve │ │ ├── dummy_close │ │ │ ├── mod.rs │ │ │ └── server.rs │ │ ├── error.rs │ │ ├── keyless_proxy │ │ │ ├── mod.rs │ │ │ ├── server.rs │ │ │ ├── stats │ │ │ │ ├── mod.rs │ │ │ │ └── server.rs │ │ │ └── task │ │ │ │ ├── common.rs │ │ │ │ ├── mod.rs │ │ │ │ └── stats.rs │ │ ├── mod.rs │ │ ├── openssl_proxy │ │ │ ├── host.rs │ │ │ ├── mod.rs │ │ │ ├── server.rs │ │ │ └── task │ │ │ │ ├── accept.rs │ │ │ │ ├── common.rs │ │ │ │ ├── mod.rs │ │ │ │ └── relay.rs │ │ ├── ops.rs │ │ ├── plain_quic_port │ │ │ └── mod.rs │ │ ├── plain_tcp_port │ │ │ └── mod.rs │ │ ├── registry.rs │ │ ├── rustls_proxy │ │ │ ├── host.rs │ │ │ ├── mod.rs │ │ │ ├── server.rs │ │ │ └── task │ │ │ │ ├── accept.rs │ │ │ │ ├── common.rs │ │ │ │ ├── mod.rs │ │ │ │ └── relay.rs │ │ ├── stats.rs │ │ └── task.rs │ ├── signal.rs │ └── stat │ │ ├── metrics │ │ ├── backend │ │ │ ├── keyless.rs │ │ │ ├── mod.rs │ │ │ └── stream.rs │ │ ├── mod.rs │ │ └── server.rs │ │ └── mod.rs └── utils │ └── ctl │ ├── Cargo.toml │ └── src │ ├── backend.rs │ ├── common.rs │ ├── main.rs │ ├── proc.rs │ └── server.rs ├── justfile ├── lib ├── g3-build-env │ ├── Cargo.toml │ └── src │ │ ├── basic.rs │ │ ├── lib.rs │ │ ├── openssl.rs │ │ └── rustls.rs ├── g3-cert-agent │ ├── Cargo.toml │ └── src │ │ ├── config │ │ ├── mod.rs │ │ └── yaml.rs │ │ ├── handle.rs │ │ ├── lib.rs │ │ ├── protocol.rs │ │ ├── query.rs │ │ ├── request.rs │ │ ├── response.rs │ │ └── runtime.rs ├── g3-clap │ ├── Cargo.toml │ └── src │ │ ├── humanize │ │ ├── mod.rs │ │ ├── size.rs │ │ └── time.rs │ │ └── lib.rs ├── g3-compat │ ├── Cargo.toml │ └── src │ │ ├── hostname │ │ ├── mod.rs │ │ ├── unix.rs │ │ └── windows.rs │ │ ├── lib.rs │ │ └── sched │ │ ├── freebsd.rs │ │ ├── linux.rs │ │ ├── mod.rs │ │ ├── netbsd.rs │ │ ├── os.rs │ │ └── windows.rs ├── g3-ctl │ ├── Cargo.toml │ └── src │ │ ├── error.rs │ │ ├── io.rs │ │ ├── lib.rs │ │ └── opts.rs ├── g3-daemon │ ├── Cargo.toml │ └── src │ │ ├── config │ │ ├── lookup.rs │ │ ├── mod.rs │ │ └── topology.rs │ │ ├── control │ │ ├── capnp.rs │ │ ├── config │ │ │ ├── local.rs │ │ │ └── mod.rs │ │ ├── local │ │ │ ├── mod.rs │ │ │ ├── unix.rs │ │ │ └── windows.rs │ │ ├── mod.rs │ │ ├── panic.rs │ │ ├── quit.rs │ │ ├── text.rs │ │ └── upgrade.rs │ │ ├── daemonize.rs │ │ ├── lib.rs │ │ ├── listen │ │ ├── mod.rs │ │ ├── no_quic.rs │ │ ├── quic.rs │ │ ├── stats.rs │ │ ├── tcp.rs │ │ ├── udp.rs │ │ └── unix │ │ │ ├── datagram.rs │ │ │ └── mod.rs │ │ ├── log │ │ ├── event │ │ │ ├── config.rs │ │ │ ├── metrics.rs │ │ │ ├── mod.rs │ │ │ ├── registry.rs │ │ │ ├── report.rs │ │ │ └── stats.rs │ │ ├── mod.rs │ │ └── process.rs │ │ ├── metrics │ │ ├── helper.rs │ │ ├── listen.rs │ │ ├── log.rs │ │ ├── mod.rs │ │ └── server.rs │ │ ├── opts │ │ ├── config.rs │ │ ├── control.rs │ │ ├── daemon.rs │ │ └── mod.rs │ │ ├── register │ │ ├── config.rs │ │ ├── mod.rs │ │ └── task.rs │ │ ├── runtime │ │ ├── config.rs │ │ ├── metrics.rs │ │ ├── mod.rs │ │ └── worker.rs │ │ ├── server │ │ ├── connection.rs │ │ ├── mod.rs │ │ ├── quit_policy.rs │ │ ├── runtime.rs │ │ └── task.rs │ │ ├── signal │ │ ├── mod.rs │ │ ├── unix.rs │ │ └── windows.rs │ │ └── stat │ │ ├── config.rs │ │ ├── emit.rs │ │ ├── mod.rs │ │ ├── remote │ │ ├── mod.rs │ │ └── tcp_connect.rs │ │ └── task │ │ ├── mod.rs │ │ ├── tcp_stream.rs │ │ └── udp_connect.rs ├── g3-datetime │ ├── Cargo.toml │ └── src │ │ ├── format │ │ ├── asn1.rs │ │ ├── ftp.rs │ │ ├── log.rs │ │ ├── mod.rs │ │ └── std.rs │ │ └── lib.rs ├── g3-dpi │ ├── Cargo.toml │ ├── src │ │ ├── config │ │ │ ├── http.rs │ │ │ ├── imap.rs │ │ │ ├── mod.rs │ │ │ ├── size_limit.rs │ │ │ └── smtp.rs │ │ ├── lib.rs │ │ ├── parser │ │ │ ├── mod.rs │ │ │ ├── quic │ │ │ │ ├── frame │ │ │ │ │ ├── ack.rs │ │ │ │ │ ├── crypto.rs │ │ │ │ │ └── mod.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── packet │ │ │ │ │ ├── aes.rs │ │ │ │ │ ├── header.rs │ │ │ │ │ ├── hkdf.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── v1.rs │ │ │ │ │ └── v2.rs │ │ │ │ ├── tests │ │ │ │ │ ├── chrome_client_hello.rs │ │ │ │ │ └── mod.rs │ │ │ │ └── var_int.rs │ │ │ └── tls │ │ │ │ ├── extension.rs │ │ │ │ ├── handshake │ │ │ │ ├── client_hello.rs │ │ │ │ └── mod.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── record.rs │ │ │ │ └── tests │ │ │ │ ├── chrome_client_hello.rs │ │ │ │ ├── fragment_client_hello.rs │ │ │ │ ├── mod.rs │ │ │ │ └── tongsuo_client_hello.rs │ │ ├── protocol │ │ │ ├── bittorrent.rs │ │ │ ├── dns.rs │ │ │ ├── ftp.rs │ │ │ ├── http.rs │ │ │ ├── imap.rs │ │ │ ├── inspect.rs │ │ │ ├── mod.rs │ │ │ ├── mqtt.rs │ │ │ ├── nats.rs │ │ │ ├── nntp.rs │ │ │ ├── pop3.rs │ │ │ ├── portmap.rs │ │ │ ├── rtmp.rs │ │ │ ├── rtsp.rs │ │ │ ├── smpp.rs │ │ │ ├── smtp.rs │ │ │ ├── ssh.rs │ │ │ ├── ssl.rs │ │ │ └── stomp.rs │ │ └── source.rs │ └── tests │ │ ├── bittorrent.rs │ │ ├── ftp.rs │ │ ├── http.rs │ │ ├── imap.rs │ │ ├── nats.rs │ │ ├── nntp.rs │ │ ├── pop3.rs │ │ ├── smtp.rs │ │ ├── ssh.rs │ │ ├── ssl.rs │ │ └── stomp.rs ├── g3-fluentd │ ├── Cargo.toml │ └── src │ │ ├── config │ │ ├── mod.rs │ │ └── yaml.rs │ │ ├── format.rs │ │ ├── handshake.rs │ │ ├── lib.rs │ │ └── macros.rs ├── g3-ftp-client │ ├── Cargo.toml │ └── src │ │ ├── client.rs │ │ ├── config │ │ ├── mod.rs │ │ └── yaml.rs │ │ ├── connection.rs │ │ ├── control │ │ ├── command.rs │ │ ├── mod.rs │ │ └── response.rs │ │ ├── debug.rs │ │ ├── error │ │ ├── command.rs │ │ ├── connect.rs │ │ ├── file.rs │ │ ├── mod.rs │ │ ├── response.rs │ │ ├── session.rs │ │ └── transfer.rs │ │ ├── facts │ │ ├── entry_type.rs │ │ ├── mod.rs │ │ └── time_val.rs │ │ ├── feature.rs │ │ ├── lib.rs │ │ └── transfer │ │ ├── line.rs │ │ └── mod.rs ├── g3-geoip-db │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ ├── record.rs │ │ ├── store │ │ └── mod.rs │ │ └── vendor │ │ ├── ipfire.rs │ │ ├── ipinfo.rs │ │ ├── maxmind.rs │ │ ├── mod.rs │ │ └── native.rs ├── g3-geoip-types │ ├── Cargo.toml │ └── src │ │ ├── continent.rs │ │ ├── country │ │ ├── iso_generated.rs │ │ └── mod.rs │ │ ├── lib.rs │ │ └── location.rs ├── g3-h2 │ ├── Cargo.toml │ └── src │ │ ├── body │ │ ├── encoder.rs │ │ ├── error.rs │ │ ├── from_chunked_transfer.rs │ │ ├── mod.rs │ │ ├── reader.rs │ │ ├── to_chunked_transfer.rs │ │ ├── transfer.rs │ │ └── writer.rs │ │ ├── ext │ │ ├── mod.rs │ │ ├── request.rs │ │ └── response.rs │ │ └── lib.rs ├── g3-hickory-client │ ├── Cargo.toml │ └── src │ │ ├── connect │ │ ├── mod.rs │ │ ├── quinn.rs │ │ └── rustls.rs │ │ ├── io │ │ ├── h2.rs │ │ ├── h3.rs │ │ ├── http │ │ │ ├── mod.rs │ │ │ ├── request.rs │ │ │ └── response.rs │ │ ├── mod.rs │ │ ├── quic.rs │ │ ├── tcp.rs │ │ ├── tls.rs │ │ └── udp.rs │ │ └── lib.rs ├── g3-histogram │ ├── Cargo.toml │ └── src │ │ ├── config.rs │ │ ├── keeping.rs │ │ ├── lib.rs │ │ ├── quantile.rs │ │ ├── recorder.rs │ │ ├── rotating.rs │ │ └── stats.rs ├── g3-http │ ├── Cargo.toml │ ├── benches │ │ └── line_parse.rs │ └── src │ │ ├── body │ │ ├── body_to_chunked.rs │ │ ├── chunked_decoder.rs │ │ ├── decoder.rs │ │ ├── mod.rs │ │ ├── preview.rs │ │ ├── reader.rs │ │ ├── stream_to_chunked.rs │ │ └── trailer_reader.rs │ │ ├── client │ │ ├── adaptation.rs │ │ ├── error.rs │ │ ├── mod.rs │ │ ├── response.rs │ │ └── transparent.rs │ │ ├── connect │ │ ├── client.rs │ │ ├── error.rs │ │ ├── mod.rs │ │ ├── request.rs │ │ └── response.rs │ │ ├── header │ │ ├── auth.rs │ │ ├── connection.rs │ │ ├── content.rs │ │ ├── mod.rs │ │ └── transfer.rs │ │ ├── lib.rs │ │ ├── parse │ │ ├── chunked_line.rs │ │ ├── error.rs │ │ ├── header_line.rs │ │ ├── method_line.rs │ │ ├── mod.rs │ │ └── status_line.rs │ │ ├── server │ │ ├── adaptation.rs │ │ ├── error.rs │ │ ├── mod.rs │ │ ├── request.rs │ │ ├── transparent.rs │ │ └── uri.rs │ │ └── uri │ │ ├── error.rs │ │ ├── masque.rs │ │ ├── mod.rs │ │ └── well_known │ │ ├── easy_proxy.rs │ │ ├── masque.rs │ │ └── mod.rs ├── g3-icap-client │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ ├── options │ │ ├── error.rs │ │ ├── mod.rs │ │ ├── request.rs │ │ └── response.rs │ │ ├── parse │ │ ├── error.rs │ │ ├── header_line.rs │ │ ├── mod.rs │ │ └── status_line.rs │ │ ├── reason.rs │ │ ├── reqmod │ │ ├── error.rs │ │ ├── h1 │ │ │ ├── bidirectional.rs │ │ │ ├── error.rs │ │ │ ├── forward_body.rs │ │ │ ├── forward_header.rs │ │ │ ├── http_response.rs │ │ │ ├── impl_trait.rs │ │ │ ├── mod.rs │ │ │ ├── preview.rs │ │ │ ├── recv_request.rs │ │ │ └── recv_response.rs │ │ ├── h2 │ │ │ ├── bidirectional.rs │ │ │ ├── error.rs │ │ │ ├── forward_body.rs │ │ │ ├── forward_header.rs │ │ │ ├── mod.rs │ │ │ ├── preview.rs │ │ │ ├── recv_request.rs │ │ │ └── recv_response.rs │ │ ├── imap │ │ │ ├── append │ │ │ │ ├── bidirectional.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── recv_request.rs │ │ │ │ └── recv_response.rs │ │ │ ├── error.rs │ │ │ └── mod.rs │ │ ├── mail.rs │ │ ├── mod.rs │ │ ├── payload.rs │ │ ├── response.rs │ │ └── smtp │ │ │ ├── data │ │ │ ├── bidirectional.rs │ │ │ ├── mod.rs │ │ │ ├── recv_request.rs │ │ │ └── recv_response.rs │ │ │ ├── error.rs │ │ │ └── mod.rs │ │ ├── respmod │ │ ├── error.rs │ │ ├── h1 │ │ │ ├── bidirectional.rs │ │ │ ├── error.rs │ │ │ ├── forward_body.rs │ │ │ ├── forward_header.rs │ │ │ ├── impl_trait.rs │ │ │ ├── mod.rs │ │ │ ├── preview.rs │ │ │ └── recv_response.rs │ │ ├── h2 │ │ │ ├── bidirectional.rs │ │ │ ├── error.rs │ │ │ ├── forward_body.rs │ │ │ ├── forward_header.rs │ │ │ ├── impl_trait.rs │ │ │ ├── mod.rs │ │ │ ├── preview.rs │ │ │ └── recv_response.rs │ │ ├── mod.rs │ │ ├── payload.rs │ │ └── response.rs │ │ ├── serialize │ │ ├── header.rs │ │ └── mod.rs │ │ └── service │ │ ├── client.rs │ │ ├── config │ │ ├── mod.rs │ │ └── yaml.rs │ │ ├── connection.rs │ │ ├── mod.rs │ │ └── pool.rs ├── g3-imap-proto │ ├── Cargo.toml │ └── src │ │ ├── command │ │ └── mod.rs │ │ ├── lib.rs │ │ ├── pipeline.rs │ │ └── response │ │ ├── bad.rs │ │ ├── bye.rs │ │ └── mod.rs ├── g3-io-ext │ ├── Cargo.toml │ ├── benches │ │ └── io_rate_limit.rs │ └── src │ │ ├── cache │ │ ├── handle.rs │ │ ├── mod.rs │ │ └── runtime.rs │ │ ├── haproxy │ │ ├── mod.rs │ │ ├── v1.rs │ │ └── v2.rs │ │ ├── io │ │ ├── buf │ │ │ ├── copy.rs │ │ │ ├── flex.rs │ │ │ ├── limited.rs │ │ │ ├── mod.rs │ │ │ └── once.rs │ │ ├── ext │ │ │ ├── fill_wait_data.rs │ │ │ ├── limited_buf_read_ext.rs │ │ │ ├── limited_read_buf_until.rs │ │ │ ├── limited_read_ext.rs │ │ │ ├── limited_read_until.rs │ │ │ ├── limited_skip_until.rs │ │ │ ├── limited_write_ext.rs │ │ │ ├── mod.rs │ │ │ ├── read_all_now.rs │ │ │ ├── write_all_flush.rs │ │ │ └── write_all_vectored.rs │ │ ├── limited_copy.rs │ │ ├── limited_read.rs │ │ ├── limited_stream.rs │ │ ├── limited_write.rs │ │ ├── line_recv_buf.rs │ │ ├── line_recv_vec.rs │ │ ├── mod.rs │ │ └── stream │ │ │ ├── mod.rs │ │ │ ├── openssl.rs │ │ │ └── rustls.rs │ │ ├── lib.rs │ │ ├── limit │ │ ├── datagram.rs │ │ ├── fixed_window │ │ │ ├── count.rs │ │ │ ├── datagram.rs │ │ │ ├── mod.rs │ │ │ └── stream.rs │ │ ├── mod.rs │ │ ├── stream.rs │ │ └── token_bucket │ │ │ ├── datagram.rs │ │ │ ├── mod.rs │ │ │ └── stream.rs │ │ ├── listen │ │ ├── mod.rs │ │ ├── tcp.rs │ │ └── tls.rs │ │ ├── quic │ │ ├── limited_socket.rs │ │ ├── mod.rs │ │ └── udp_poller.rs │ │ ├── time │ │ ├── idle.rs │ │ ├── mod.rs │ │ └── optional_interval.rs │ │ └── udp │ │ ├── copy │ │ ├── client.rs │ │ ├── mod.rs │ │ └── remote.rs │ │ ├── ext │ │ ├── macos.rs │ │ ├── mod.rs │ │ ├── unix.rs │ │ └── windows.rs │ │ ├── mod.rs │ │ ├── recv.rs │ │ ├── relay │ │ ├── client.rs │ │ ├── mod.rs │ │ └── remote.rs │ │ ├── send.rs │ │ ├── split.rs │ │ └── stats.rs ├── g3-ip-locate │ ├── Cargo.toml │ └── src │ │ ├── cache.rs │ │ ├── config │ │ ├── mod.rs │ │ └── yaml.rs │ │ ├── handle.rs │ │ ├── lib.rs │ │ ├── protocol.rs │ │ ├── query.rs │ │ ├── request.rs │ │ ├── response.rs │ │ └── runtime.rs ├── g3-journal │ ├── Cargo.toml │ └── src │ │ ├── format.rs │ │ ├── io.rs │ │ ├── lib.rs │ │ └── macros.rs ├── g3-json │ ├── Cargo.toml │ └── src │ │ ├── callback.rs │ │ ├── humanize │ │ ├── mod.rs │ │ ├── size.rs │ │ └── time.rs │ │ ├── key.rs │ │ ├── lib.rs │ │ ├── map.rs │ │ └── value │ │ ├── acl │ │ ├── child_domain.rs │ │ ├── exact_host.rs │ │ ├── exact_port.rs │ │ ├── mod.rs │ │ ├── network.rs │ │ ├── proxy_request.rs │ │ ├── regex_domain.rs │ │ ├── regex_set.rs │ │ └── user_agent.rs │ │ ├── acl_set │ │ ├── dst_host.rs │ │ └── mod.rs │ │ ├── auth.rs │ │ ├── datetime.rs │ │ ├── histogram.rs │ │ ├── metrics.rs │ │ ├── mod.rs │ │ ├── net │ │ ├── base.rs │ │ ├── http.rs │ │ ├── mod.rs │ │ ├── ports.rs │ │ ├── proxy.rs │ │ ├── tcp.rs │ │ ├── tls.rs │ │ └── udp.rs │ │ ├── openssl.rs │ │ ├── primary.rs │ │ ├── random.rs │ │ ├── rate_limit.rs │ │ ├── regex.rs │ │ ├── resolve.rs │ │ ├── route │ │ ├── alpn.rs │ │ ├── host.rs │ │ ├── mod.rs │ │ └── uri_path.rs │ │ ├── rustls.rs │ │ └── speed_limit.rs ├── g3-macros │ ├── Cargo.toml │ ├── src │ │ ├── any_config.rs │ │ └── lib.rs │ └── tests │ │ └── any_config.rs ├── g3-msgpack │ ├── Cargo.toml │ └── src │ │ ├── key.rs │ │ ├── lib.rs │ │ └── value │ │ ├── datetime.rs │ │ ├── geoip.rs │ │ ├── metrics.rs │ │ ├── mod.rs │ │ ├── net │ │ ├── base.rs │ │ └── mod.rs │ │ ├── openssl.rs │ │ ├── primary.rs │ │ ├── rustls.rs │ │ ├── tls.rs │ │ └── uuid.rs ├── g3-openssl │ ├── Cargo.toml │ ├── build.rs │ └── src │ │ ├── async_job │ │ ├── mod.rs │ │ ├── task.rs │ │ ├── tokio_op.rs │ │ └── wait_ctx.rs │ │ ├── ffi.rs │ │ ├── lib.rs │ │ └── ssl │ │ ├── accept.rs │ │ ├── async_accept.rs │ │ ├── async_connect.rs │ │ ├── async_mode.rs │ │ ├── connect.rs │ │ ├── error.rs │ │ ├── lazy_accept.rs │ │ ├── mod.rs │ │ ├── stream.rs │ │ ├── types │ │ ├── mask.rs │ │ └── mod.rs │ │ └── wrapper.rs ├── g3-redis-client │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ └── yaml.rs ├── g3-resolver │ ├── Cargo.toml │ ├── build.rs │ └── src │ │ ├── config.rs │ │ ├── driver │ │ ├── c_ares │ │ │ ├── config │ │ │ │ ├── mod.rs │ │ │ │ └── yaml.rs │ │ │ ├── driver.rs │ │ │ ├── error.rs │ │ │ └── mod.rs │ │ ├── fail_over │ │ │ ├── config.rs │ │ │ ├── driver.rs │ │ │ └── mod.rs │ │ ├── hickory │ │ │ ├── client.rs │ │ │ ├── config │ │ │ │ ├── mod.rs │ │ │ │ └── yaml.rs │ │ │ ├── driver.rs │ │ │ ├── error.rs │ │ │ └── mod.rs │ │ └── mod.rs │ │ ├── error.rs │ │ ├── handle.rs │ │ ├── lib.rs │ │ ├── message.rs │ │ ├── query.rs │ │ ├── record.rs │ │ ├── resolver.rs │ │ ├── runtime.rs │ │ └── stats.rs ├── g3-runtime │ ├── Cargo.toml │ └── src │ │ ├── blended │ │ ├── mod.rs │ │ └── yaml.rs │ │ ├── lib.rs │ │ └── unaided │ │ ├── mod.rs │ │ └── yaml.rs ├── g3-slog-types │ ├── Cargo.toml │ └── src │ │ ├── datetime.rs │ │ ├── duration.rs │ │ ├── http.rs │ │ ├── lib.rs │ │ ├── net.rs │ │ ├── openssl.rs │ │ ├── socket.rs │ │ └── uuid.rs ├── g3-smtp-proto │ ├── Cargo.toml │ └── src │ │ ├── command │ │ ├── hello.rs │ │ ├── mail.rs │ │ ├── mod.rs │ │ ├── path.rs │ │ └── recipient.rs │ │ ├── io │ │ ├── mod.rs │ │ ├── text_decoder.rs │ │ ├── text_encoder.rs │ │ └── text_reader.rs │ │ ├── lib.rs │ │ └── response │ │ ├── encoder.rs │ │ ├── mod.rs │ │ └── parser.rs ├── g3-socket │ ├── Cargo.toml │ └── src │ │ ├── bind.rs │ │ ├── cmsg │ │ ├── mod.rs │ │ └── udp │ │ │ ├── mod.rs │ │ │ ├── unix.rs │ │ │ └── windows.rs │ │ ├── connect │ │ ├── mod.rs │ │ ├── tcp.rs │ │ └── udp.rs │ │ ├── lib.rs │ │ ├── listen.rs │ │ ├── raw │ │ ├── mod.rs │ │ ├── unix.rs │ │ └── windows.rs │ │ ├── sockopt │ │ ├── mod.rs │ │ ├── unix │ │ │ ├── freebsd.rs │ │ │ ├── linux.rs │ │ │ └── mod.rs │ │ └── windows.rs │ │ ├── tcp.rs │ │ ├── udp.rs │ │ └── util.rs ├── g3-socks │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ ├── types │ │ ├── auth.rs │ │ ├── cmd.rs │ │ ├── error.rs │ │ ├── mod.rs │ │ └── version.rs │ │ ├── v4a │ │ ├── client.rs │ │ ├── mod.rs │ │ ├── reply.rs │ │ └── request.rs │ │ └── v5 │ │ ├── auth.rs │ │ ├── client.rs │ │ ├── mod.rs │ │ ├── quic.rs │ │ ├── reply.rs │ │ ├── request.rs │ │ └── udp_io.rs ├── g3-statsd-client │ ├── Cargo.toml │ └── src │ │ ├── client │ │ ├── formatter.rs │ │ └── mod.rs │ │ ├── config │ │ ├── mod.rs │ │ └── yaml.rs │ │ ├── lib.rs │ │ ├── sink │ │ ├── buf.rs │ │ ├── mod.rs │ │ ├── udp.rs │ │ └── unix.rs │ │ └── tag.rs ├── g3-stdlog │ ├── Cargo.toml │ └── src │ │ ├── format.rs │ │ ├── lib.rs │ │ └── macros.rs ├── g3-syslog │ ├── CHANGELOG │ ├── Cargo.toml │ └── src │ │ ├── async_streamer.rs │ │ ├── backend │ │ ├── mod.rs │ │ ├── udp.rs │ │ ├── unix_datagram.rs │ │ └── yaml.rs │ │ ├── format │ │ ├── cee.rs │ │ ├── macros.rs │ │ ├── mod.rs │ │ ├── rfc3164.rs │ │ ├── rfc5424.rs │ │ ├── serde.rs │ │ └── yaml.rs │ │ ├── lib.rs │ │ ├── types.rs │ │ ├── util.rs │ │ └── yaml.rs ├── g3-tls-cert │ ├── Cargo.toml │ ├── build.rs │ └── src │ │ ├── builder │ │ ├── client.rs │ │ ├── intermediate.rs │ │ ├── key_usage.rs │ │ ├── mimic.rs │ │ ├── mod.rs │ │ ├── pkey.rs │ │ ├── root.rs │ │ ├── serial.rs │ │ ├── server.rs │ │ ├── subject.rs │ │ └── time.rs │ │ ├── ext │ │ ├── ffi.rs │ │ ├── mod.rs │ │ ├── pkey.rs │ │ ├── rsa.rs │ │ └── x509_builder.rs │ │ └── lib.rs ├── g3-tls-ticket │ ├── Cargo.toml │ └── src │ │ ├── config │ │ ├── mod.rs │ │ └── yaml.rs │ │ ├── lib.rs │ │ ├── source │ │ ├── json.rs │ │ ├── mod.rs │ │ ├── redis │ │ │ ├── mod.rs │ │ │ └── yaml.rs │ │ └── yaml.rs │ │ └── update.rs ├── g3-types │ ├── Cargo.toml │ ├── benches │ │ └── upstream_addr.rs │ └── src │ │ ├── acl │ │ ├── a_hash.rs │ │ ├── child_domain.rs │ │ ├── exact_host.rs │ │ ├── exact_port.rs │ │ ├── fx_hash.rs │ │ ├── mod.rs │ │ ├── network.rs │ │ ├── proxy_request.rs │ │ ├── radix_trie.rs │ │ ├── regex_domain.rs │ │ ├── regex_set.rs │ │ └── user_agent.rs │ │ ├── acl_set │ │ ├── dst_host.rs │ │ └── mod.rs │ │ ├── auth │ │ ├── crypt.rs │ │ ├── error.rs │ │ ├── mod.rs │ │ └── user.rs │ │ ├── collection │ │ ├── mod.rs │ │ ├── named_value.rs │ │ ├── selective_vec.rs │ │ └── weighted_value.rs │ │ ├── error │ │ ├── mod.rs │ │ └── str.rs │ │ ├── ext │ │ ├── duration.rs │ │ ├── mod.rs │ │ ├── net.rs │ │ └── option.rs │ │ ├── fs │ │ ├── file.rs │ │ └── mod.rs │ │ ├── lib.rs │ │ ├── limit │ │ ├── datagram_speed.rs │ │ ├── gauge_semaphore.rs │ │ ├── mod.rs │ │ ├── rate_limit_quota.rs │ │ └── stream_speed.rs │ │ ├── log │ │ ├── async_log.rs │ │ ├── drop.rs │ │ ├── mod.rs │ │ └── stats.rs │ │ ├── metrics │ │ ├── mod.rs │ │ ├── name.rs │ │ └── tag │ │ │ ├── map.rs │ │ │ ├── mod.rs │ │ │ ├── name.rs │ │ │ └── value.rs │ │ ├── net │ │ ├── buf.rs │ │ ├── dns │ │ │ ├── encryption.rs │ │ │ └── mod.rs │ │ ├── egress.rs │ │ ├── error.rs │ │ ├── haproxy │ │ │ ├── mod.rs │ │ │ ├── v1.rs │ │ │ └── v2.rs │ │ ├── host.rs │ │ ├── http │ │ │ ├── auth │ │ │ │ ├── basic.rs │ │ │ │ └── mod.rs │ │ │ ├── capability │ │ │ │ ├── forward.rs │ │ │ │ └── mod.rs │ │ │ ├── header │ │ │ │ ├── forwarded.rs │ │ │ │ ├── map.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── name.rs │ │ │ │ ├── server_id.rs │ │ │ │ └── value.rs │ │ │ ├── keepalive.rs │ │ │ ├── mod.rs │ │ │ ├── proxy │ │ │ │ ├── mod.rs │ │ │ │ └── protocol.rs │ │ │ └── upgrade.rs │ │ ├── interface.rs │ │ ├── mod.rs │ │ ├── openssl │ │ │ ├── cert_pair.rs │ │ │ ├── client │ │ │ │ ├── intercept.rs │ │ │ │ ├── mod.rs │ │ │ │ └── session.rs │ │ │ ├── mod.rs │ │ │ ├── protocol.rs │ │ │ ├── server │ │ │ │ ├── intercept.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── session.rs │ │ │ │ ├── ticket_key.rs │ │ │ │ └── ticketer.rs │ │ │ └── tlcp_cert_pair.rs │ │ ├── pool.rs │ │ ├── port │ │ │ ├── mod.rs │ │ │ ├── port_range.rs │ │ │ └── ports.rs │ │ ├── proxy │ │ │ ├── common.rs │ │ │ ├── http.rs │ │ │ ├── mod.rs │ │ │ ├── socks4.rs │ │ │ └── socks5.rs │ │ ├── quinn │ │ │ ├── mod.rs │ │ │ └── transport.rs │ │ ├── rate_limit │ │ │ ├── mod.rs │ │ │ ├── tcp.rs │ │ │ └── udp.rs │ │ ├── rustls │ │ │ ├── ca_certs.rs │ │ │ ├── cache.rs │ │ │ ├── cert_pair.rs │ │ │ ├── cert_resolver.rs │ │ │ ├── client.rs │ │ │ ├── ext.rs │ │ │ ├── mod.rs │ │ │ ├── server.rs │ │ │ └── ticketer.rs │ │ ├── socks │ │ │ ├── auth.rs │ │ │ └── mod.rs │ │ ├── tcp │ │ │ ├── connect.rs │ │ │ ├── keepalive.rs │ │ │ ├── listen.rs │ │ │ ├── mod.rs │ │ │ └── sockopt.rs │ │ ├── tls │ │ │ ├── alert.rs │ │ │ ├── alpn.rs │ │ │ ├── cert_usage.rs │ │ │ ├── mod.rs │ │ │ ├── server_name.rs │ │ │ ├── service_type.rs │ │ │ ├── ticket_name.rs │ │ │ ├── ticketer.rs │ │ │ └── version.rs │ │ ├── tlv.rs │ │ ├── udp │ │ │ ├── listen.rs │ │ │ ├── mod.rs │ │ │ └── sockopt.rs │ │ ├── upstream.rs │ │ └── websocket.rs │ │ ├── resolve │ │ ├── mod.rs │ │ ├── redirect.rs │ │ └── strategy.rs │ │ ├── route │ │ ├── alpn.rs │ │ ├── host.rs │ │ ├── mod.rs │ │ └── uri_path.rs │ │ ├── stats │ │ ├── id.rs │ │ ├── map.rs │ │ ├── mod.rs │ │ ├── pool.rs │ │ ├── tcp.rs │ │ └── udp.rs │ │ └── sync │ │ └── mod.rs ├── g3-udpdump │ ├── Cargo.toml │ └── src │ │ ├── dissector.rs │ │ ├── lib.rs │ │ └── stream │ │ ├── config │ │ ├── mod.rs │ │ └── yaml.rs │ │ ├── header.rs │ │ ├── mod.rs │ │ ├── read.rs │ │ ├── sink.rs │ │ ├── state.rs │ │ └── write.rs ├── g3-xcrypt │ ├── Cargo.toml │ └── src │ │ ├── b64 │ │ ├── decode.rs │ │ ├── encode.rs │ │ └── mod.rs │ │ ├── error.rs │ │ ├── lib.rs │ │ ├── md5.rs │ │ ├── sha256.rs │ │ └── sha512.rs └── g3-yaml │ ├── Cargo.toml │ └── src │ ├── callback.rs │ ├── hash.rs │ ├── humanize │ ├── mod.rs │ ├── size.rs │ └── time.rs │ ├── hybrid.rs │ ├── key.rs │ ├── lib.rs │ ├── util.rs │ └── value │ ├── acl │ ├── child_domain.rs │ ├── exact_host.rs │ ├── exact_port.rs │ ├── mod.rs │ ├── network.rs │ ├── proxy_request.rs │ ├── regex_domain.rs │ ├── regex_set.rs │ └── user_agent.rs │ ├── acl_set │ ├── dst_host.rs │ └── mod.rs │ ├── auth.rs │ ├── collection.rs │ ├── datetime.rs │ ├── dpi │ ├── http.rs │ ├── imap.rs │ ├── inspect.rs │ ├── mod.rs │ ├── policy │ │ ├── child_domain.rs │ │ ├── exact_host.rs │ │ ├── mod.rs │ │ └── network.rs │ ├── portmap.rs │ └── smtp.rs │ ├── fs.rs │ ├── geoip.rs │ ├── histogram.rs │ ├── metrics.rs │ ├── mod.rs │ ├── net │ ├── base.rs │ ├── buf.rs │ ├── dns.rs │ ├── haproxy.rs │ ├── http.rs │ ├── interface.rs │ ├── mod.rs │ ├── pool.rs │ ├── port.rs │ ├── proxy.rs │ ├── tcp.rs │ ├── tls.rs │ └── udp.rs │ ├── openssl.rs │ ├── primary.rs │ ├── quinn.rs │ ├── random.rs │ ├── rate_limit.rs │ ├── regex.rs │ ├── resolve.rs │ ├── route │ ├── alpn.rs │ ├── host.rs │ ├── mod.rs │ └── uri_path.rs │ ├── rustls.rs │ ├── sched.rs │ └── speed_limit.rs ├── scripts ├── build_deb_from_git.sh ├── build_deb_from_tar.sh ├── build_rpm_from_git.sh ├── build_rpm_from_tar.sh ├── capnp-generate │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── coverage │ ├── enter.sh │ ├── g3bench.sh │ ├── g3bench │ │ ├── .gitignore │ │ ├── README.md │ │ ├── dnsmasq.conf │ │ ├── g3proxy.yaml │ │ ├── g3statsd.yaml │ │ ├── mkcert.sh │ │ ├── nginx.conf │ │ ├── run.sh │ │ ├── target_dns.sh │ │ ├── target_h1.sh │ │ ├── target_h2.sh │ │ ├── target_keyless_openssl.sh │ │ ├── target_openssl.sh │ │ └── target_rustls.sh │ ├── g3proxy.sh │ ├── g3proxy │ │ ├── .gitignore │ │ ├── 0000_all_resolver │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0001_base_http_proxy │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0002_base_socks_proxy │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0003_base_tcp_stream │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0003_chain_tcp_stream │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0004_base_http_gateway │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0005_transparent_proxy │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0006_chain_http_proxy │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0007_chain_socks_proxy │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0008_base_user_auth │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0009_anonymous_user │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0010_escaper_direct_float │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0011_escaper_proxy_float │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0012_intelli_proxy │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0013_dynamic_user │ │ │ ├── g3proxy.yaml │ │ │ ├── group_1.json │ │ │ ├── group_2.json │ │ │ ├── group_3.lua │ │ │ ├── group_3_cache.json │ │ │ ├── group_4.py │ │ │ ├── group_4_cache.json │ │ │ └── testcases.sh │ │ ├── 0014_escaper_failover │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0015_escaper_geoip │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0016_resolve_failover │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0020_audit_base │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0021_audit_icap_preview │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0022_audit_icap_no_preview │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 0023_audit_user │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 1000_worker_base │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 1001_worker_sched │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 1002_worker_listen │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── 1003_worker_multi_rt │ │ │ ├── g3proxy.yaml │ │ │ └── testcases.sh │ │ ├── README.md │ │ ├── dnsmasq.conf │ │ ├── docker_run.sh │ │ ├── fluent-bit.conf │ │ ├── g3fcgen.yaml │ │ ├── g3iploc.yaml │ │ ├── g3proxy.yaml │ │ ├── g3statsd.yaml │ │ ├── ip_location.csv │ │ ├── mkcert.sh │ │ ├── nginx.conf │ │ ├── run.sh │ │ └── testcases.sh │ ├── g3statsd.sh │ ├── g3statsd │ │ └── run.sh │ └── lib_unit_test.sh ├── cpuset_split.py ├── dependency │ └── check_outdated.py ├── generate │ └── country │ │ ├── iso3166_alpha2.awk │ │ ├── iso3166_alpha2_map.awk │ │ ├── iso3166_alpha3.awk │ │ ├── iso3166_continent.awk │ │ ├── iso3166_enum.awk │ │ ├── iso3166_from_alpha2_str.awk │ │ ├── iso3166_from_alpha3_str.awk │ │ ├── iso3166_names.awk │ │ ├── iso3166_variant_count.awk │ │ └── update.sh ├── package │ ├── detect_c-ares_feature.sh │ ├── detect_lua_feature.sh │ └── detect_openssl_feature.sh ├── passphrase_hash.py ├── release │ ├── build_tarball.sh │ ├── bundle_license.py │ ├── list_local_deps.py │ ├── prepare_package.sh │ ├── prepare_rpm_spec.awk │ ├── prune_patch.py │ ├── prune_workspace.py │ └── useless_patch.awk └── test │ ├── http_keepalive_get.py │ └── socks5_dns_query.py └── sphinx ├── README.md ├── conf.py ├── g3keymess ├── .gitignore ├── Makefile ├── _static │ └── .place-holder ├── _templates │ └── .place-holder ├── conf.py ├── configuration │ ├── backend.rst │ ├── index.rst │ ├── log │ │ ├── driver │ │ │ ├── fluentd.rst │ │ │ └── syslog.rst │ │ └── index.rst │ ├── runtime.rst │ ├── server.rst │ ├── stat.rst │ ├── stores │ │ ├── index.rst │ │ └── local.rst │ └── values │ │ ├── base.rst │ │ ├── fs.rst │ │ ├── index.rst │ │ ├── metrics.rst │ │ ├── network.rst │ │ ├── runtime.rst │ │ └── tls.rst ├── index.rst ├── log │ ├── index.rst │ ├── request.rst │ └── task.rst ├── make.bat ├── metrics │ ├── index.rst │ └── server.rst └── requirements.txt ├── g3proxy ├── .gitignore ├── Makefile ├── README.md ├── _static │ └── .place-holder ├── _templates │ └── .place-holder ├── conf.py ├── configuration │ ├── auditors │ │ └── index.rst │ ├── escapers │ │ ├── comply_audit.rst │ │ ├── direct_fixed.rst │ │ ├── direct_float.rst │ │ ├── divert_tcp.rst │ │ ├── dummy_deny.rst │ │ ├── index.rst │ │ ├── proxy_float.rst │ │ ├── proxy_http.rst │ │ ├── proxy_https.rst │ │ ├── proxy_socks5.rst │ │ ├── proxy_socks5s.rst │ │ ├── route_client.rst │ │ ├── route_failover.rst │ │ ├── route_geoip.rst │ │ ├── route_mapping.rst │ │ ├── route_query.rst │ │ ├── route_resolved.rst │ │ ├── route_select.rst │ │ ├── route_upstream.rst │ │ └── trick_float.rst │ ├── index.rst │ ├── log │ │ ├── driver │ │ │ ├── fluentd.rst │ │ │ └── syslog.rst │ │ └── index.rst │ ├── resolvers │ │ ├── c_ares.rst │ │ ├── deny_all.rst │ │ ├── fail_over.rst │ │ ├── hickory.rst │ │ └── index.rst │ ├── runtime.rst │ ├── servers │ │ ├── dummy_close.rst │ │ ├── http_proxy.rst │ │ ├── http_rproxy.rst │ │ ├── index.rst │ │ ├── intelli_proxy.rst │ │ ├── native_tls_port.rst │ │ ├── plain_quic_port.rst │ │ ├── plain_tcp_port.rst │ │ ├── plain_tls_port.rst │ │ ├── sni_proxy.rst │ │ ├── socks_proxy.rst │ │ ├── tcp_stream.rst │ │ ├── tcp_tproxy.rst │ │ └── tls_stream.rst │ ├── stat.rst │ ├── user_group │ │ ├── audit.rst │ │ ├── index.rst │ │ ├── site.rst │ │ ├── source.rst │ │ └── user.rst │ └── values │ │ ├── acl.rst │ │ ├── audit.rst │ │ ├── base.rst │ │ ├── db.rst │ │ ├── dpi.rst │ │ ├── fs.rst │ │ ├── geoip.rst │ │ ├── index.rst │ │ ├── metrics.rst │ │ ├── network.rst │ │ ├── quic.rst │ │ ├── rate_limit.rst │ │ ├── resolve.rst │ │ ├── route.rst │ │ ├── runtime.rst │ │ └── tls.rst ├── index.rst ├── log │ ├── escape │ │ ├── index.rst │ │ ├── tcp_connect.rst │ │ ├── tls_handshake.rst │ │ └── udp_sendto.rst │ ├── index.rst │ ├── resolve │ │ ├── c_ares.rst │ │ ├── deny_all.rst │ │ ├── fail_over.rst │ │ ├── hickory.rst │ │ └── index.rst │ └── task │ │ ├── ftp_over_http.rst │ │ ├── http_forward.rst │ │ ├── index.rst │ │ ├── tcp_connect.rst │ │ ├── udp_associate.rst │ │ └── udp_connect.rst ├── make.bat ├── metrics │ ├── escaper.rst │ ├── index.rst │ ├── logger.rst │ ├── resolver.rst │ ├── runtime.rst │ ├── server.rst │ ├── user.rst │ └── user_site.rst ├── protocol │ ├── client │ │ ├── egress_path_selection.rst │ │ ├── http_custom_codes.rst │ │ ├── http_custom_headers.rst │ │ ├── index.rst │ │ └── socks5_custom_reply.rst │ ├── helper │ │ ├── cert_generator.rst │ │ ├── icap_h2.rst │ │ ├── icap_http.rst │ │ ├── icap_imap.rst │ │ ├── icap_smtp.rst │ │ ├── index.rst │ │ ├── ip_locate.rst │ │ ├── route_query.rst │ │ └── stream_detour.rst │ ├── index.rst │ └── setup │ │ ├── index.rst │ │ ├── transparent_proxy.rst │ │ └── wireshark_udpdump.rst └── requirements.txt ├── g3statsd ├── .gitignore ├── Makefile ├── _static │ └── .place-holder ├── _templates │ └── .place-holder ├── conf.py ├── configuration │ ├── collector │ │ ├── aggregate.rst │ │ ├── discard.rst │ │ ├── index.rst │ │ ├── internal.rst │ │ └── regulate.rst │ ├── exporter │ │ ├── console.rst │ │ ├── discard.rst │ │ ├── graphite.rst │ │ ├── index.rst │ │ ├── influxdb_v2.rst │ │ ├── influxdb_v3.rst │ │ ├── memory.rst │ │ └── opentsdb.rst │ ├── importer │ │ ├── dummy.rst │ │ ├── index.rst │ │ └── statsd.rst │ ├── index.rst │ ├── runtime.rst │ └── values │ │ ├── acl.rst │ │ ├── base.rst │ │ ├── fs.rst │ │ ├── index.rst │ │ ├── metrics.rst │ │ └── network.rst ├── index.rst ├── make.bat └── requirements.txt ├── g3tiles ├── .gitignore ├── Makefile ├── README.md ├── _static │ └── .placeholder ├── _templates │ └── .placeholder ├── conf.py ├── configuration │ ├── backends │ │ ├── dummy_close.rst │ │ ├── index.rst │ │ ├── keyless_quic.rst │ │ ├── keyless_tcp.rst │ │ └── stream_tcp.rst │ ├── discovers │ │ ├── host_resolver.rst │ │ ├── index.rst │ │ └── static_addr.rst │ ├── index.rst │ ├── log │ │ ├── driver │ │ │ ├── fluentd.rst │ │ │ └── syslog.rst │ │ └── index.rst │ ├── runtime.rst │ ├── servers │ │ ├── dummy_close.rst │ │ ├── index.rst │ │ ├── keyless_proxy.rst │ │ ├── openssl_proxy.rst │ │ ├── plain_quic_port.rst │ │ ├── plain_tcp_port.rst │ │ └── rustls_proxy.rst │ ├── stat.rst │ └── values │ │ ├── acl.rst │ │ ├── base.rst │ │ ├── db.rst │ │ ├── fs.rst │ │ ├── index.rst │ │ ├── metrics.rst │ │ ├── network.rst │ │ ├── quic.rst │ │ ├── rate_limit.rst │ │ ├── route.rst │ │ ├── runtime.rst │ │ └── tls.rst ├── index.rst ├── log │ ├── index.rst │ └── task │ │ ├── index.rst │ │ ├── keyless.rst │ │ └── tcp_connect.rst ├── make.bat ├── metrics │ ├── backend │ │ ├── index.rst │ │ ├── keyless.rst │ │ └── stream.rst │ ├── index.rst │ ├── logger.rst │ ├── runtime.rst │ └── server.rst └── requirements.txt ├── project ├── .gitignore ├── Makefile ├── conf.py ├── index.rst ├── make.bat └── requirements.txt └── requirements.txt /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [resolver] 2 | incompatible-rust-versions = "allow" 3 | 4 | [target.'cfg(target_arch = "x86_64")'] 5 | rustflags = [ 6 | "-C", "target-cpu=x86-64-v2", 7 | ] 8 | 9 | [target.'cfg(target_arch = "aarch64")'] 10 | rustflags = [ 11 | "-C", "target-feature=+neon,+aes", 12 | ] 13 | -------------------------------------------------------------------------------- /.clippy.toml: -------------------------------------------------------------------------------- 1 | # for result_large_err 2 | # https://doc.rust-lang.org/clippy/lint_configuration.html#large-error-threshold 3 | large-error-threshold = 256 4 | 5 | # for large_enum_variant 6 | # https://doc.rust-lang.org/clippy/lint_configuration.html#enum-variant-size-threshold 7 | enum-variant-size-threshold = 512 8 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | 2 | # Git 3 | .git 4 | .github 5 | 6 | # Cargo 7 | target/ 8 | 9 | # 10 | ansible 11 | doc 12 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: cargo 4 | directory: "/" 5 | schedule: 6 | interval: weekly 7 | day: sunday 8 | time: "20:00" # UTC 9 | groups: 10 | patch-versions: 11 | patterns: 12 | - "*" 13 | update-types: 14 | - "patch" 15 | - package-ecosystem: github-actions 16 | directory: "/" 17 | schedule: 18 | interval: weekly 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # IDE 3 | .idea/ 4 | .vscode/ 5 | 6 | # Cargo 7 | /target/ 8 | 9 | # generated bundled license 10 | LICENSE-BUNDLED 11 | 12 | # deb package 13 | /debian/ 14 | 15 | # tmp file 16 | g3proxy/service/g3proxy@.service 17 | g3tiles/service/g3tiles@.service 18 | g3keymess/service/g3keymess@.service 19 | 20 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Each component have its own changelog. 2 | 3 | - [g3proxy](g3proxy/CHANGELOG) 4 | - [g3bench](g3bench/CHANGELOG) 5 | - [g3fcgen](g3fcgen/CHANGELOG) 6 | - [g3tiles](g3tiles/CHANGELOG) 7 | - [g3mkcert](g3mkcert/CHANGELOG) 8 | -------------------------------------------------------------------------------- /G3-FEISHU-USER-GROUP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/g3/4b629c469b5f0d59c05d626d0295f9d9e09a9b14/G3-FEISHU-USER-GROUP.png -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | G3 Project 2 | Copyright 2023 ByteDance Ltd. and/or its affiliates. 3 | -------------------------------------------------------------------------------- /ansible/benchmark.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - hosts: "{{ group | default('g3proxy') }}" 4 | roles: 5 | - role: benchmark 6 | handlers: 7 | - ansible.builtin.import_tasks: roles/g3proxy/handlers/restart.yml 8 | vars: 9 | daemon_group: benchmark 10 | -------------------------------------------------------------------------------- /ansible/border-classic.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - hosts: "{{ group | default('g3proxy') }}" 4 | roles: 5 | - role: border-classic 6 | handlers: 7 | - ansible.builtin.import_tasks: roles/g3proxy/handlers/restart.yml 8 | vars: 9 | daemon_group: border-classic 10 | -------------------------------------------------------------------------------- /ansible/border-concise.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - hosts: "{{ group | default('g3proxy') }}" 4 | roles: 5 | - role: border-concise 6 | handlers: 7 | - ansible.builtin.import_tasks: roles/g3proxy/handlers/restart.yml 8 | vars: 9 | daemon_group: border-concise 10 | -------------------------------------------------------------------------------- /ansible/border-stream.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - hosts: "{{ group | default('g3proxy') }}" 4 | roles: 5 | - role: border-stream 6 | handlers: 7 | - ansible.builtin.import_tasks: roles/g3proxy/handlers/restart.yml 8 | vars: 9 | daemon_group: border-stream 10 | -------------------------------------------------------------------------------- /ansible/border-transit.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - hosts: "{{ group | default('g3proxy') }}" 4 | roles: 5 | - role: border-transit 6 | handlers: 7 | - ansible.builtin.import_tasks: roles/g3proxy/handlers/restart.yml 8 | vars: 9 | daemon_group: border-transit 10 | -------------------------------------------------------------------------------- /ansible/g3proxy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - hosts: "{{ group | default('g3proxy') }}" 4 | roles: 5 | - g3proxy 6 | -------------------------------------------------------------------------------- /ansible/roles/benchmark/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | benchmark_tls_name: bench.example.net 4 | 5 | benchmark_http_port: 8080 6 | benchmark_https_port: 9080 7 | benchmark_tcp_port: 8090 8 | benchmark_tls_port: 9090 9 | 10 | -------------------------------------------------------------------------------- /ansible/roles/benchmark/tasks/deploy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - ansible.builtin.import_tasks: config-all.yml 4 | 5 | - ansible.builtin.import_role: 6 | name: g3proxy 7 | tasks_from: start-after-deploy 8 | -------------------------------------------------------------------------------- /ansible/roles/benchmark/templates/resolver.d/default.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: {{ resolver_name }} 4 | type: c_ares 5 | 6 | server: 7 | - 1.1.1.1 8 | - 1.0.0.1 9 | 10 | -------------------------------------------------------------------------------- /ansible/roles/benchmark/templates/server.d/http_proxy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: {{ server_name }} 4 | type: HttpProxy 5 | 6 | escaper: {{ escaper_name }} 7 | 8 | listen: 9 | address: "[::]:{{ benchmark_http_port }}" 10 | backlog: 4096 11 | listen_in_worker: true 12 | 13 | -------------------------------------------------------------------------------- /ansible/roles/benchmark/templates/server.d/https_proxy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: {{ server_name }} 4 | type: HttpProxy 5 | 6 | escaper: {{ escaper_name }} 7 | 8 | listen: 9 | address: "[::]:{{ benchmark_https_port }}" 10 | backlog: 4096 11 | listen_in_worker: true 12 | 13 | tls_server: 14 | cert_pairs: 15 | certificate: "{{ server_name }}-{{ tls_name }}.pem" 16 | private_key: "{{ server_name }}-{{ tls_name }}-key.pem" 17 | 18 | -------------------------------------------------------------------------------- /ansible/roles/benchmark/templates/server.d/tcp_stream.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: {{ server_name }} 4 | type: TcpStream 5 | 6 | escaper: {{ escaper_name }} 7 | 8 | listen: 9 | address: "[::]:{{ benchmark_tcp_port }}" 10 | backlog: 4096 11 | listen_in_worker: true 12 | 13 | upstream: "{{ benchmark_upstream_addr }}" 14 | 15 | -------------------------------------------------------------------------------- /ansible/roles/benchmark/templates/server.d/tls_stream.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: {{ server_name }} 4 | type: TlsStream 5 | 6 | escaper: {{ escaper_name }} 7 | 8 | listen: 9 | address: "[::]:{{ benchmark_tls_port }}" 10 | backlog: 4096 11 | listen_in_worker: true 12 | 13 | tls_server: 14 | cert_pairs: 15 | certificate: "{{ server_name }}-{{ tls_name }}.pem" 16 | private_key: "{{ server_name }}-{{ tls_name }}-key.pem" 17 | 18 | upstream: "{{ benchmark_upstream_addr }}" 19 | 20 | -------------------------------------------------------------------------------- /ansible/roles/border-classic/tasks/deploy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - ansible.builtin.import_tasks: config-all.yml 4 | 5 | - ansible.builtin.import_role: 6 | name: g3proxy 7 | tasks_from: start-after-deploy 8 | -------------------------------------------------------------------------------- /ansible/roles/border-classic/templates/escaper.d/select.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: {{ escaper_name }} 4 | type: route_select 5 | 6 | next_nodes: 7 | {% for network_name in border_egress_networks.keys() %} 8 | - ed_{{ network_name }} 9 | {% endfor %} 10 | 11 | -------------------------------------------------------------------------------- /ansible/roles/border-classic/templates/resolver.d/direct.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | {%- set conf = border_conf %} 4 | 5 | name: "{{ resolver_name }}" 6 | type: c_ares 7 | 8 | server: {{ dns_server|to_yaml }} 9 | 10 | {% if network_name in ipv4map %} 11 | bind_ipv4: {{ ipv4map[network_name][0] }} 12 | {% endif %} 13 | {% if network_name in ipv6map %} 14 | bind_ipv6: {{ ipv6map[network_name][0] }} 15 | {% endif %} 16 | 17 | -------------------------------------------------------------------------------- /ansible/roles/border-classic/templates/resolver.d/failover.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | {%- set conf = border_conf %} 4 | 5 | name: "{{ resolver_name }}" 6 | type: Failover 7 | 8 | primary: "{{ resolver_name }}_p" 9 | standby: "{{ resolver_name }}_s" 10 | 11 | -------------------------------------------------------------------------------- /ansible/roles/border-concise/tasks/config-user.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Config users 4 | ansible.builtin.include_role: 5 | name: g3proxy 6 | tasks_from: config-user-group 7 | handlers_from: reload-user-group 8 | vars: 9 | template_name: "default" 10 | user_group_name: "ug_default" 11 | border_conf: "{{ border_concise_conf }}" 12 | when: border_concise_conf.users is defined 13 | -------------------------------------------------------------------------------- /ansible/roles/border-concise/tasks/deploy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - ansible.builtin.import_tasks: config-all.yml 4 | 5 | - ansible.builtin.import_role: 6 | name: g3proxy 7 | tasks_from: start-after-deploy 8 | -------------------------------------------------------------------------------- /ansible/roles/border-concise/templates/resolver.d/direct.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: "{{ resolver_name }}" 4 | type: c_ares 5 | 6 | server: {{ dns_server|to_yaml }} 7 | 8 | -------------------------------------------------------------------------------- /ansible/roles/border-concise/templates/resolver.d/failover.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: "{{ resolver_name }}" 4 | type: Failover 5 | 6 | primary: "{{ resolver_name }}_p" 7 | standby: "{{ resolver_name }}_s" 8 | 9 | -------------------------------------------------------------------------------- /ansible/roles/border-concise/templates/user-group.d/default.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | {%- set conf = border_conf %} 4 | 5 | name: "{{ user_group_name }}" 6 | 7 | {% if conf.users is defined and conf.users|length > 0 %} 8 | static_users: 9 | {{ conf.users|to_nice_yaml }} 10 | {% endif %} 11 | 12 | -------------------------------------------------------------------------------- /ansible/roles/border-stream/tasks/config-server-per-net.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: "Config tcp stream server on network {{ network_name }}" 4 | ansible.builtin.include_role: 5 | name: g3proxy 6 | tasks_from: config-server 7 | handlers_from: reload-server 8 | vars: 9 | template_name: tcp 10 | server_name: "tcp_{{ network_name }}_{{ item.key }}" 11 | stream_conf: "{{ item.value }}" 12 | with_dict: "{{ border_conf.tcp_servers }}" 13 | -------------------------------------------------------------------------------- /ansible/roles/border-stream/tasks/config-server.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Config tcp stream servers 4 | ansible.builtin.include_tasks: config-server-per-net.yml 5 | vars: 6 | escaper_name: "ed_{{ net_item.key }}" 7 | network_name: "{{ net_item.key }}" 8 | border_conf: "{{ net_item.value }}" 9 | with_dict: "{{ border_stream_networks }}" 10 | loop_control: 11 | loop_var: net_item 12 | -------------------------------------------------------------------------------- /ansible/roles/border-stream/tasks/deploy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - ansible.builtin.import_tasks: config-all.yml 4 | 5 | - ansible.builtin.import_role: 6 | name: g3proxy 7 | tasks_from: start-after-deploy 8 | -------------------------------------------------------------------------------- /ansible/roles/border-stream/templates/resolver.d/direct.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | {%- set conf = border_conf %} 4 | 5 | name: "{{ resolver_name }}" 6 | type: c_ares 7 | 8 | server: {{ dns_server | to_yaml }} 9 | 10 | {% if network_name in ipv4map %} 11 | bind_ipv4: {{ ipv4map[network_name][0] }} 12 | {% endif %} 13 | {% if network_name in ipv6map %} 14 | bind_ipv6: {{ ipv6map[network_name][0] }} 15 | {% endif %} 16 | 17 | -------------------------------------------------------------------------------- /ansible/roles/border-stream/templates/resolver.d/failover.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | {%- set conf = border_conf %} 4 | 5 | name: "{{ resolver_name }}" 6 | type: Failover 7 | 8 | primary: "{{ resolver_name }}_p" 9 | standby: "{{ resolver_name }}_s" 10 | 11 | -------------------------------------------------------------------------------- /ansible/roles/border-transit/tasks/config-user.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Config users 4 | ansible.builtin.include_role: 5 | name: g3proxy 6 | tasks_from: config-user-group 7 | handlers_from: reload-user-group 8 | vars: 9 | template_name: "default" 10 | user_group_name: "ug_default" 11 | border_conf: "{{ border_transit_conf }}" 12 | when: border_transit_conf.users is defined 13 | -------------------------------------------------------------------------------- /ansible/roles/border-transit/tasks/deploy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - ansible.builtin.import_tasks: config-all.yml 4 | 5 | - ansible.builtin.import_role: 6 | name: g3proxy 7 | tasks_from: start-after-deploy 8 | -------------------------------------------------------------------------------- /ansible/roles/border-transit/templates/resolver.d/direct.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: "{{ resolver_name }}" 4 | type: c_ares 5 | 6 | server: {{ dns_server | to_yaml }} 7 | 8 | -------------------------------------------------------------------------------- /ansible/roles/border-transit/templates/resolver.d/failover.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: "{{ resolver_name }}" 4 | type: Failover 5 | 6 | primary: "{{ resolver_name }}_p" 7 | standby: "{{ resolver_name }}_s" 8 | 9 | -------------------------------------------------------------------------------- /ansible/roles/border-transit/templates/user-group.d/default.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | {%- set conf = border_conf %} 4 | 5 | name: "{{ user_group_name }}" 6 | 7 | {% if conf.users is defined and conf.users|length > 0 %} 8 | static_users: 9 | {{ conf.users | to_nice_yaml }} 10 | {% endif %} 11 | 12 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | enterprise_id: 32473 4 | 5 | proxy_log_udp_port: 1514 6 | 7 | proxy_log_dir: /var/log/g3proxy 8 | proxy_log_rotate_count: 7 9 | proxy_log_rotate_minsize: 1G 10 | proxy_log_delaycompress: true 11 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Systemd daemon reload 4 | ansible.builtin.systemd: 5 | daemon_reload: true 6 | 7 | - name: Restart rsyslog 8 | ansible.builtin.systemd: 9 | name: rsyslog.service 10 | state: restarted 11 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/handlers/reload-escaper.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Reload escaper {{ escaper_name }} 4 | ansible.builtin.command: 5 | cmd: "/usr/bin/g3proxy-ctl -G {{ daemon_group }} --control-dir /run/g3proxy reload-escaper {{ escaper_name }}" 6 | register: reload 7 | changed_when: reload.rc == 0 8 | when: do_reload is defined and do_reload|bool 9 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/handlers/reload-resolver.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Reload resolver {{ resolver_name }} 4 | ansible.builtin.command: 5 | cmd: "/usr/bin/g3proxy-ctl -G {{ daemon_group }} --control-dir /run/g3proxy reload-resolver {{ resolver_name }}" 6 | register: reload 7 | changed_when: reload.rc == 0 8 | when: do_reload is defined and do_reload|bool 9 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/handlers/reload-server.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Reload server {{ server_name }} 4 | ansible.builtin.command: 5 | cmd: "/usr/bin/g3proxy-ctl -G {{ daemon_group }} --control-dir /run/g3proxy reload-server {{ server_name }}" 6 | register: reload 7 | changed_when: reload.rc == 0 8 | when: do_reload is defined and do_reload|bool 9 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/handlers/reload-user-group.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Reload user group {{ user_group_name }} 4 | ansible.builtin.command: 5 | cmd: "/usr/bin/g3proxy-ctl -G {{ daemon_group }} --control-dir /run/g3proxy reload-user-group {{ user_group_name }}" 6 | register: reload 7 | changed_when: reload.rc == 0 8 | when: do_reload is defined and do_reload|bool 9 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/handlers/restart.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: "Test config file for g3proxy instance {{ daemon_group }}" 4 | ansible.builtin.command: 5 | cmd: "g3proxy -t -c /etc/g3proxy/{{ daemon_group }}/main.yaml" 6 | register: check 7 | changed_when: check.rc == 0 8 | listen: "Restart daemon" 9 | 10 | - name: "Restart g3proxy instance {{ daemon_group }}" 11 | ansible.builtin.systemd: 12 | name: "g3proxy@{{ daemon_group }}.service" 13 | state: restarted 14 | listen: "Restart daemon" 15 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/tasks/clean-config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Remove conf dir for "g3proxy@{{ daemon_group }}" 4 | ansible.builtin.file: 5 | path: "/etc/g3proxy/{{ daemon_group }}" 6 | state: absent 7 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/tasks/config-escaper.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: "Install escaper conf for {{ escaper_name }}" 4 | ansible.builtin.template: 5 | src: "escaper.d/{{ template_name | default(escaper_name) }}.yaml" 6 | dest: "/etc/g3proxy/{{ daemon_group }}/escaper.d/{{ escaper_name }}.yaml" 7 | owner: root 8 | group: root 9 | mode: "0644" 10 | notify: Reload escaper {{ escaper_name }} 11 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/tasks/config-resolver.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: "Install resolver conf for {{ resolver_name }}" 4 | ansible.builtin.template: 5 | src: "resolver.d/{{ template_name | default(resolver_name) }}.yaml" 6 | dest: "/etc/g3proxy/{{ daemon_group }}/resolver.d/{{ resolver_name }}.yaml" 7 | owner: root 8 | group: root 9 | mode: "0644" 10 | notify: Reload resolver {{ resolver_name }} 11 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/tasks/config-server.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: "Install server conf for {{ server_name }}" 4 | ansible.builtin.template: 5 | src: "server.d/{{ template_name | default(server_name) }}.yaml" 6 | dest: "/etc/g3proxy/{{ daemon_group }}/server.d/{{ server_name }}.yaml" 7 | owner: root 8 | group: root 9 | mode: "0644" 10 | notify: Reload server {{ server_name }} 11 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/tasks/config-user-group.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: "Install user group conf {{ user_group_name }}" 4 | ansible.builtin.template: 5 | src: "user-group.d/{{ template_name | default(user_group_name) }}.yaml" 6 | dest: "/etc/g3proxy/{{ daemon_group }}/user-group.d/{{ user_group_name }}.yaml" 7 | owner: root 8 | group: root 9 | mode: "0644" 10 | notify: Reload user group {{ user_group_name }} 11 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/tasks/deploy-apt.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Update apt cache 4 | ansible.builtin.apt: 5 | update_cache: true 6 | ignore_errors: true 7 | 8 | - name: Install proxy package 9 | ansible.builtin.apt: 10 | name: g3proxy 11 | state: latest 12 | notify: Systemd daemon reload 13 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/tasks/deploy-dnf.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Install proxy package 4 | ansible.builtin.dnf: 5 | name: g3proxy 6 | state: latest 7 | notify: Systemd daemon reload 8 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/tasks/deploy-yum.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Install proxy package 4 | ansible.builtin.yum: 5 | name: g3proxy 6 | state: latest 7 | notify: Systemd daemon reload 8 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/tasks/deploy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Deploy via apt 4 | ansible.builtin.include_tasks: deploy-apt.yml 5 | when: ansible_pkg_mgr == "apt" 6 | 7 | - name: Deploy via yum 8 | ansible.builtin.include_tasks: deploy-yum.yml 9 | when: ansible_pkg_mgr == "yum" 10 | 11 | - name: Deploy via dnf 12 | ansible.builtin.include_tasks: deploy-dnf.yml 13 | when: ansible_pkg_mgr == "dnf" 14 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/tasks/restart.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: "Test config file for g3proxy instance {{ daemon_group }}" 4 | ansible.builtin.command: 5 | cmd: "g3proxy -t -c /etc/g3proxy/{{ daemon_group }}/main.yaml" 6 | register: check 7 | changed_when: check.rc == 0 8 | 9 | - name: "Restart g3proxy instance {{ daemon_group }}" 10 | ansible.builtin.systemd: 11 | name: "g3proxy@{{ daemon_group }}.service" 12 | state: restarted 13 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/tasks/start-after-deploy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: "Test config file for g3proxy instance {{ daemon_group }}" 4 | ansible.builtin.command: 5 | cmd: "g3proxy -t -c /etc/g3proxy/{{ daemon_group }}/main.yaml" 6 | register: check 7 | changed_when: check.rc == 0 8 | 9 | - name: "Start g3proxy instance {{ daemon_group }}" 10 | ansible.builtin.systemd: 11 | name: "g3proxy@{{ daemon_group }}.service" 12 | state: started 13 | enabled: true 14 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/tasks/stop.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: "Test config file for g3proxy instance {{ daemon_group }}" 4 | ansible.builtin.command: 5 | cmd: "g3proxy -t -c /etc/g3proxy/{{ daemon_group }}/main.yaml" 6 | register: check 7 | changed_when: check.rc == 0 8 | 9 | - name: "Restart g3proxy instance {{ daemon_group }}" 10 | ansible.builtin.systemd: 11 | name: "g3proxy@{{ daemon_group }}.service" 12 | state: stopped 13 | -------------------------------------------------------------------------------- /ansible/roles/g3proxy/templates/logrotate.d/g3proxy: -------------------------------------------------------------------------------- 1 | 2 | {{ proxy_log_dir }}/*/*.log { 3 | rotate {{ proxy_log_rotate_count }} 4 | daily 5 | missingok 6 | notifempty 7 | minsize {{ proxy_log_rotate_minsize }} 8 | compress 9 | {% if proxy_log_delaycompress is defined and proxy_log_delaycompress|bool %} 10 | delaycompress 11 | {% endif %} 12 | sharedscripts 13 | postrotate 14 | /usr/lib/rsyslog/rsyslog-rotate 15 | endscript 16 | } 17 | 18 | -------------------------------------------------------------------------------- /ansible/roles/rsyslog/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Restart rsyslog 4 | ansible.builtin.systemd: 5 | name: rsyslog.service 6 | state: restarted 7 | -------------------------------------------------------------------------------- /ansible/roles/rsyslog/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: "Check if the hosts are allowed to run role {{ role_name }}" 4 | ansible.builtin.fail: 5 | msg: "This host is not allowed to run role {{ role_name }}" 6 | when: role_name not in allowed_roles 7 | tags: 8 | - always 9 | 10 | - name: Upgrade rsyslog and plugins 11 | ansible.builtin.import_tasks: upgrade.yml 12 | tags: 13 | - never 14 | - upgrade 15 | -------------------------------------------------------------------------------- /ansible/roles/rsyslog/tasks/upgrade-apt.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Update apt cache 4 | ansible.builtin.apt: 5 | update_cache: true 6 | 7 | - name: Install the latest version of rsyslog 8 | ansible.builtin.apt: 9 | name: rsyslog 10 | state: latest 11 | notify: Restart rsyslog 12 | -------------------------------------------------------------------------------- /ansible/roles/rsyslog/tasks/upgrade-dnf.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Install the latest version of rsyslog 4 | ansible.builtin.dnf: 5 | name: rsyslog 6 | state: latest 7 | notify: Restart rsyslog 8 | 9 | - name: Install the latest version of rsyslog-mmjsonparse 10 | ansible.builtin.dnf: 11 | name: rsyslog-mmjsonparse 12 | state: latest 13 | notify: Restart rsyslog 14 | -------------------------------------------------------------------------------- /ansible/roles/rsyslog/tasks/upgrade-yum.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Install the latest version of rsyslog 4 | ansible.builtin.yum: 5 | name: rsyslog 6 | state: latest 7 | notify: Restart rsyslog 8 | 9 | - name: Install the latest version of rsyslog-mmjsonparse 10 | ansible.builtin.yum: 11 | name: rsyslog-mmjsonparse 12 | state: latest 13 | notify: Restart rsyslog 14 | -------------------------------------------------------------------------------- /ansible/roles/rsyslog/tasks/upgrade.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Upgrade via apt 4 | ansible.builtin.include_tasks: upgrade-apt.yml 5 | when: ansible_pkg_mgr == "apt" 6 | 7 | - name: Upgrade via yum 8 | ansible.builtin.include_tasks: upgrade-yum.yml 9 | when: ansible_pkg_mgr == "yum" 10 | 11 | - name: Upgrade via dnf 12 | ansible.builtin.include_tasks: upgrade-dnf.yml 13 | when: ansible_pkg_mgr == "dnf" 14 | -------------------------------------------------------------------------------- /ansible/roles/sysconf-idc/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Apply proxy sysctl config 4 | ansible.builtin.command: 5 | cmd: sysctl -p /etc/sysctl.d/99-proxy.conf 6 | register: apply 7 | changed_when: apply.rc == 0 8 | 9 | - name: Dearmor g3 apt gpg key 10 | ansible.builtin.shell: 11 | cmd: cat /etc/apt/keyrings/g3.gpg.ascii | gpg --dearmor -o /etc/apt/keyrings/g3.gpg 12 | register: dearmor 13 | changed_when: dearmor.rc == 0 14 | -------------------------------------------------------------------------------- /ansible/roles/sysconf-idc/tasks/config-repo.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Config apt repo 4 | ansible.builtin.include_tasks: config-apt.yml 5 | when: ansible_pkg_mgr == "apt" 6 | 7 | - name: Config yum repo 8 | ansible.builtin.include_tasks: config-yum.yml 9 | when: ansible_pkg_mgr == "yum" or ansible_pkg_mgr == "dnf" 10 | -------------------------------------------------------------------------------- /ansible/roles/sysconf-idc/tasks/config-sysctl.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Install proxy sysctl config 4 | ansible.builtin.template: 5 | src: sysctl.d/99-proxy.conf 6 | dest: /etc/sysctl.d/99-proxy.conf 7 | owner: root 8 | group: root 9 | mode: "0644" 10 | notify: 11 | - Apply proxy sysctl config 12 | -------------------------------------------------------------------------------- /ansible/roles/sysconf-idc/tasks/config-yum.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Add G3 repo 4 | ansible.builtin.yum_repository: 5 | name: g3 6 | description: G3 repo 7 | baseurl: https://dl.cloudsmith.io/public/g3-oqh/g3-rolling/rpm/el/$releasever/$basearch 8 | gpgkey: https://dl.cloudsmith.io/public/g3-oqh/g3-rolling/gpg.5AC77C44E1B53433.key 9 | enabled: true 10 | proxy: "{{ g3_repo_proxy | default('_none_') }}" 11 | -------------------------------------------------------------------------------- /ansible/roles/sysconf-idc/templates/apt.conf.d/80g3-proxy: -------------------------------------------------------------------------------- 1 | 2 | Acquire::https { 3 | Proxy::dl.cloudsmith.io "{{ g3_repo_proxy }}"; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /ansible/rsyslog.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - hosts: "{{ group | default('g3proxy') }}" 4 | roles: 5 | - rsyslog 6 | -------------------------------------------------------------------------------- /ansible/sysconf-idc.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - hosts: "{{ group | default('g3proxy') }}" 4 | roles: 5 | - sysconf-idc 6 | environment: "{{ ansible_run_env|default('{}') }}" 7 | -------------------------------------------------------------------------------- /deny.toml: -------------------------------------------------------------------------------- 1 | 2 | [licenses] 3 | allow = [ 4 | "MIT", 5 | "Apache-2.0", 6 | "Apache-2.0 WITH LLVM-exception", 7 | "BSD-2-Clause", 8 | "BSD-3-Clause", 9 | "BSL-1.0", 10 | "CDLA-Permissive-2.0", 11 | "ISC", 12 | "MPL-2.0", 13 | "Unicode-3.0", 14 | "Zlib", 15 | ] 16 | -------------------------------------------------------------------------------- /g3bench/build.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use std::env; 7 | 8 | fn main() { 9 | g3_build_env::check_basic(); 10 | g3_build_env::check_openssl(); 11 | g3_build_env::check_rustls_provider(); 12 | 13 | if env::var("CARGO_FEATURE_QUIC").is_ok() { 14 | println!("cargo:rustc-env=G3_QUIC_FEATURE=quinn"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /g3bench/debian/changelog: -------------------------------------------------------------------------------- 1 | g3bench (0.9.4-1) UNRELEASED; urgency=medium 2 | 3 | * New upstream release. 4 | 5 | -- G3bench Maintainers Thu, 27 Mar 2025 16:58:01 +0800 6 | -------------------------------------------------------------------------------- /g3bench/debian/compat: -------------------------------------------------------------------------------- 1 | 13 2 | -------------------------------------------------------------------------------- /g3bench/debian/control: -------------------------------------------------------------------------------- 1 | Source: g3bench 2 | Section: net 3 | Priority: optional 4 | Maintainer: G3bench Maintainers 5 | Build-Depends: debhelper 6 | Standards-Version: 3.9.8 7 | Homepage: https://github.com/bytedance/g3 8 | 9 | Package: g3bench 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends} 12 | Recommends: ca-certificates 13 | Description: G3 Benchmark Tool 14 | -------------------------------------------------------------------------------- /g3bench/debian/g3bench.docs: -------------------------------------------------------------------------------- 1 | LICENSE 2 | LICENSE-BUNDLED 3 | LICENSE-FOREIGN 4 | -------------------------------------------------------------------------------- /g3bench/debian/g3bench.install: -------------------------------------------------------------------------------- 1 | usr/bin/g3bench 2 | -------------------------------------------------------------------------------- /g3bench/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /g3bench/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod module; 7 | mod opts; 8 | mod progress; 9 | 10 | pub mod build; 11 | pub mod target; 12 | pub mod worker; 13 | 14 | pub use opts::{ProcArgs, add_global_args, parse_global_args}; 15 | -------------------------------------------------------------------------------- /g3bench/src/module/http/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod stats; 7 | pub(crate) use stats::{HttpHistogram, HttpHistogramRecorder, HttpRuntimeStats}; 8 | -------------------------------------------------------------------------------- /g3bench/src/module/http/stats/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod histogram; 7 | mod runtime; 8 | 9 | pub(crate) use histogram::{HttpHistogram, HttpHistogramRecorder}; 10 | pub(crate) use runtime::HttpRuntimeStats; 11 | -------------------------------------------------------------------------------- /g3bench/src/module/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub(crate) mod socket; 7 | 8 | pub(crate) mod proxy_protocol; 9 | 10 | pub(crate) mod http; 11 | 12 | pub(crate) mod openssl; 13 | pub(crate) mod rustls; 14 | 15 | pub(crate) mod ssl; 16 | -------------------------------------------------------------------------------- /g3bench/src/module/ssl/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod stats; 7 | pub(crate) use stats::{SslHistogram, SslHistogramRecorder, SslRuntimeStats, SslSessionStats}; 8 | -------------------------------------------------------------------------------- /g3bench/src/module/ssl/stats/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod runtime; 7 | pub(crate) use runtime::SslRuntimeStats; 8 | 9 | mod session; 10 | pub(crate) use session::SslSessionStats; 11 | 12 | mod histogram; 13 | pub(crate) use histogram::{SslHistogram, SslHistogramRecorder}; 14 | -------------------------------------------------------------------------------- /g3bench/src/target/dns/stats/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod runtime; 7 | pub(crate) use runtime::DnsRuntimeStats; 8 | 9 | mod histogram; 10 | pub(crate) use histogram::{DnsHistogram, DnsHistogramRecorder}; 11 | -------------------------------------------------------------------------------- /g3bench/src/target/keyless/cloudflare/connection/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::{KeylessLocalError, KeylessRequest, KeylessResponse, KeylessResponseError}; 7 | 8 | mod multiplex; 9 | pub(super) use multiplex::MultiplexTransfer; 10 | 11 | mod simplex; 12 | pub(super) use simplex::SimplexTransfer; 13 | -------------------------------------------------------------------------------- /g3bench/src/target/keyless/cloudflare/message/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod request; 7 | pub(crate) use request::{KeylessRequest, KeylessRequestBuilder}; 8 | 9 | mod response; 10 | pub(crate) use response::{KeylessLocalError, KeylessResponse, KeylessResponseError}; 11 | 12 | const MESSAGE_HEADER_LENGTH: usize = 8; 13 | const MESSAGE_PADDED_LENGTH: usize = 1024; 14 | const ITEM_HEADER_LENGTH: usize = 3; 15 | -------------------------------------------------------------------------------- /g3bench/src/target/keyless/cloudflare/stats/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod runtime; 7 | pub(crate) use runtime::KeylessRuntimeStats; 8 | 9 | mod histogram; 10 | pub(crate) use histogram::{KeylessHistogram, KeylessHistogramRecorder}; 11 | -------------------------------------------------------------------------------- /g3bench/src/target/keyless/openssl/stats/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod runtime; 7 | pub(crate) use runtime::KeylessRuntimeStats; 8 | 9 | mod histogram; 10 | pub(crate) use histogram::{KeylessHistogram, KeylessHistogramRecorder}; 11 | -------------------------------------------------------------------------------- /g3fcgen/build.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | fn main() { 7 | g3_build_env::check_basic(); 8 | g3_build_env::check_openssl(); 9 | } 10 | -------------------------------------------------------------------------------- /g3fcgen/debian/changelog: -------------------------------------------------------------------------------- 1 | g3fcgen (0.8.3-1) UNRELEASED; urgency=medium 2 | 3 | * New upstream release. 4 | 5 | -- G3fcgen Maintainers Fri, 03 Jan 2025 11:35:12 +0800 6 | -------------------------------------------------------------------------------- /g3fcgen/debian/compat: -------------------------------------------------------------------------------- 1 | 13 2 | -------------------------------------------------------------------------------- /g3fcgen/debian/control: -------------------------------------------------------------------------------- 1 | Source: g3fcgen 2 | Section: net 3 | Priority: optional 4 | Maintainer: G3fcgen Maintainers 5 | Build-Depends: debhelper, pkg-config, libssl-dev 6 | Standards-Version: 3.9.8 7 | Homepage: https://github.com/bytedance/g3 8 | 9 | Package: g3fcgen 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends} 12 | Description: Fake Certificate Generator for G3 Project 13 | -------------------------------------------------------------------------------- /g3fcgen/debian/g3fcgen.docs: -------------------------------------------------------------------------------- 1 | LICENSE 2 | LICENSE-BUNDLED 3 | LICENSE-FOREIGN 4 | -------------------------------------------------------------------------------- /g3fcgen/debian/g3fcgen.install: -------------------------------------------------------------------------------- 1 | usr/bin/g3fcgen 2 | -------------------------------------------------------------------------------- /g3fcgen/debian/g3fcgen@.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=G3 X.509 Certificates Generation Service at %i 3 | 4 | [Service] 5 | Type=exec 6 | EnvironmentFile=-/etc/g3fcgen/%i/env 7 | ExecStart=/usr/bin/g3fcgen -c /etc/g3fcgen/%i/ -s -G %i 8 | ExecStop=/bin/kill -INT $MAINPID 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | -------------------------------------------------------------------------------- /g3fcgen/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /g3fcgen/docker/alpine.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust:alpine AS builder 2 | WORKDIR /usr/src/g3 3 | COPY . . 4 | RUN apk add --no-cache musl-dev openssl-dev 5 | ENV RUSTFLAGS="-Ctarget-feature=-crt-static" 6 | RUN cargo build --profile release-lto -p g3fcgen 7 | 8 | FROM alpine:latest 9 | RUN apk add --no-cache libgcc 10 | COPY --from=builder /usr/src/g3/target/release-lto/g3fcgen /usr/bin/g3fcgen 11 | ENTRYPOINT ["/usr/bin/g3fcgen"] 12 | CMD ["-Vvv"] 13 | -------------------------------------------------------------------------------- /g3fcgen/docker/debian.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust:bookworm AS builder 2 | WORKDIR /usr/src/g3 3 | COPY . . 4 | RUN cargo build --profile release-lto --features vendored-openssl -p g3fcgen 5 | 6 | FROM debian:bookworm-slim 7 | COPY --from=builder /usr/src/g3/target/release-lto/g3fcgen /usr/bin/g3fcgen 8 | ENTRYPOINT ["/usr/bin/g3fcgen"] 9 | CMD ["-Vvv"] 10 | -------------------------------------------------------------------------------- /g3fcgen/examples/simple/G3-test.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgRTPFTS5LzR2zxd+2 3 | UJckF2ily4T/RGZEYUSFztThq3GhRANCAARcgdDHVt4tq166nnMFmrrTTu+SVg+y 4 | HPi8FFtXxCWfj3+TCKOmgOCrEn0n0Umt7Pejl8/KL0QYMEiC2cQuW5dq 5 | -----END PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /g3fcgen/examples/simple/g3fcgen.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | runtime: 4 | thread_number: 1 5 | 6 | backend: 7 | ca_certificate: G3-test.crt 8 | ca_private_key: G3-test.key 9 | -------------------------------------------------------------------------------- /g3fcgen/service/g3fcgen@.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=G3 X.509 Certificates Generation Service at %i 3 | 4 | [Service] 5 | Type=exec 6 | EnvironmentFile=-/etc/g3fcgen/%i/env 7 | ExecStart=/usr/bin/g3fcgen -c /etc/g3fcgen/%i/ -s -G %i 8 | ExecStop=/bin/kill -INT $MAINPID 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | -------------------------------------------------------------------------------- /g3fcgen/src/stat/metrics/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub(super) mod backend; 7 | pub(super) mod frontend; 8 | -------------------------------------------------------------------------------- /g3iploc/CHANGELOG: -------------------------------------------------------------------------------- 1 | 2 | v0.2.0: 3 | - Feature: listen to Ctrl-C event and shutdown gracefully 4 | - Feature: allow to run in multiple worker threads 5 | 6 | v0.1.0: 7 | - Initial release 8 | -------------------------------------------------------------------------------- /g3iploc/build.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | fn main() { 7 | g3_build_env::check_basic(); 8 | } 9 | -------------------------------------------------------------------------------- /g3iploc/debian/changelog: -------------------------------------------------------------------------------- 1 | g3iploc (0.2.0-1) UNRELEASED; urgency=medium 2 | 3 | * New upstream release. 4 | 5 | -- G3iploc Maintainers Fri, 03 Jan 2025 11:40:25 +0800 6 | -------------------------------------------------------------------------------- /g3iploc/debian/compat: -------------------------------------------------------------------------------- 1 | 13 2 | -------------------------------------------------------------------------------- /g3iploc/debian/control: -------------------------------------------------------------------------------- 1 | Source: g3iploc 2 | Section: net 3 | Priority: optional 4 | Maintainer: G3iploc Maintainers 5 | Build-Depends: debhelper 6 | Standards-Version: 3.9.8 7 | Homepage: https://github.com/bytedance/g3 8 | 9 | Package: g3iploc 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends} 12 | Description: IP Locate Service for G3 Project 13 | -------------------------------------------------------------------------------- /g3iploc/debian/g3iploc.docs: -------------------------------------------------------------------------------- 1 | LICENSE 2 | LICENSE-BUNDLED 3 | LICENSE-FOREIGN 4 | -------------------------------------------------------------------------------- /g3iploc/debian/g3iploc.install: -------------------------------------------------------------------------------- 1 | usr/bin/g3iploc 2 | usr/bin/g3iploc-db 3 | -------------------------------------------------------------------------------- /g3iploc/debian/g3iploc@.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=G3 IP Locate Service at %i 3 | 4 | [Service] 5 | Type=exec 6 | EnvironmentFile=-/etc/g3iploc/%i/env 7 | ExecStart=/usr/bin/g3iploc -c /etc/g3iploc/%i/ -s -G %i 8 | ExecStop=/bin/kill -INT $MAINPID 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | -------------------------------------------------------------------------------- /g3iploc/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /g3iploc/docker/alpine.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust:alpine AS builder 2 | WORKDIR /usr/src/g3 3 | COPY . . 4 | RUN apk add --no-cache musl-dev 5 | ENV RUSTFLAGS="-Ctarget-feature=-crt-static" 6 | RUN cargo build --profile release-lto -p g3iploc 7 | 8 | FROM alpine:latest 9 | RUN apk add --no-cache libgcc 10 | COPY --from=builder /usr/src/g3/target/release-lto/g3iploc /usr/bin/g3iploc 11 | ENTRYPOINT ["/usr/bin/g3iploc"] 12 | CMD ["-Vvv"] 13 | -------------------------------------------------------------------------------- /g3iploc/docker/debian.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust:bookworm AS builder 2 | WORKDIR /usr/src/g3 3 | COPY . . 4 | RUN cargo build --profile release-lto -p g3iploc 5 | 6 | FROM debian:bookworm-slim 7 | COPY --from=builder /usr/src/g3/target/release-lto/g3iploc /usr/bin/g3iploc 8 | ENTRYPOINT ["/usr/bin/g3iploc"] 9 | CMD ["-Vvv"] 10 | -------------------------------------------------------------------------------- /g3iploc/examples/basic/g3iploc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | geoip_db: 4 | country: simple.csv 5 | -------------------------------------------------------------------------------- /g3iploc/examples/basic/simple.csv: -------------------------------------------------------------------------------- 1 | #network,country 2 | 1.1.1.0/24,US 3 | -------------------------------------------------------------------------------- /g3iploc/service/g3iploc@.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=G3 IP Locate Service at %i 3 | 4 | [Service] 5 | Type=exec 6 | EnvironmentFile=-/etc/g3iploc/%i/env 7 | ExecStart=/usr/bin/g3iploc -c /etc/g3iploc/%i/ -s -G %i 8 | ExecStop=/bin/kill -INT $MAINPID 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | -------------------------------------------------------------------------------- /g3iploc/src/stat/metrics/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub(super) mod frontend; 7 | -------------------------------------------------------------------------------- /g3iploc/utils/db/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3iploc-db" 3 | version = "0.1.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | anyhow.workspace = true 11 | clap.workspace = true 12 | ip_network_table.workspace = true 13 | g3-geoip-db.workspace = true 14 | -------------------------------------------------------------------------------- /g3keymess/build.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | fn main() { 7 | g3_build_env::check_basic(); 8 | g3_build_env::check_openssl(); 9 | } 10 | -------------------------------------------------------------------------------- /g3keymess/debian/changelog: -------------------------------------------------------------------------------- 1 | g3keymess (0.4.2-1) UNRELEASED; urgency=medium 2 | 3 | * New upstream release. 4 | 5 | -- G3keymess Maintainers Tue, 13 May 2025 18:57:21 +0800 6 | -------------------------------------------------------------------------------- /g3keymess/debian/compat: -------------------------------------------------------------------------------- 1 | 13 2 | -------------------------------------------------------------------------------- /g3keymess/debian/control: -------------------------------------------------------------------------------- 1 | Source: g3keymess 2 | Section: net 3 | Priority: optional 4 | Maintainer: G3keymess Maintainers 5 | Build-Depends: debhelper, pkg-config, libssl-dev 6 | Standards-Version: 3.9.8 7 | Homepage: https://github.com/bytedance/g3 8 | 9 | Package: g3keymess 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends} 12 | Recommends: systemd 13 | Description: Keyless server for G3 Project 14 | -------------------------------------------------------------------------------- /g3keymess/debian/g3keymess.docs: -------------------------------------------------------------------------------- 1 | LICENSE 2 | LICENSE-BUNDLED 3 | LICENSE-FOREIGN 4 | -------------------------------------------------------------------------------- /g3keymess/debian/g3keymess.install: -------------------------------------------------------------------------------- 1 | usr/bin/g3keymess 2 | usr/bin/g3keymess-ctl 3 | -------------------------------------------------------------------------------- /g3keymess/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /g3keymess/examples/simple_openssl/g3keymess.yaml: -------------------------------------------------------------------------------- 1 | 2 | log: journal 3 | 4 | stat: 5 | target: 6 | udp: 127.0.0.1:8125 7 | prefix: g3keymess 8 | emit_duration: 200ms 9 | 10 | server: 11 | - name: default 12 | listen: "[::]:1300" 13 | extra_metrics_tags: 14 | cluster: default 15 | 16 | store: 17 | - name: local 18 | type: local 19 | dir: keys 20 | -------------------------------------------------------------------------------- /g3keymess/proto/.gitignore: -------------------------------------------------------------------------------- 1 | gen 2 | -------------------------------------------------------------------------------- /g3keymess/proto/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3keymess-proto" 3 | version = "0.1.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | capnp.workspace = true 11 | 12 | [build-dependencies] 13 | capnpc.workspace = true 14 | -------------------------------------------------------------------------------- /g3keymess/proto/schema/server.capnp: -------------------------------------------------------------------------------- 1 | @0xdf328b7e02123e83; 2 | 3 | using Types = import "types.capnp"; 4 | 5 | struct ServerStats { 6 | online @0 :Bool; 7 | aliveTaskCount @1 :Int32; 8 | totalTaskCount @2 :UInt64; 9 | } 10 | 11 | interface ServerControl { 12 | status @0 () -> (status :ServerStats); 13 | 14 | addMetricsTag @1 (name :Text, value :Text) -> (result :Types.OperationResult); 15 | getListenAddr @2 () -> (addr :Text); 16 | } 17 | -------------------------------------------------------------------------------- /g3keymess/proto/schema/types.capnp: -------------------------------------------------------------------------------- 1 | @0x887484502fecbe14; 2 | 3 | struct Error { 4 | code @0 :Int32 = -1; 5 | reason @1 :Text; 6 | } 7 | 8 | struct OperationResult { 9 | union { 10 | ok @0 :Text; 11 | err @1 :Error; 12 | } 13 | } 14 | 15 | struct FetchResult(Data) { 16 | union { 17 | data @0 :Data; 18 | err @1 :Error; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /g3keymess/service/generate_systemd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | CUR_DIR=$(dirname "${0}") 6 | 7 | SYSTEMD_VERSION=$(pkg-config --modversion systemd | awk -F'.' '{print $1}') 8 | 9 | if [ "${SYSTEMD_VERSION}" -lt "240" ] 10 | then 11 | cp "${CUR_DIR}/g3keymess@.pre240.service" "${CUR_DIR}/g3keymess@.service" 12 | else 13 | cp "${CUR_DIR}/g3keymess@.latest.service" "${CUR_DIR}/g3keymess@.service" 14 | fi 15 | 16 | -------------------------------------------------------------------------------- /g3keymess/src/control/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod bridge; 7 | 8 | mod quit; 9 | pub use quit::QuitActor; 10 | 11 | mod upgrade; 12 | pub use upgrade::UpgradeActor; 13 | 14 | mod local; 15 | pub use local::{DaemonController, UniqueController}; 16 | 17 | pub mod capnp; 18 | -------------------------------------------------------------------------------- /g3keymess/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod backend; 7 | pub mod config; 8 | pub mod control; 9 | pub mod opts; 10 | pub mod register; 11 | pub mod serve; 12 | pub mod signal; 13 | pub mod stat; 14 | pub mod store; 15 | 16 | mod build; 17 | mod log; 18 | mod protocol; 19 | -------------------------------------------------------------------------------- /g3keymess/src/log/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod shared; 7 | 8 | pub(crate) mod request; 9 | pub(crate) mod task; 10 | 11 | const LOG_TYPE_TASK: &str = "Task"; 12 | const LOG_TYPE_REQUEST: &str = "Request"; 13 | -------------------------------------------------------------------------------- /g3keymess/src/stat/metrics/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub(super) mod server; 7 | -------------------------------------------------------------------------------- /g3mkcert/CHANGELOG: -------------------------------------------------------------------------------- 1 | 2 | v0.1.0: 3 | - Initial release 4 | -------------------------------------------------------------------------------- /g3mkcert/build.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | fn main() { 7 | g3_build_env::check_basic(); 8 | g3_build_env::check_openssl(); 9 | } 10 | -------------------------------------------------------------------------------- /g3mkcert/debian/changelog: -------------------------------------------------------------------------------- 1 | g3mkcert (0.1.0-1) UNRELEASED; urgency=medium 2 | 3 | * New upstream release. 4 | 5 | -- G3mkcert Maintainers Tue, 11 Apr 2023 10:46:27 +0800 6 | -------------------------------------------------------------------------------- /g3mkcert/debian/compat: -------------------------------------------------------------------------------- 1 | 13 2 | -------------------------------------------------------------------------------- /g3mkcert/debian/control: -------------------------------------------------------------------------------- 1 | Source: g3mkcert 2 | Section: net 3 | Priority: optional 4 | Maintainer: G3mkcert Maintainers 5 | Build-Depends: debhelper 6 | Standards-Version: 3.9.8 7 | Homepage: https://github.com/bytedance/g3 8 | 9 | Package: g3mkcert 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends} 12 | Description: Tool to make certificates from G3 Project 13 | -------------------------------------------------------------------------------- /g3mkcert/debian/g3mkcert.docs: -------------------------------------------------------------------------------- 1 | LICENSE 2 | LICENSE-BUNDLED 3 | LICENSE-FOREIGN 4 | -------------------------------------------------------------------------------- /g3mkcert/debian/g3mkcert.install: -------------------------------------------------------------------------------- 1 | usr/bin/g3mkcert 2 | -------------------------------------------------------------------------------- /g3mkcert/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /g3proxy/debian/changelog: -------------------------------------------------------------------------------- 1 | g3proxy (1.11.6-1) UNRELEASED; urgency=medium 2 | 3 | * New upstream release. 4 | 5 | -- G3proxy Maintainers Thu, 29 May 2025 22:33:08 +0800 6 | -------------------------------------------------------------------------------- /g3proxy/debian/compat: -------------------------------------------------------------------------------- 1 | 13 2 | -------------------------------------------------------------------------------- /g3proxy/debian/g3proxy.docs: -------------------------------------------------------------------------------- 1 | LICENSE 2 | LICENSE-BUNDLED 3 | LICENSE-FOREIGN 4 | sphinx/g3proxy/_build/html 5 | -------------------------------------------------------------------------------- /g3proxy/debian/g3proxy.install: -------------------------------------------------------------------------------- 1 | usr/bin/g3proxy 2 | usr/bin/g3proxy-ctl 3 | usr/bin/g3proxy-ftp 4 | usr/bin/g3proxy-lua 5 | -------------------------------------------------------------------------------- /g3proxy/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /g3proxy/examples/README.md: -------------------------------------------------------------------------------- 1 | This directory contains config examples for g3proxy. 2 | -------------------------------------------------------------------------------- /g3proxy/examples/benchmark/server.d/bench.example.net-ec256.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgWCc9lXboFSkeGShT 3 | j/numhJrNk14PLjHnHsR9TbAhTehRANCAASI/wmJz8euGB/ajEqFz7Nli8qRdsIN 4 | w1qRUm/w8HNDGHERDzuH2Q2JHWuHVB23A7P7vRRORKD27/dzkwubgJvG 5 | -----END PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /g3proxy/examples/benchmark/server.d/http_proxy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: http_proxy 4 | type: HttpProxy 5 | 6 | escaper: default 7 | 8 | listen: 9 | address: "[::]:8080" 10 | backlog: 4096 11 | listen_in_worker: true 12 | -------------------------------------------------------------------------------- /g3proxy/examples/benchmark/server.d/https_proxy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: https_proxy 4 | type: HttpProxy 5 | 6 | escaper: default 7 | 8 | listen: 9 | address: "[::]:9080" 10 | backlog: 4096 11 | listen_in_worker: true 12 | 13 | tls_server: 14 | cert_pairs: 15 | certificate: "bench.example.net-ec256.crt" 16 | private_key: "bench.example.net-ec256.key" 17 | -------------------------------------------------------------------------------- /g3proxy/examples/benchmark/server.d/tcp_stream.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: tcp_stream 4 | type: TcpStream 5 | 6 | escaper: default 7 | 8 | listen: 9 | address: "[::]:8090" 10 | backlog: 4096 11 | listen_in_worker: true 12 | 13 | upstream: "127.0.0.1:80" 14 | -------------------------------------------------------------------------------- /g3proxy/examples/benchmark/server.d/tls_stream.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: tls_stream 4 | type: TlsStream 5 | 6 | escaper: default 7 | 8 | listen: 9 | address: "[::]:9090" 10 | backlog: 4096 11 | listen_in_worker: true 12 | 13 | tls_server: 14 | cert_pairs: 15 | certificate: "bench.example.net-ec256.crt" 16 | private_key: "bench.example.net-ec256.key" 17 | 18 | upstream: "127.0.0.1:80" 19 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_direct_float/escaper.d/default.yaml: -------------------------------------------------------------------------------- 1 | 2 | name: default 3 | type: DirectFloat 4 | resolver: default 5 | resolve_strategy: IPv4First 6 | 7 | cache_ipv4: /tmp/g3proxy-test-direct-float/cache_ipv4 8 | cache_ipv6: /tmp/g3proxy-test-direct-float/cache_ipv6 9 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_direct_float/g3proxy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | runtime: 3 | thread_number: 2 4 | 5 | controller: 6 | local: 7 | recv_timeout: 30 8 | send_timeout: 1 9 | 10 | server: server.d/ 11 | 12 | resolver: resolver.d/ 13 | 14 | escaper: escaper.d/ 15 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_direct_float/resolver.d/default.yaml: -------------------------------------------------------------------------------- 1 | name: default 2 | type: c-ares 3 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_direct_float/server.d/default.yaml: -------------------------------------------------------------------------------- 1 | 2 | name: default 3 | escaper: default 4 | type: http_proxy 5 | listen: 6 | address: "[::]:10086" 7 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_https_proxy/escaper.d/default.yaml: -------------------------------------------------------------------------------- 1 | name: default 2 | type: direct_fixed 3 | no_ipv6: true 4 | resolver: default 5 | resolve_strategy: IPv4Only 6 | tcp_sock_speed_limit: 80M 7 | udp_sock_speed_limit: 10M 8 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_https_proxy/g3proxy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | runtime: 3 | thread_number: 2 4 | 5 | controller: 6 | local: 7 | recv_timeout: 30 8 | send_timeout: 1 9 | 10 | server: server.d/ 11 | 12 | resolver: resolver.d/ 13 | 14 | escaper: escaper.d/ 15 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_https_proxy/resolver.d/default.yaml: -------------------------------------------------------------------------------- 1 | name: default 2 | type: c-ares 3 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_https_proxy/server.d/test-tls.yaml: -------------------------------------------------------------------------------- 1 | name: test-tls 2 | escaper: default 3 | type: http_proxy 4 | tls: 5 | certificate: cert.pem 6 | private_key: key.pem 7 | listen: 8 | address: "[::]:10087" 9 | tcp_sock_speed_limit: 100M 10 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_intelli_proxy/escaper.d/default.yaml: -------------------------------------------------------------------------------- 1 | name: default 2 | type: direct_fixed 3 | no_ipv6: true 4 | resolver: default 5 | resolve_strategy: IPv4Only 6 | tcp_sock_speed_limit: 80M 7 | udp_sock_speed_limit: 10M 8 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_intelli_proxy/g3proxy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | runtime: 3 | thread_number: 2 4 | 5 | controller: 6 | local: 7 | recv_timeout: 30 8 | send_timeout: 1 9 | 10 | server: server.d/ 11 | 12 | resolver: resolver.d/ 13 | 14 | escaper: escaper.d/ 15 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_intelli_proxy/resolver.d/default.yaml: -------------------------------------------------------------------------------- 1 | name: default 2 | type: c-ares 3 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_socks_proxy/escaper.d/default.yaml: -------------------------------------------------------------------------------- 1 | name: default 2 | type: direct_fixed 3 | no_ipv6: true 4 | resolver: default 5 | resolve_strategy: IPv4Only 6 | tcp_sock_speed_limit: 80M 7 | udp_sock_speed_limit: 10M 8 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_socks_proxy/g3proxy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | runtime: 3 | thread_number: 2 4 | 5 | controller: 6 | local: 7 | recv_timeout: 30 8 | send_timeout: 1 9 | 10 | server: server.d/ 11 | 12 | resolver: resolver.d/ 13 | 14 | escaper: escaper.d/ 15 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_socks_proxy/resolver.d/default.yaml: -------------------------------------------------------------------------------- 1 | name: default 2 | type: c-ares 3 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_socks_proxy/server.d/test.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | escaper: default 3 | type: socks_proxy 4 | listen: 5 | address: "[::]:10086" 6 | instance: 2 7 | enable_udp_associate: true 8 | tcp_sock_speed_limit: 100M 9 | udp_sock_speed_limit: 10M 10 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_tcp_stream/escaper.d/default.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: default 3 | type: direct_fixed 4 | bind_ip: "127.0.0.1" 5 | resolver: default 6 | tcp_sock_speed_limit: 80M 7 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_tcp_stream/g3proxy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | runtime: 3 | thread_number: 2 4 | 5 | controller: 6 | local: 7 | recv_timeout: 30 8 | send_timeout: 1 9 | 10 | server: server.d/ 11 | 12 | resolver: resolver.d/ 13 | 14 | escaper: escaper.d/ 15 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_tcp_stream/resolver.d/default.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: default 3 | type: c-ares 4 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_tcp_stream/server.d/test.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: test 3 | escaper: default 4 | type: tcp_stream 5 | listen: 6 | address: "[::1]:10086" 7 | proxy_pass: "127.0.0.1:5201" 8 | tcp_sock_speed_limit: 50M 9 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_user_auth/escaper.d/default.yaml: -------------------------------------------------------------------------------- 1 | 2 | name: default 3 | type: direct_fixed 4 | no_ipv6: true 5 | resolver: default 6 | resolve_strategy: IPv4Only 7 | tcp_sock_speed_limit: 80M 8 | udp_sock_speed_limit: 10M 9 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_user_auth/g3proxy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | runtime: 3 | thread_number: 2 4 | 5 | controller: 6 | local: 7 | recv_timeout: 30 8 | send_timeout: 1 9 | 10 | server: server.d/ 11 | 12 | resolver: resolver.d/ 13 | 14 | escaper: escaper.d/ 15 | 16 | user-group: user-group.d/ 17 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_user_auth/resolver.d/default.yaml: -------------------------------------------------------------------------------- 1 | name: default 2 | type: c-ares 3 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_user_auth/server.d/extra_port.yaml: -------------------------------------------------------------------------------- 1 | name: extra_port 2 | type: plain_tcp_port 3 | listen: 4 | address: "[::]:18118" 5 | server: http 6 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_user_auth/server.d/http.yaml: -------------------------------------------------------------------------------- 1 | name: http 2 | escaper: default 3 | user_group: default 4 | type: http_proxy 5 | listen: 6 | address: "[::]:13128" 7 | tcp_sock_speed_limit: 100M 8 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_user_auth/server.d/intelli.yaml: -------------------------------------------------------------------------------- 1 | name: intelli 2 | type: intelli_proxy 3 | http_server: http 4 | socks_server: socks 5 | listen: 6 | address: "[::]:1810" 7 | instance: 8 8 | -------------------------------------------------------------------------------- /g3proxy/examples/hybrid_user_auth/server.d/socks.yaml: -------------------------------------------------------------------------------- 1 | name: socks 2 | escaper: default 3 | user-group: default 4 | type: socks_proxy 5 | listen: 6 | address: "[::]:11080" 7 | tcp_sock_speed_limit: 100M 8 | -------------------------------------------------------------------------------- /g3proxy/examples/resolver_fail_over/g3proxy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | runtime: 3 | thread_number: 2 4 | 5 | controller: 6 | local: 7 | recv_timeout: 30 8 | send_timeout: 1 9 | 10 | server: 11 | - name: test 12 | escaper: default 13 | type: http_proxy 14 | listen: 15 | address: "[::]:10086" 16 | server_id: test 17 | 18 | resolver: resolver.d 19 | 20 | escaper: 21 | - name: default 22 | type: direct_fixed 23 | no_ipv6: true 24 | resolver: virtual 25 | resolve_strategy: IPv4Only 26 | -------------------------------------------------------------------------------- /g3proxy/examples/resolver_fail_over/resolver.d/alidns.yaml: -------------------------------------------------------------------------------- 1 | 2 | name: alidns 3 | type: c-ares 4 | server: 223.5.5.5 223.6.6.6 5 | -------------------------------------------------------------------------------- /g3proxy/examples/resolver_fail_over/resolver.d/dnspod.yaml: -------------------------------------------------------------------------------- 1 | 2 | name: dnspod 3 | type: c-ares 4 | server: 119.29.29.29 5 | -------------------------------------------------------------------------------- /g3proxy/examples/resolver_fail_over/resolver.d/virtual.yaml: -------------------------------------------------------------------------------- 1 | 2 | name: virtual 3 | type: fail_over 4 | 5 | primary: alidns 6 | standby: dnspod 7 | -------------------------------------------------------------------------------- /g3proxy/examples/simple_to_statsd/dynamic_users.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "foo", 4 | "token": { 5 | "salt": "113323bdab6fd2cc", 6 | "md5": "5c81f2becadde7fa5fde9026652ccc84", 7 | "sha1": "ff9d5c1a14328dd85ee95d4e574bd0558a1dfa96" 8 | } 9 | }, 10 | { 11 | "name": "bar", 12 | "token": { 13 | "salt": "113323bdab6fd2cc", 14 | "md5": "5c81f2becadde7fa5fde9026652ccc84", 15 | "sha1": "ff9d5c1a14328dd85ee95d4e574bd0558a1dfa96" 16 | } 17 | } 18 | ] -------------------------------------------------------------------------------- /g3proxy/examples/simple_user_auth/dynamic_users.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "foo", 4 | "token": { 5 | "salt": "113323bdab6fd2cc", 6 | "md5": "5c81f2becadde7fa5fde9026652ccc84", 7 | "sha1": "ff9d5c1a14328dd85ee95d4e574bd0558a1dfa96" 8 | } 9 | }, 10 | { 11 | "name": "bar", 12 | "token": "$1$rnfSARNK$DJNIbbMpjjSmral92rE3k1" 13 | } 14 | ] -------------------------------------------------------------------------------- /g3proxy/proto/.gitignore: -------------------------------------------------------------------------------- 1 | gen 2 | -------------------------------------------------------------------------------- /g3proxy/proto/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3proxy-proto" 3 | version = "0.1.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | capnp.workspace = true 11 | 12 | [build-dependencies] 13 | capnpc.workspace = true 14 | -------------------------------------------------------------------------------- /g3proxy/proto/schema/escaper.capnp: -------------------------------------------------------------------------------- 1 | @0xcd40f64a57dc11cf; 2 | 3 | using Types = import "types.capnp"; 4 | 5 | interface EscaperControl { 6 | publish @0 (data :Text) -> (result :Types.OperationResult); 7 | } 8 | -------------------------------------------------------------------------------- /g3proxy/proto/schema/resolver.capnp: -------------------------------------------------------------------------------- 1 | @0xd317f85459da5d44; 2 | 3 | enum QueryStrategy { 4 | ipv4First @0; 5 | ipv6First @1; 6 | ipv4Only @2; 7 | ipv6Only @3; 8 | } 9 | 10 | struct QueryResult { 11 | union { 12 | ip @0 :List(Text); 13 | err @1 :Text; 14 | } 15 | } 16 | 17 | interface ResolverControl { 18 | query @0 (domain :Text, strategy :QueryStrategy, resolutionDelay :UInt16 = 50) -> (result :QueryResult); 19 | } 20 | -------------------------------------------------------------------------------- /g3proxy/proto/schema/server.capnp: -------------------------------------------------------------------------------- 1 | @0xa627265c610f61d7; 2 | 3 | struct ServerStats { 4 | online @0 :Bool; 5 | aliveTaskCount @1 :Int32; 6 | totalConnCount @2 :UInt64; 7 | totalTaskCount @3 :UInt64; 8 | } 9 | 10 | interface ServerControl { 11 | status @0 () -> (status :ServerStats); 12 | } 13 | -------------------------------------------------------------------------------- /g3proxy/proto/schema/types.capnp: -------------------------------------------------------------------------------- 1 | @0x9cf25b8f324f3eef; 2 | 3 | struct Error { 4 | code @0 :Int32 = -1; 5 | reason @1 :Text; 6 | } 7 | 8 | struct OperationResult { 9 | union { 10 | ok @0 :Text; 11 | err @1 :Error; 12 | } 13 | } 14 | 15 | struct FetchResult(Data) { 16 | union { 17 | data @0 :Data; 18 | err @1 :Error; 19 | } 20 | } 21 | 22 | struct UtcOffset { 23 | hours @0 :Int8 = 0; 24 | minutes @1 :Int8 = 0; 25 | seconds @2 :Int8 = 0; 26 | } 27 | -------------------------------------------------------------------------------- /g3proxy/proto/schema/user_group.capnp: -------------------------------------------------------------------------------- 1 | @0x9045d8bef5c9e129; 2 | 3 | using Types = import "types.capnp"; 4 | 5 | interface UserGroupControl { 6 | listStaticUser @0 () -> (result :List(Text)); 7 | listDynamicUser @1 () -> (result :List(Text)); 8 | publishDynamicUser @2 (contents :Text) -> (result :Types.OperationResult); 9 | } 10 | -------------------------------------------------------------------------------- /g3proxy/service/generate_systemd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | CUR_DIR=$(dirname "${0}") 6 | 7 | SYSTEMD_VERSION=$(pkg-config --modversion systemd | awk -F'.' '{print $1}') 8 | 9 | if [ "${SYSTEMD_VERSION}" -lt "240" ] 10 | then 11 | cp "${CUR_DIR}/g3proxy@.pre240.service" "${CUR_DIR}/g3proxy@.service" 12 | else 13 | cp "${CUR_DIR}/g3proxy@.latest.service" "${CUR_DIR}/g3proxy@.service" 14 | fi 15 | 16 | -------------------------------------------------------------------------------- /g3proxy/src/config/auth/token/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use g3_types::auth::FastHashedPassPhrase; 7 | use g3_xcrypt::XCryptHash; 8 | 9 | mod json; 10 | mod yaml; 11 | 12 | const CONFIG_KEY_TYPE: &str = "type"; 13 | 14 | #[derive(Clone)] 15 | pub(crate) enum PasswordToken { 16 | Forbidden, 17 | SkipVerify, 18 | FastHash(FastHashedPassPhrase), 19 | XCrypt(XCryptHash), 20 | } 21 | -------------------------------------------------------------------------------- /g3proxy/src/control/bridge/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod reload; 7 | pub(super) use reload::{ 8 | reload_auditor, reload_escaper, reload_resolver, reload_server, reload_user_group, 9 | }; 10 | -------------------------------------------------------------------------------- /g3proxy/src/inspect/http/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod v2; 7 | pub(super) use v2::{H2InterceptObject, H2InterceptionError}; 8 | 9 | mod v1; 10 | pub(crate) use v1::H1InterceptObject; 11 | pub(super) use v1::H1InterceptionError; 12 | -------------------------------------------------------------------------------- /g3proxy/src/inspect/websocket/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod close; 7 | use close::{ClientCloseFrame, ServerCloseFrame}; 8 | 9 | mod h1; 10 | pub(crate) use h1::H1WebsocketInterceptObject; 11 | 12 | mod h2; 13 | pub(crate) use self::h2::H2WebsocketInterceptObject; 14 | -------------------------------------------------------------------------------- /g3proxy/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod audit; 7 | pub mod auth; 8 | pub mod config; 9 | pub mod control; 10 | pub mod escape; 11 | pub mod opts; 12 | pub mod resolve; 13 | pub mod serve; 14 | pub mod signal; 15 | pub mod stat; 16 | 17 | mod build; 18 | mod inspect; 19 | mod log; 20 | mod module; 21 | -------------------------------------------------------------------------------- /g3proxy/src/log/intercept/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use slog::Logger; 7 | 8 | use g3_types::metrics::NodeName; 9 | 10 | pub(crate) fn get_logger(auditor_name: &NodeName) -> Option { 11 | super::audit::get_logger(super::LOG_TYPE_INTERCEPT, auditor_name) 12 | } 13 | -------------------------------------------------------------------------------- /g3proxy/src/module/http_forward/response/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod client; 7 | 8 | pub(crate) use client::HttpProxyClientResponse; 9 | -------------------------------------------------------------------------------- /g3proxy/src/module/http_header/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod custom; 7 | mod standard; 8 | 9 | pub(crate) use custom::{ 10 | dynamic_egress_info, outgoing_ip, remote_connection_info, set_dynamic_egress_info, 11 | set_outgoing_ip, set_remote_connection_info, set_upstream_addr, set_upstream_id, upstream_addr, 12 | }; 13 | pub(crate) use standard::proxy_authorization_basic_pass; 14 | -------------------------------------------------------------------------------- /g3proxy/src/module/http_header/standard.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use base64::prelude::*; 7 | 8 | pub(crate) fn proxy_authorization_basic_pass(userid: &str) -> String { 9 | format!( 10 | "Proxy-Authorization: Basic {}\r\n", 11 | BASE64_STANDARD.encode(format!("{userid}:{}", crate::build::PKG_NAME)) 12 | ) 13 | } 14 | -------------------------------------------------------------------------------- /g3proxy/src/module/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub(crate) mod ftp_over_http; 7 | pub(crate) mod http_forward; 8 | pub(crate) mod http_header; 9 | pub(crate) mod tcp_connect; 10 | pub(crate) mod udp_connect; 11 | pub(crate) mod udp_relay; 12 | -------------------------------------------------------------------------------- /g3proxy/src/resolve/c_ares/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod handle; 7 | mod resolver; 8 | 9 | use handle::CAresResolverHandle; 10 | pub(super) use resolver::CAresResolver; 11 | -------------------------------------------------------------------------------- /g3proxy/src/resolve/fail_over/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod handle; 7 | mod resolver; 8 | 9 | use handle::FailOverResolverHandle; 10 | pub(super) use resolver::FailOverResolver; 11 | -------------------------------------------------------------------------------- /g3proxy/src/resolve/hickory/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod handle; 7 | mod resolver; 8 | 9 | use handle::HickoryResolverHandle; 10 | pub(super) use resolver::HickoryResolver; 11 | -------------------------------------------------------------------------------- /g3proxy/src/serve/dummy_close/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod server; 7 | 8 | pub(super) use server::DummyCloseServer; 9 | -------------------------------------------------------------------------------- /g3proxy/src/serve/http_proxy/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod stats; 7 | use stats::HttpProxyServerStats; 8 | 9 | mod task; 10 | 11 | mod server; 12 | pub(crate) use server::HttpProxyServer; 13 | -------------------------------------------------------------------------------- /g3proxy/src/serve/http_proxy/task/connect/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::{CommonTaskContext, HttpProxyServerStats, protocol}; 7 | 8 | mod task; 9 | pub(super) use task::HttpProxyConnectTask; 10 | 11 | mod stats; 12 | use stats::TcpConnectTaskCltWrapperStats; 13 | -------------------------------------------------------------------------------- /g3proxy/src/serve/http_proxy/task/connect/stats/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::HttpProxyServerStats; 7 | 8 | mod wrapper; 9 | 10 | pub(super) use wrapper::TcpConnectTaskCltWrapperStats; 11 | -------------------------------------------------------------------------------- /g3proxy/src/serve/http_proxy/task/forward/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::{CommonTaskContext, HttpProxyServerStats, protocol}; 7 | 8 | mod task; 9 | pub(super) use task::HttpProxyForwardTask; 10 | 11 | mod stats; 12 | use stats::{ 13 | HttpForwardTaskCltWrapperStats, HttpForwardTaskStats, HttpsForwardTaskCltWrapperStats, 14 | }; 15 | -------------------------------------------------------------------------------- /g3proxy/src/serve/http_proxy/task/forward/stats/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::HttpProxyServerStats; 7 | 8 | mod task; 9 | mod wrapper; 10 | 11 | pub(super) use task::HttpForwardTaskStats; 12 | pub(super) use wrapper::{HttpForwardTaskCltWrapperStats, HttpsForwardTaskCltWrapperStats}; 13 | -------------------------------------------------------------------------------- /g3proxy/src/serve/http_proxy/task/ftp/stats/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::HttpProxyServerStats; 7 | 8 | mod task; 9 | pub(super) use task::FtpOverHttpTaskStats; 10 | 11 | mod wrapper; 12 | pub(super) use wrapper::FtpOverHttpTaskCltWrapperStats; 13 | -------------------------------------------------------------------------------- /g3proxy/src/serve/http_proxy/task/protocol/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use g3_io_ext::{LimitedBufReader, LimitedWriter}; 7 | 8 | mod request; 9 | pub(super) use request::HttpProxyRequest; 10 | 11 | pub(super) type HttpClientReader = LimitedBufReader; 12 | pub(super) type HttpClientWriter = LimitedWriter; 13 | -------------------------------------------------------------------------------- /g3proxy/src/serve/http_proxy/task/untrusted/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::{CommonTaskContext, HttpProxyServerStats, protocol}; 7 | 8 | mod task; 9 | 10 | pub(super) use task::HttpProxyUntrustedTask; 11 | 12 | mod stats; 13 | use stats::UntrustedCltReadWrapperStats; 14 | -------------------------------------------------------------------------------- /g3proxy/src/serve/http_rproxy/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod stats; 7 | use stats::HttpRProxyServerStats; 8 | 9 | mod task; 10 | 11 | mod server; 12 | pub(super) use server::HttpRProxyServer; 13 | 14 | mod host; 15 | use host::HttpHost; 16 | -------------------------------------------------------------------------------- /g3proxy/src/serve/http_rproxy/task/forward/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::{CommonTaskContext, HttpRProxyServerStats, protocol}; 7 | 8 | mod task; 9 | pub(super) use task::HttpRProxyForwardTask; 10 | 11 | mod stats; 12 | use stats::{ 13 | HttpForwardTaskCltWrapperStats, HttpForwardTaskStats, HttpsForwardTaskCltWrapperStats, 14 | }; 15 | -------------------------------------------------------------------------------- /g3proxy/src/serve/http_rproxy/task/forward/stats/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::HttpRProxyServerStats; 7 | 8 | mod task; 9 | mod wrapper; 10 | 11 | pub(super) use task::HttpForwardTaskStats; 12 | pub(super) use wrapper::{HttpForwardTaskCltWrapperStats, HttpsForwardTaskCltWrapperStats}; 13 | -------------------------------------------------------------------------------- /g3proxy/src/serve/http_rproxy/task/protocol/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use g3_io_ext::{LimitedBufReader, LimitedWriter}; 7 | 8 | mod request; 9 | 10 | pub(super) use request::HttpRProxyRequest; 11 | 12 | pub(super) type HttpClientReader = LimitedBufReader; 13 | pub(super) type HttpClientWriter = LimitedWriter; 14 | -------------------------------------------------------------------------------- /g3proxy/src/serve/http_rproxy/task/untrusted/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::{CommonTaskContext, HttpRProxyServerStats, protocol}; 7 | 8 | mod task; 9 | pub(super) use task::HttpRProxyUntrustedTask; 10 | 11 | mod stats; 12 | use stats::UntrustedCltReadWrapperStats; 13 | -------------------------------------------------------------------------------- /g3proxy/src/serve/intelli_proxy/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod server; 7 | pub(super) use server::IntelliProxy; 8 | 9 | mod detection; 10 | use detection::{DetectedProxyProtocol, detect_tcp_proxy_protocol}; 11 | -------------------------------------------------------------------------------- /g3proxy/src/serve/sni_proxy/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use crate::serve::tcp_stream::TcpStreamServerStats; 7 | 8 | mod server; 9 | mod task; 10 | 11 | use task::{ClientHelloAcceptTask, CommonTaskContext}; 12 | 13 | pub(crate) use server::SniProxyServer; 14 | -------------------------------------------------------------------------------- /g3proxy/src/serve/sni_proxy/task/accept/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::{CommonTaskContext, TcpStreamTask}; 7 | 8 | mod http; 9 | mod tls; 10 | 11 | mod stats; 12 | use stats::SniProxyCltWrapperStats; 13 | 14 | mod task; 15 | pub(crate) use task::ClientHelloAcceptTask; 16 | -------------------------------------------------------------------------------- /g3proxy/src/serve/sni_proxy/task/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod common; 7 | pub(super) use common::CommonTaskContext; 8 | 9 | mod accept; 10 | pub(super) use accept::ClientHelloAcceptTask; 11 | 12 | mod relay; 13 | use relay::TcpStreamTask; 14 | -------------------------------------------------------------------------------- /g3proxy/src/serve/sni_proxy/task/relay/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::CommonTaskContext; 7 | 8 | mod task; 9 | pub(super) use task::TcpStreamTask; 10 | -------------------------------------------------------------------------------- /g3proxy/src/serve/socks_proxy/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod server; 7 | mod stats; 8 | mod task; 9 | 10 | use stats::SocksProxyServerStats; 11 | 12 | pub(crate) use server::SocksProxyServer; 13 | -------------------------------------------------------------------------------- /g3proxy/src/serve/socks_proxy/task/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::SocksProxyServerStats; 7 | use crate::config::server::socks_proxy::SocksProxyServerConfig; 8 | 9 | mod common; 10 | pub(super) use common::CommonTaskContext; 11 | 12 | mod negotiation; 13 | mod tcp_connect; 14 | mod udp_associate; 15 | mod udp_connect; 16 | 17 | pub(super) use negotiation::SocksProxyNegotiationTask; 18 | -------------------------------------------------------------------------------- /g3proxy/src/serve/socks_proxy/task/negotiation/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::{CommonTaskContext, SocksProxyServerStats, tcp_connect, udp_associate, udp_connect}; 7 | 8 | mod task; 9 | pub(crate) use task::SocksProxyNegotiationTask; 10 | 11 | mod stats; 12 | use stats::SocksProxyCltWrapperStats; 13 | -------------------------------------------------------------------------------- /g3proxy/src/serve/socks_proxy/task/tcp_connect/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::{CommonTaskContext, SocksProxyServerStats}; 7 | 8 | mod task; 9 | pub(super) use task::SocksProxyTcpConnectTask; 10 | 11 | mod stats; 12 | use stats::TcpConnectTaskCltWrapperStats; 13 | -------------------------------------------------------------------------------- /g3proxy/src/serve/socks_proxy/task/tcp_connect/stats/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::SocksProxyServerStats; 7 | 8 | mod wrapper; 9 | 10 | pub(super) use wrapper::TcpConnectTaskCltWrapperStats; 11 | -------------------------------------------------------------------------------- /g3proxy/src/serve/socks_proxy/task/udp_associate/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::{CommonTaskContext, SocksProxyServerStats}; 7 | 8 | mod task; 9 | pub(super) use task::SocksProxyUdpAssociateTask; 10 | 11 | mod recv; 12 | mod send; 13 | mod stats; 14 | 15 | use recv::Socks5UdpAssociateClientRecv; 16 | use send::Socks5UdpAssociateClientSend; 17 | use stats::{UdpAssociateTaskCltWrapperStats, UdpAssociateTaskStats}; 18 | -------------------------------------------------------------------------------- /g3proxy/src/serve/socks_proxy/task/udp_associate/stats/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::SocksProxyServerStats; 7 | 8 | mod task; 9 | mod wrapper; 10 | 11 | pub(super) use task::UdpAssociateTaskStats; 12 | pub(super) use wrapper::UdpAssociateTaskCltWrapperStats; 13 | -------------------------------------------------------------------------------- /g3proxy/src/serve/socks_proxy/task/udp_connect/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::{CommonTaskContext, SocksProxyServerStats}; 7 | 8 | mod task; 9 | pub(super) use task::SocksProxyUdpConnectTask; 10 | 11 | mod recv; 12 | mod send; 13 | mod stats; 14 | 15 | use recv::Socks5UdpConnectClientRecv; 16 | use send::Socks5UdpConnectClientSend; 17 | use stats::{UdpConnectTaskCltWrapperStats, UdpConnectTaskStats}; 18 | -------------------------------------------------------------------------------- /g3proxy/src/serve/socks_proxy/task/udp_connect/stats/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::SocksProxyServerStats; 7 | 8 | mod task; 9 | pub(super) use task::UdpConnectTaskStats; 10 | 11 | mod wrapper; 12 | pub(super) use wrapper::UdpConnectTaskCltWrapperStats; 13 | -------------------------------------------------------------------------------- /g3proxy/src/serve/tcp_stream/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod common; 7 | mod server; 8 | mod stats; 9 | mod task; 10 | 11 | pub(crate) use server::TcpStreamServer; 12 | pub(crate) use stats::*; 13 | -------------------------------------------------------------------------------- /g3proxy/src/serve/tcp_stream/stats/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod server; 7 | mod wrapper; 8 | 9 | pub(crate) use server::{TcpStreamServerAliveTaskGuard, TcpStreamServerStats}; 10 | pub(crate) use wrapper::TcpStreamTaskCltWrapperStats; 11 | -------------------------------------------------------------------------------- /g3proxy/src/serve/tcp_tproxy/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod common; 7 | mod server; 8 | mod task; 9 | 10 | pub(crate) use server::TcpTProxyServer; 11 | -------------------------------------------------------------------------------- /g3proxy/src/serve/tls_stream/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod common; 7 | mod server; 8 | mod task; 9 | 10 | pub(crate) use server::TlsStreamServer; 11 | -------------------------------------------------------------------------------- /g3proxy/src/stat/types/untrusted.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | #[derive(Default)] 7 | pub(crate) struct UntrustedTaskStatsSnapshot { 8 | pub(crate) task_total: u64, 9 | pub(crate) task_alive: i32, 10 | pub(crate) in_bytes: u64, 11 | } 12 | -------------------------------------------------------------------------------- /g3statsd/CHANGELOG: -------------------------------------------------------------------------------- 1 | v0.1.0: 2 | - Initial release 3 | -------------------------------------------------------------------------------- /g3statsd/build.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | fn main() { 7 | g3_build_env::check_basic(); 8 | } 9 | -------------------------------------------------------------------------------- /g3statsd/debian/changelog: -------------------------------------------------------------------------------- 1 | g3statsd (0.1.0-1) UNRELEASED; urgency=medium 2 | 3 | * New upstream release. 4 | 5 | -- G3statsd Maintainers Tue, 13 May 2025 18:58:03 +0800 6 | -------------------------------------------------------------------------------- /g3statsd/debian/compat: -------------------------------------------------------------------------------- 1 | 13 2 | -------------------------------------------------------------------------------- /g3statsd/debian/control: -------------------------------------------------------------------------------- 1 | Source: g3statsd 2 | Section: net 3 | Priority: optional 4 | Maintainer: G3statsd Maintainers 5 | Build-Depends: debhelper, pkg-config, libssl-dev 6 | Standards-Version: 3.9.8 7 | Homepage: https://github.com/bytedance/g3 8 | 9 | Package: g3statsd 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends} 12 | Recommends: systemd 13 | Description: StatsD server for G3 Project 14 | -------------------------------------------------------------------------------- /g3statsd/debian/g3statsd.docs: -------------------------------------------------------------------------------- 1 | LICENSE 2 | LICENSE-BUNDLED 3 | LICENSE-FOREIGN 4 | -------------------------------------------------------------------------------- /g3statsd/debian/g3statsd.install: -------------------------------------------------------------------------------- 1 | usr/bin/g3statsd 2 | usr/bin/g3statsd-ctl 3 | -------------------------------------------------------------------------------- /g3statsd/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /g3statsd/proto/.gitignore: -------------------------------------------------------------------------------- 1 | gen 2 | -------------------------------------------------------------------------------- /g3statsd/proto/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3statsd-proto" 3 | version = "0.1.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | capnp.workspace = true 11 | 12 | [build-dependencies] 13 | capnpc.workspace = true 14 | -------------------------------------------------------------------------------- /g3statsd/proto/schema/types.capnp: -------------------------------------------------------------------------------- 1 | @0xfe51079061e90943; 2 | 3 | struct Error { 4 | code @0 :Int32 = -1; 5 | reason @1 :Text; 6 | } 7 | 8 | struct OperationResult { 9 | union { 10 | ok @0 :Text; 11 | err @1 :Error; 12 | } 13 | } 14 | 15 | struct FetchResult(Data) { 16 | union { 17 | data @0 :Data; 18 | err @1 :Error; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /g3statsd/proto/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | #![allow(clippy::needless_lifetimes)] 7 | 8 | pub mod types_capnp { 9 | #![allow(clippy::extra_unused_type_parameters)] 10 | include!(concat!(env!("G3_CAPNP_GENERATE_DIR"), "/types_capnp.rs")); 11 | } 12 | 13 | pub mod proc_capnp { 14 | include!(concat!(env!("G3_CAPNP_GENERATE_DIR"), "/proc_capnp.rs")); 15 | } 16 | -------------------------------------------------------------------------------- /g3statsd/service/generate_systemd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | CUR_DIR=$(dirname "${0}") 6 | 7 | SYSTEMD_VERSION=$(pkg-config --modversion systemd | awk -F'.' '{print $1}') 8 | 9 | if [ "${SYSTEMD_VERSION}" -lt "240" ] 10 | then 11 | cp "${CUR_DIR}/g3statsd@.pre240.service" "${CUR_DIR}/g3statsd@.service" 12 | else 13 | cp "${CUR_DIR}/g3statsd@.latest.service" "${CUR_DIR}/g3statsd@.service" 14 | fi 15 | 16 | -------------------------------------------------------------------------------- /g3statsd/src/collect/aggregate/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod collect; 7 | pub(crate) use collect::AggregateCollector; 8 | 9 | mod store; 10 | use store::AggregateHandle; 11 | -------------------------------------------------------------------------------- /g3statsd/src/collect/internal/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod emit; 7 | use emit::InternalEmitter; 8 | 9 | mod collect; 10 | pub(super) use collect::InternalCollector; 11 | -------------------------------------------------------------------------------- /g3statsd/src/config/importer/statsd/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::{AnyImporterConfig, ImporterConfig, ImporterConfigDiffAction}; 7 | use super::{CONFIG_KEY_IMPORTER_NAME, CONFIG_KEY_IMPORTER_TYPE}; 8 | 9 | mod udp; 10 | pub(crate) use udp::StatsdUdpImporterConfig; 11 | 12 | #[cfg(unix)] 13 | mod unix; 14 | #[cfg(unix)] 15 | pub(crate) use unix::StatsdUnixImporterConfig; 16 | -------------------------------------------------------------------------------- /g3statsd/src/control/bridge/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod reload; 7 | pub(super) use reload::{reload_collector, reload_exporter, reload_importer}; 8 | -------------------------------------------------------------------------------- /g3statsd/src/control/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod bridge; 7 | 8 | mod quit; 9 | pub use quit::QuitActor; 10 | 11 | mod upgrade; 12 | pub use upgrade::UpgradeActor; 13 | 14 | mod local; 15 | pub use local::{DaemonController, UniqueController}; 16 | 17 | pub mod capnp; 18 | -------------------------------------------------------------------------------- /g3statsd/src/export/influxdb/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::{ArcExporterInternal, Exporter, ExporterInternal}; 7 | 8 | mod export; 9 | use export::{InfluxdbAggregateExport, InfluxdbHttpExport}; 10 | 11 | mod v2; 12 | pub(super) use v2::InfluxdbV2Exporter; 13 | 14 | mod v3; 15 | pub(super) use v3::InfluxdbV3Exporter; 16 | -------------------------------------------------------------------------------- /g3statsd/src/import/statsd/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod parser; 7 | use parser::StatsdRecordVisitor; 8 | 9 | mod udp; 10 | pub(super) use udp::StatsdUdpImporter; 11 | 12 | #[cfg(unix)] 13 | mod unix; 14 | #[cfg(unix)] 15 | pub(super) use unix::StatsdUnixImporter; 16 | -------------------------------------------------------------------------------- /g3statsd/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod collect; 7 | pub mod config; 8 | pub mod control; 9 | pub mod export; 10 | pub mod import; 11 | pub mod opts; 12 | pub mod signal; 13 | 14 | mod build; 15 | mod runtime; 16 | mod types; 17 | -------------------------------------------------------------------------------- /g3statsd/src/runtime/export/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod aggregate; 7 | pub(crate) use aggregate::{ 8 | AggregateExport, AggregateExportRuntime, CounterStoreValue, GaugeStoreValue, 9 | }; 10 | 11 | mod stream; 12 | pub(crate) use stream::{StreamExport, StreamExportConfig, StreamExportRuntime}; 13 | 14 | mod http; 15 | pub(crate) use http::{HttpExport, HttpExportConfig, HttpExportRuntime}; 16 | -------------------------------------------------------------------------------- /g3statsd/src/runtime/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod export; 7 | -------------------------------------------------------------------------------- /g3statsd/utils/ctl/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3statsd-ctl" 3 | version = "0.1.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | [dependencies] 8 | anyhow.workspace = true 9 | clap.workspace = true 10 | tokio = { workspace = true, features = ["rt", "macros", "io-util", "fs"] } 11 | futures-util.workspace = true 12 | capnp.workspace = true 13 | hex.workspace = true 14 | openssl.workspace = true 15 | g3-ctl.workspace = true 16 | g3statsd-proto = { path = "../../proto" } 17 | -------------------------------------------------------------------------------- /g3tiles/build.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use std::env; 7 | 8 | fn main() { 9 | g3_build_env::check_basic(); 10 | g3_build_env::check_openssl(); 11 | g3_build_env::check_rustls_provider(); 12 | 13 | if env::var("CARGO_FEATURE_QUIC").is_ok() { 14 | println!("cargo:rustc-env=G3_QUIC_FEATURE=quinn"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /g3tiles/debian/changelog: -------------------------------------------------------------------------------- 1 | g3tiles (0.3.8-1) UNRELEASED; urgency=medium 2 | 3 | * New upstream release. 4 | 5 | -- G3tiles Maintainers Fri, 11 Apr 2025 11:12:21 +0800 6 | -------------------------------------------------------------------------------- /g3tiles/debian/compat: -------------------------------------------------------------------------------- 1 | 13 2 | -------------------------------------------------------------------------------- /g3tiles/debian/control: -------------------------------------------------------------------------------- 1 | Source: g3tiles 2 | Section: net 3 | Priority: optional 4 | Maintainer: G3tiles Maintainers 5 | Build-Depends: debhelper, pkg-config, libtool, capnproto, libssl-dev 6 | Standards-Version: 3.9.8 7 | Homepage: https://github.com/bytedance/g3 8 | 9 | Package: g3tiles 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends} 12 | Recommends: ca-certificates, systemd 13 | Description: Generic reverse proxy for G3 Project 14 | -------------------------------------------------------------------------------- /g3tiles/debian/g3tiles.docs: -------------------------------------------------------------------------------- 1 | LICENSE 2 | LICENSE-BUNDLED 3 | LICENSE-FOREIGN 4 | sphinx/g3tiles/_build/html 5 | -------------------------------------------------------------------------------- /g3tiles/debian/g3tiles.install: -------------------------------------------------------------------------------- 1 | usr/bin/g3tiles 2 | usr/bin/g3tiles-ctl 3 | -------------------------------------------------------------------------------- /g3tiles/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /g3tiles/examples/benchmark/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | runtime: 4 | thread_number: 2 5 | 6 | worker: 7 | sched_affinity: true 8 | 9 | discover: 10 | - name: static 11 | type: static_addr 12 | 13 | backend: 14 | - name: http 15 | type: stream_tcp 16 | discover: static 17 | discover_data: 18 | - "127.0.0.1:80" 19 | 20 | server: server.d 21 | 22 | log: discard 23 | 24 | stat: 25 | target: 26 | udp: 127.0.0.1:8125 27 | prefix: g3tiles 28 | emit_duration: 200ms 29 | -------------------------------------------------------------------------------- /g3tiles/examples/benchmark/server.d/bench.example.net-ec256.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgWCc9lXboFSkeGShT 3 | j/numhJrNk14PLjHnHsR9TbAhTehRANCAASI/wmJz8euGB/ajEqFz7Nli8qRdsIN 4 | w1qRUm/w8HNDGHERDzuH2Q2JHWuHVB23A7P7vRRORKD27/dzkwubgJvG 5 | -----END PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /g3tiles/examples/benchmark/server.d/openssl.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: openssl 4 | type: OpensslProxy 5 | listen: 6 | address: "[::]:9093" 7 | backlog: 4096 8 | listen_in_worker: true 9 | 10 | virtual_hosts: 11 | name: bench 12 | exact_match: bench.example.net 13 | cert_pairs: 14 | certificate: bench.example.net-ec256.crt 15 | private_key: bench.example.net-ec256.key 16 | no-session-cache: true 17 | backends: 18 | - http 19 | 20 | tls-ticketer: { } 21 | -------------------------------------------------------------------------------- /g3tiles/examples/benchmark/server.d/rustls.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: rustls 4 | type: RustlsProxy 5 | listen: 6 | address: "[::]:9095" 7 | backlog: 4096 8 | listen_in_worker: true 9 | 10 | virtual_hosts: 11 | name: bench 12 | exact_match: bench.example.net 13 | cert_pairs: 14 | certificate: bench.example.net-ec256.crt 15 | private_key: bench.example.net-ec256.key 16 | no-session-cache: true 17 | backends: 18 | - http 19 | 20 | tls-ticketer: { } 21 | -------------------------------------------------------------------------------- /g3tiles/examples/keyless_to_quic/G3-test.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgRTPFTS5LzR2zxd+2 3 | UJckF2ily4T/RGZEYUSFztThq3GhRANCAARcgdDHVt4tq166nnMFmrrTTu+SVg+y 4 | HPi8FFtXxCWfj3+TCKOmgOCrEn0n0Umt7Pejl8/KL0QYMEiC2cQuW5dq 5 | -----END PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /g3tiles/examples/keyless_to_quic/keyless.example.net-client.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgNk1jBav69kXm/qpb 3 | lv/8hSBkZKSJXUnQ7snO3qvfsZChRANCAATCJKe5ssOm+zHX4ogw1jLKW1VGP81S 4 | W2PjVAUpDnN0uZgi7qZjpiDpoQdPL4YJaJYdWG2klA4lIDNLeE+zcVjE 5 | -----END PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /g3tiles/examples/keyless_to_quic/keyless.example.net.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgMe69Pt9GaT2E3+ri 3 | 9aHAQ8inselBpuINc7H8G1pR2HGhRANCAAStiI5u7JihaIfe2+vfaMBHpz8OMgWP 4 | 53INaRg7OyLiS12Sb9sX1NtTGcugQWfrn2foHtrQKYNI32Gpea26eQg7 5 | -----END PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /g3tiles/examples/keyless_to_tcp/main.yaml: -------------------------------------------------------------------------------- 1 | 2 | log: journal 3 | 4 | discover: 5 | - name: static 6 | type: static_addr 7 | 8 | backend: 9 | - name: local_tcp 10 | type: keyless_tcp 11 | discover: static 12 | discover_data: "127.0.0.1:1300" 13 | 14 | server: 15 | - name: keyless 16 | type: keyless_proxy 17 | backend: local_tcp 18 | - name: listen1400 19 | type: plain_tcp_port 20 | listen: "127.0.0.1:1400" 21 | server: keyless 22 | -------------------------------------------------------------------------------- /g3tiles/proto/.gitignore: -------------------------------------------------------------------------------- 1 | gen 2 | -------------------------------------------------------------------------------- /g3tiles/proto/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3tiles-proto" 3 | version = "0.1.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | capnp.workspace = true 11 | 12 | [build-dependencies] 13 | capnpc.workspace = true 14 | -------------------------------------------------------------------------------- /g3tiles/proto/schema/backend.capnp: -------------------------------------------------------------------------------- 1 | @0xb3f076019fd2cc68; 2 | 3 | interface BackendControl { 4 | aliveConnection @0 () -> (count :UInt64); 5 | } 6 | -------------------------------------------------------------------------------- /g3tiles/proto/schema/server.capnp: -------------------------------------------------------------------------------- 1 | @0xa37d35b77bba8fa9; 2 | 3 | struct ServerStats { 4 | online @0 :Bool; 5 | aliveTaskCount @1 :Int32; 6 | totalConnCount @2 :UInt64; 7 | totalTaskCount @3 :UInt64; 8 | } 9 | 10 | interface ServerControl { 11 | status @0 () -> (status :ServerStats); 12 | } 13 | -------------------------------------------------------------------------------- /g3tiles/proto/schema/types.capnp: -------------------------------------------------------------------------------- 1 | @0x921969fb6e11b80a; 2 | 3 | struct Error { 4 | code @0 :Int32 = -1; 5 | reason @1 :Text; 6 | } 7 | 8 | struct OperationResult { 9 | union { 10 | ok @0 :Text; 11 | err @1 :Error; 12 | } 13 | } 14 | 15 | struct FetchResult(Data) { 16 | union { 17 | data @0 :Data; 18 | err @1 :Error; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /g3tiles/service/generate_systemd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | CUR_DIR=$(dirname "${0}") 6 | 7 | SYSTEMD_VERSION=$(pkg-config --modversion systemd | awk -F'.' '{print $1}') 8 | 9 | if [ "${SYSTEMD_VERSION}" -lt "240" ] 10 | then 11 | cp "${CUR_DIR}/g3tiles@.pre240.service" "${CUR_DIR}/g3tiles@.service" 12 | else 13 | cp "${CUR_DIR}/g3tiles@.latest.service" "${CUR_DIR}/g3tiles@.service" 14 | fi 15 | 16 | -------------------------------------------------------------------------------- /g3tiles/src/control/bridge/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod reload; 7 | pub(super) use reload::{reload_backend, reload_discover, reload_server}; 8 | -------------------------------------------------------------------------------- /g3tiles/src/control/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod bridge; 7 | 8 | mod quit; 9 | pub use quit::QuitActor; 10 | 11 | mod upgrade; 12 | pub use upgrade::UpgradeActor; 13 | 14 | mod local; 15 | pub use local::{DaemonController, UniqueController}; 16 | 17 | pub mod capnp; 18 | -------------------------------------------------------------------------------- /g3tiles/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod backend; 7 | pub mod config; 8 | pub mod control; 9 | pub mod discover; 10 | pub mod opts; 11 | pub mod serve; 12 | pub mod signal; 13 | pub mod stat; 14 | 15 | mod build; 16 | mod log; 17 | mod module; 18 | -------------------------------------------------------------------------------- /g3tiles/src/log/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod shared; 7 | 8 | pub(crate) mod task; 9 | 10 | const LOG_TYPE_TASK: &str = "Task"; 11 | -------------------------------------------------------------------------------- /g3tiles/src/module/keyless/protocol/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod error; 7 | pub(crate) use error::KeylessRecvMessageError; 8 | 9 | mod header; 10 | mod request; 11 | mod response; 12 | 13 | const KEYLESS_HEADER_LEN: usize = 8; 14 | 15 | pub(crate) use header::KeylessHeader; 16 | pub(crate) use request::KeylessRequest; 17 | pub(crate) use response::{KeylessInternalErrorResponse, KeylessResponse, KeylessUpstreamResponse}; 18 | -------------------------------------------------------------------------------- /g3tiles/src/module/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub(crate) mod stream; 7 | 8 | pub(crate) mod keyless; 9 | -------------------------------------------------------------------------------- /g3tiles/src/module/stream/stats/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod server; 7 | pub(crate) use server::{StreamServerAliveTaskGuard, StreamServerStats}; 8 | 9 | mod task; 10 | pub(crate) use task::{StreamAcceptTaskCltWrapperStats, StreamRelayTaskCltWrapperStats}; 11 | 12 | mod backend; 13 | pub(crate) use backend::{ 14 | StreamBackendDurationRecorder, StreamBackendDurationStats, StreamBackendStats, 15 | }; 16 | -------------------------------------------------------------------------------- /g3tiles/src/serve/dummy_close/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod server; 7 | pub(super) use server::DummyCloseServer; 8 | -------------------------------------------------------------------------------- /g3tiles/src/serve/keyless_proxy/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod server; 7 | pub(super) use server::KeylessProxyServer; 8 | 9 | mod task; 10 | use task::{CommonTaskContext, KeylessForwardTask}; 11 | 12 | mod stats; 13 | pub(crate) use stats::{KeylessProxyServerAliveTaskGuard, KeylessProxyServerStats}; 14 | -------------------------------------------------------------------------------- /g3tiles/src/serve/keyless_proxy/stats/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod server; 7 | pub(crate) use server::{KeylessProxyServerAliveTaskGuard, KeylessProxyServerStats}; 8 | -------------------------------------------------------------------------------- /g3tiles/src/serve/openssl_proxy/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod server; 7 | pub(super) use server::OpensslProxyServer; 8 | 9 | mod task; 10 | use task::{CommonTaskContext, OpensslAcceptTask}; 11 | 12 | mod host; 13 | use host::OpensslHost; 14 | -------------------------------------------------------------------------------- /g3tiles/src/serve/openssl_proxy/task/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod common; 7 | pub(super) use common::CommonTaskContext; 8 | 9 | mod accept; 10 | pub(super) use accept::OpensslAcceptTask; 11 | 12 | mod relay; 13 | use relay::OpensslRelayTask; 14 | -------------------------------------------------------------------------------- /g3tiles/src/serve/rustls_proxy/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod server; 7 | pub(super) use server::RustlsProxyServer; 8 | 9 | mod task; 10 | use task::{CommonTaskContext, RustlsAcceptTask}; 11 | 12 | mod host; 13 | use host::RustlsHost; 14 | -------------------------------------------------------------------------------- /g3tiles/src/serve/rustls_proxy/task/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod common; 7 | pub(super) use common::CommonTaskContext; 8 | 9 | mod accept; 10 | pub(super) use accept::RustlsAcceptTask; 11 | 12 | mod relay; 13 | use relay::RustlsRelayTask; 14 | -------------------------------------------------------------------------------- /g3tiles/src/stat/metrics/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub(crate) mod backend; 7 | pub(crate) mod server; 8 | -------------------------------------------------------------------------------- /g3tiles/utils/ctl/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3tiles-ctl" 3 | version = "0.1.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | anyhow.workspace = true 11 | clap.workspace = true 12 | tokio = { workspace = true, features = ["rt", "macros"] } 13 | futures-util.workspace = true 14 | capnp.workspace = true 15 | g3-ctl.workspace = true 16 | g3tiles-proto = { path = "../../proto" } 17 | -------------------------------------------------------------------------------- /justfile: -------------------------------------------------------------------------------- 1 | check: 2 | cargo check --workspace 3 | 4 | test: 5 | cargo test --workspace --lib --examples 6 | 7 | clippy: 8 | cargo clippy --tests -- --deny warnings 9 | 10 | qa: check test clippy 11 | -------------------------------------------------------------------------------- /lib/g3-build-env/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3-build-env" 3 | version = "0.2.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | [dependencies] 8 | rustc_version = "0.4" 9 | -------------------------------------------------------------------------------- /lib/g3-build-env/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod basic; 7 | pub use basic::check_basic; 8 | 9 | mod openssl; 10 | pub use openssl::check_openssl; 11 | 12 | mod rustls; 13 | pub use rustls::check_rustls_provider; 14 | -------------------------------------------------------------------------------- /lib/g3-build-env/src/rustls.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use std::env; 7 | 8 | pub fn check_rustls_provider() { 9 | if env::var("CARGO_FEATURE_RUSTLS_RING").is_ok() { 10 | println!("cargo:rustc-env=G3_RUSTLS_PROVIDER=ring"); 11 | } 12 | if env::var("CARGO_FEATURE_RUSTLS_AWS_LC").is_ok() { 13 | println!("cargo:rustc-env=G3_RUSTLS_PROVIDER=aws-lc"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lib/g3-clap/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3-clap" 3 | version = "0.2.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | anyhow.workspace = true 11 | clap.workspace = true 12 | humanize-rs.workspace = true 13 | -------------------------------------------------------------------------------- /lib/g3-clap/src/humanize/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod size; 7 | pub use size::get_usize; 8 | 9 | mod time; 10 | pub use time::get_duration; 11 | -------------------------------------------------------------------------------- /lib/g3-clap/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod humanize; 7 | -------------------------------------------------------------------------------- /lib/g3-compat/src/hostname/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | #[cfg(unix)] 7 | mod unix; 8 | #[cfg(unix)] 9 | pub use unix::hostname; 10 | 11 | #[cfg(windows)] 12 | mod windows; 13 | #[cfg(windows)] 14 | pub use windows::hostname; 15 | -------------------------------------------------------------------------------- /lib/g3-compat/src/hostname/unix.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use std::ffi::{OsStr, OsString}; 7 | use std::os::unix::ffi::OsStrExt; 8 | 9 | pub fn hostname() -> OsString { 10 | let uname = rustix::system::uname(); 11 | OsStr::from_bytes(uname.nodename().to_bytes()).to_os_string() 12 | } 13 | -------------------------------------------------------------------------------- /lib/g3-compat/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod sched; 7 | pub use sched::CpuAffinity; 8 | 9 | mod hostname; 10 | pub use hostname::hostname; 11 | -------------------------------------------------------------------------------- /lib/g3-ctl/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod opts; 7 | pub use opts::{DaemonCtlArgs, DaemonCtlArgsExt}; 8 | 9 | mod error; 10 | pub use error::{CommandError, CommandResult}; 11 | 12 | mod io; 13 | pub use io::*; 14 | -------------------------------------------------------------------------------- /lib/g3-daemon/src/config/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod lookup; 7 | pub use lookup::get_lookup_dir; 8 | 9 | mod topology; 10 | pub use topology::TopoMap; 11 | -------------------------------------------------------------------------------- /lib/g3-daemon/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod config; 7 | pub mod control; 8 | pub mod listen; 9 | pub mod log; 10 | pub mod metrics; 11 | pub mod opts; 12 | pub mod runtime; 13 | pub mod server; 14 | pub mod signal; 15 | pub mod stat; 16 | 17 | #[cfg(unix)] 18 | pub mod daemonize; 19 | 20 | #[cfg(feature = "register")] 21 | pub mod register; 22 | -------------------------------------------------------------------------------- /lib/g3-daemon/src/listen/no_quic.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use async_trait::async_trait; 7 | 8 | use crate::server::BaseServer; 9 | 10 | #[async_trait] 11 | pub trait AcceptQuicServer: BaseServer {} 12 | 13 | pub trait ListenQuicConf {} 14 | 15 | pub struct ListenQuicRuntime {} 16 | -------------------------------------------------------------------------------- /lib/g3-daemon/src/listen/unix/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod datagram; 7 | pub use datagram::{ReceiveUnixDatagramRuntime, ReceiveUnixDatagramServer}; 8 | -------------------------------------------------------------------------------- /lib/g3-daemon/src/log/event/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod report; 7 | pub use report::ReportLogIoError; 8 | 9 | mod stats; 10 | pub(crate) use stats::LoggerStats; 11 | 12 | pub mod metrics; 13 | 14 | mod registry; 15 | 16 | mod config; 17 | pub use config::{LogConfig, LogConfigContainer, LogConfigDriver}; 18 | -------------------------------------------------------------------------------- /lib/g3-daemon/src/log/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod process; 7 | 8 | #[cfg(feature = "event-log")] 9 | mod event; 10 | #[cfg(feature = "event-log")] 11 | pub use event::*; 12 | -------------------------------------------------------------------------------- /lib/g3-daemon/src/opts/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod daemon; 7 | pub use daemon::{DaemonArgs, DaemonArgsExt}; 8 | 9 | mod control; 10 | pub use control::{DEFAULT_CONTROL_DIR, control_dir, validate_and_set_control_dir}; 11 | 12 | mod config; 13 | pub use config::{config_dir, config_file, config_file_extension, validate_and_set_config_file}; 14 | -------------------------------------------------------------------------------- /lib/g3-daemon/src/server/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod quit_policy; 7 | pub use quit_policy::ServerQuitPolicy; 8 | 9 | pub mod task; 10 | 11 | mod connection; 12 | pub use connection::ClientConnectionInfo; 13 | 14 | mod runtime; 15 | pub use runtime::{BaseServer, ReloadServer, ServerExt, ServerReloadCommand}; 16 | -------------------------------------------------------------------------------- /lib/g3-daemon/src/signal/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | #[cfg(unix)] 7 | mod unix; 8 | #[cfg(unix)] 9 | pub use unix::{register_offline, register_quit, register_reload}; 10 | 11 | #[cfg(windows)] 12 | mod windows; 13 | #[cfg(windows)] 14 | pub use windows::register_quit; 15 | 16 | pub trait AsyncSignalAction: Copy { 17 | fn run(&self) -> impl Future + Send; 18 | } 19 | -------------------------------------------------------------------------------- /lib/g3-daemon/src/stat/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod config; 7 | 8 | pub mod remote; 9 | pub mod task; 10 | 11 | pub mod emit; 12 | -------------------------------------------------------------------------------- /lib/g3-daemon/src/stat/remote/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod tcp_connect; 7 | pub use tcp_connect::{ 8 | ArcTcpConnectionTaskRemoteStats, TcpConnectionTaskRemoteStats, 9 | TcpConnectionTaskRemoteStatsWrapper, 10 | }; 11 | -------------------------------------------------------------------------------- /lib/g3-daemon/src/stat/task/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod tcp_stream; 7 | pub use tcp_stream::{TcpStreamConnectionStats, TcpStreamHalfConnectionStats, TcpStreamTaskStats}; 8 | 9 | mod udp_connect; 10 | pub use udp_connect::{UdpConnectConnectionStats, UdpConnectHalfConnectionStats}; 11 | -------------------------------------------------------------------------------- /lib/g3-datetime/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3-datetime" 3 | version = "0.2.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | chrono.workspace = true 11 | -------------------------------------------------------------------------------- /lib/g3-datetime/src/format/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod asn1; 7 | pub mod ftp; 8 | pub mod log; 9 | pub mod std; 10 | -------------------------------------------------------------------------------- /lib/g3-datetime/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod format; 7 | -------------------------------------------------------------------------------- /lib/g3-dpi/src/parser/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod tls; 7 | 8 | #[cfg(feature = "quic")] 9 | pub mod quic; 10 | -------------------------------------------------------------------------------- /lib/g3-dpi/src/parser/quic/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod var_int; 7 | pub use var_int::VarInt; 8 | 9 | mod packet; 10 | pub use packet::{InitialPacket, PacketParseError}; 11 | 12 | mod frame; 13 | pub use frame::{AckFrame, CryptoFrame, FrameConsume, FrameParseError, HandshakeCoalescer}; 14 | 15 | #[cfg(test)] 16 | mod tests; 17 | -------------------------------------------------------------------------------- /lib/g3-dpi/src/parser/quic/tests/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod chrome_client_hello; 7 | -------------------------------------------------------------------------------- /lib/g3-dpi/src/parser/tls/tests/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod chrome_client_hello; 7 | mod fragment_client_hello; 8 | mod tongsuo_client_hello; 9 | -------------------------------------------------------------------------------- /lib/g3-dpi/src/source.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub enum Source { 7 | Client, 8 | Server, 9 | } 10 | -------------------------------------------------------------------------------- /lib/g3-ftp-client/src/transfer/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod line; 7 | 8 | pub use line::FtpLineDataReceiver; 9 | pub(crate) use line::FtpLineDataTransfer; 10 | 11 | #[derive(Clone, Copy)] 12 | pub(crate) enum FtpTransferType { 13 | Ascii, 14 | Image, 15 | } 16 | -------------------------------------------------------------------------------- /lib/g3-geoip-db/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3-geoip-db" 3 | version = "0.3.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | [dependencies] 8 | anyhow.workspace = true 9 | arc-swap.workspace = true 10 | ip_network.workspace = true 11 | ip_network_table.workspace = true 12 | csv = "1.2" 13 | flate2 = { version = "1.1", default-features = false, features = ["zlib-rs"] } 14 | zip = { version = "4.0", default-features = false, features = ["deflate"] } 15 | g3-geoip-types.workspace = true 16 | -------------------------------------------------------------------------------- /lib/g3-geoip-db/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod record; 7 | pub use record::{GeoIpAsnRecord, GeoIpCountryRecord}; 8 | 9 | pub mod store; 10 | pub mod vendor; 11 | -------------------------------------------------------------------------------- /lib/g3-geoip-db/src/vendor/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod ipfire; 7 | 8 | pub mod ipinfo; 9 | 10 | pub mod maxmind; 11 | 12 | pub mod native; 13 | -------------------------------------------------------------------------------- /lib/g3-geoip-types/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3-geoip-types" 3 | version = "0.2.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | anyhow.workspace = true 11 | ip_network.workspace = true 12 | smol_str.workspace = true 13 | -------------------------------------------------------------------------------- /lib/g3-geoip-types/src/country/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod iso_generated; 7 | pub use iso_generated::IsoCountryCode; 8 | -------------------------------------------------------------------------------- /lib/g3-geoip-types/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod continent; 7 | pub use continent::{Continent, ContinentCode}; 8 | 9 | mod country; 10 | pub use country::IsoCountryCode; 11 | 12 | mod location; 13 | pub use location::{IpLocation, IpLocationBuilder}; 14 | -------------------------------------------------------------------------------- /lib/g3-h2/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3-h2" 3 | version = "0.2.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | thiserror.workspace = true 11 | bytes.workspace = true 12 | h2.workspace = true 13 | http.workspace = true 14 | tokio.workspace = true 15 | g3-http.workspace = true 16 | g3-io-ext.workspace = true 17 | -------------------------------------------------------------------------------- /lib/g3-h2/src/ext/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod request; 7 | pub use request::RequestExt; 8 | 9 | mod response; 10 | pub use response::ResponseExt; 11 | -------------------------------------------------------------------------------- /lib/g3-hickory-client/src/connect/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub(crate) mod rustls; 7 | 8 | #[cfg(feature = "quic")] 9 | pub(crate) mod quinn; 10 | -------------------------------------------------------------------------------- /lib/g3-hickory-client/src/io/http/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | const MIME_APPLICATION_DNS: &str = "application/dns-message"; 7 | const DNS_QUERY_PATH: &str = "/dns-query"; 8 | 9 | pub mod request; 10 | pub mod response; 11 | -------------------------------------------------------------------------------- /lib/g3-hickory-client/src/io/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod h2; 7 | #[cfg(feature = "quic")] 8 | pub mod h3; 9 | #[cfg(feature = "quic")] 10 | pub mod quic; 11 | pub mod tcp; 12 | pub mod tls; 13 | pub mod udp; 14 | 15 | mod http; 16 | -------------------------------------------------------------------------------- /lib/g3-hickory-client/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod connect; 7 | 8 | pub mod io; 9 | -------------------------------------------------------------------------------- /lib/g3-histogram/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3-histogram" 3 | version = "0.2.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | thiserror.workspace = true 11 | hdrhistogram.workspace = true 12 | tokio = { workspace = true, features = ["sync", "rt", "time", "macros"] } 13 | ryu.workspace = true 14 | portable-atomic = { workspace = true, features = ["float"] } 15 | -------------------------------------------------------------------------------- /lib/g3-histogram/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod recorder; 7 | pub use recorder::HistogramRecorder; 8 | 9 | mod rotating; 10 | pub use rotating::RotatingHistogram; 11 | 12 | mod keeping; 13 | pub use keeping::KeepingHistogram; 14 | 15 | mod stats; 16 | pub use stats::HistogramStats; 17 | 18 | mod quantile; 19 | pub use quantile::Quantile; 20 | 21 | mod config; 22 | pub use config::HistogramMetricsConfig; 23 | -------------------------------------------------------------------------------- /lib/g3-http/src/client/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod error; 7 | pub use error::HttpResponseParseError; 8 | 9 | mod response; 10 | pub use response::HttpForwardRemoteResponse; 11 | 12 | mod transparent; 13 | pub use transparent::HttpTransparentResponse; 14 | 15 | mod adaptation; 16 | pub use adaptation::HttpAdaptedResponse; 17 | -------------------------------------------------------------------------------- /lib/g3-http/src/connect/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod error; 7 | pub use error::{HttpConnectError, HttpConnectResponseError}; 8 | 9 | mod request; 10 | pub use request::HttpConnectRequest; 11 | 12 | mod response; 13 | pub use response::HttpConnectResponse; 14 | 15 | pub mod client; 16 | -------------------------------------------------------------------------------- /lib/g3-http/src/header/transfer.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub fn transfer_encoding_chunked() -> &'static str { 7 | "Transfer-Encoding: chunked\r\n" 8 | } 9 | -------------------------------------------------------------------------------- /lib/g3-http/src/parse/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod error; 7 | pub use error::HttpLineParseError; 8 | 9 | mod header_line; 10 | pub use header_line::HttpHeaderLine; 11 | 12 | mod status_line; 13 | pub use status_line::HttpStatusLine; 14 | 15 | mod method_line; 16 | pub use method_line::HttpMethodLine; 17 | 18 | mod chunked_line; 19 | pub use chunked_line::HttpChunkedLine; 20 | -------------------------------------------------------------------------------- /lib/g3-http/src/server/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod error; 7 | pub use error::HttpRequestParseError; 8 | 9 | mod request; 10 | pub use request::HttpProxyClientRequest; 11 | 12 | mod transparent; 13 | pub use transparent::{HttpTransparentRequest, HttpTransparentRequestAcceptor}; 14 | 15 | mod adaptation; 16 | pub use adaptation::HttpAdaptedRequest; 17 | 18 | mod uri; 19 | pub use uri::UriExt; 20 | -------------------------------------------------------------------------------- /lib/g3-http/src/uri/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod error; 7 | pub use error::UriParseError; 8 | 9 | mod well_known; 10 | pub use well_known::WellKnownUri; 11 | 12 | mod masque; 13 | pub use masque::HttpMasque; 14 | -------------------------------------------------------------------------------- /lib/g3-icap-client/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod parse; 7 | mod reason; 8 | mod serialize; 9 | 10 | pub mod reqmod; 11 | 12 | pub mod respmod; 13 | 14 | mod options; 15 | pub use options::IcapServiceOptions; 16 | 17 | mod service; 18 | 19 | use service::{IcapClientConnection, IcapClientReader, IcapClientWriter}; 20 | pub use service::{IcapMethod, IcapServiceClient, IcapServiceConfig}; 21 | -------------------------------------------------------------------------------- /lib/g3-icap-client/src/options/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod error; 7 | pub(crate) use error::IcapOptionsParseError; 8 | 9 | mod response; 10 | pub use response::IcapServiceOptions; 11 | 12 | mod request; 13 | pub(crate) use request::IcapOptionsRequest; 14 | -------------------------------------------------------------------------------- /lib/g3-icap-client/src/parse/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod error; 7 | pub use error::IcapLineParseError; 8 | 9 | mod header_line; 10 | pub(crate) use header_line::HeaderLine; 11 | 12 | mod status_line; 13 | pub(crate) use status_line::StatusLine; 14 | -------------------------------------------------------------------------------- /lib/g3-icap-client/src/serialize/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod header; 7 | pub(crate) use header::*; 8 | -------------------------------------------------------------------------------- /lib/g3-imap-proto/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3-imap-proto" 3 | version = "0.2.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | [dependencies] 8 | thiserror.workspace = true 9 | smol_str.workspace = true 10 | memchr.workspace = true 11 | atoi.workspace = true 12 | ahash.workspace = true 13 | log.workspace = true 14 | tokio = { workspace = true, features = ["io-util"] } 15 | g3-io-ext.workspace = true 16 | -------------------------------------------------------------------------------- /lib/g3-imap-proto/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod command; 7 | pub mod response; 8 | 9 | mod pipeline; 10 | pub use pipeline::CommandPipeline; 11 | -------------------------------------------------------------------------------- /lib/g3-io-ext/src/io/buf/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod flex; 7 | pub use flex::FlexBufReader; 8 | 9 | mod limited; 10 | pub use limited::LimitedBufReader; 11 | 12 | mod once; 13 | pub use once::OnceBufReader; 14 | 15 | mod copy; 16 | pub use copy::LimitedBufCopy; 17 | 18 | const DEFAULT_BUF_SIZE: usize = 8 * 1024; 19 | -------------------------------------------------------------------------------- /lib/g3-io-ext/src/limit/token_bucket/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod stream; 7 | pub use stream::GlobalStreamLimiter; 8 | 9 | mod datagram; 10 | pub use datagram::GlobalDatagramLimiter; 11 | -------------------------------------------------------------------------------- /lib/g3-io-ext/src/listen/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod tcp; 7 | pub use tcp::LimitedTcpListener; 8 | 9 | #[cfg(feature = "rustls")] 10 | mod tls; 11 | #[cfg(feature = "rustls")] 12 | pub use tls::LimitedTlsListener; 13 | -------------------------------------------------------------------------------- /lib/g3-io-ext/src/quic/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod udp_poller; 7 | pub use udp_poller::QuinnUdpPollHelper; 8 | 9 | mod limited_socket; 10 | pub use limited_socket::{LimitedTokioRuntime, LimitedUdpSocket}; 11 | -------------------------------------------------------------------------------- /lib/g3-io-ext/src/time/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod optional_interval; 7 | pub use optional_interval::OptionalInterval; 8 | 9 | mod idle; 10 | pub use idle::{IdleCheck, IdleForceQuitReason, IdleInterval, IdleWheel}; 11 | -------------------------------------------------------------------------------- /lib/g3-json/src/callback.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use serde_json::Value; 7 | 8 | pub trait JsonMapCallback { 9 | fn type_name(&self) -> &'static str; 10 | fn parse_kv(&mut self, key: &str, value: &Value) -> anyhow::Result<()>; 11 | 12 | fn check(&mut self) -> anyhow::Result<()> { 13 | Ok(()) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lib/g3-json/src/humanize/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod size; 7 | mod time; 8 | 9 | pub use size::{as_u64, as_usize}; 10 | pub use time::as_duration; 11 | -------------------------------------------------------------------------------- /lib/g3-json/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod callback; 7 | mod map; 8 | 9 | pub mod humanize; 10 | pub mod key; 11 | pub mod value; 12 | 13 | pub use callback::JsonMapCallback; 14 | pub use map::{get_required as map_get_required, get_required_str}; 15 | -------------------------------------------------------------------------------- /lib/g3-json/src/value/acl_set/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod dst_host; 7 | 8 | pub use dst_host::as_dst_host_rule_set_builder; 9 | -------------------------------------------------------------------------------- /lib/g3-json/src/value/route/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod host; 7 | pub use host::as_host_matched_obj; 8 | 9 | mod uri_path; 10 | pub use uri_path::as_url_path_matched_obj; 11 | 12 | mod alpn; 13 | pub use alpn::as_alpn_matched_obj; 14 | -------------------------------------------------------------------------------- /lib/g3-macros/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3-macros" 3 | version = "0.1.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | [lib] 8 | proc-macro = true 9 | 10 | [dependencies] 11 | proc-macro2 = "1.0" 12 | syn = { version = "2.0", features = ["full"] } 13 | quote = "1.0" 14 | -------------------------------------------------------------------------------- /lib/g3-msgpack/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod key; 7 | pub mod value; 8 | -------------------------------------------------------------------------------- /lib/g3-msgpack/src/value/net/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod base; 7 | 8 | pub use base::as_ipaddr; 9 | 10 | #[cfg(feature = "geoip")] 11 | pub use base::as_ip_network; 12 | -------------------------------------------------------------------------------- /lib/g3-openssl/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod ffi; 7 | 8 | #[cfg(feature = "async-job")] 9 | pub mod async_job; 10 | 11 | mod ssl; 12 | #[cfg(feature = "async-job")] 13 | pub use ssl::SslAsyncModeExt; 14 | pub use ssl::{ 15 | SslAcceptor, SslConnector, SslError, SslInfoCallbackWhere, SslLazyAcceptor, SslStream, 16 | }; 17 | -------------------------------------------------------------------------------- /lib/g3-openssl/src/ssl/types/mask.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use bitflags::bitflags; 7 | 8 | bitflags! { 9 | pub struct SslInfoCallbackWhere: i32 { 10 | const LOOP = 0x01; 11 | const EXIT = 0x02; 12 | const READ = 0x04; 13 | const WRITE = 0x08; 14 | const HANDSHAKE_START = 0x10; 15 | const HANDSHAKE_DONE = 0x20; 16 | const ALERT = 0x4000; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/g3-openssl/src/ssl/types/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod mask; 7 | pub use mask::SslInfoCallbackWhere; 8 | -------------------------------------------------------------------------------- /lib/g3-resolver/src/driver/c_ares/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod driver; 7 | use driver::CAresResolver; 8 | 9 | mod config; 10 | pub use config::CAresDriverConfig; 11 | 12 | mod error; 13 | -------------------------------------------------------------------------------- /lib/g3-resolver/src/driver/fail_over/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod config; 7 | pub use config::{FailOverDriverConfig, FailOverDriverStaticConfig}; 8 | 9 | mod driver; 10 | use driver::FailOverResolver; 11 | -------------------------------------------------------------------------------- /lib/g3-resolver/src/driver/hickory/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod config; 7 | pub use config::HickoryDriverConfig; 8 | 9 | mod client; 10 | use client::{DnsRequest, HickoryClient, HickoryClientConfig}; 11 | 12 | mod driver; 13 | use driver::HickoryResolver; 14 | 15 | mod error; 16 | -------------------------------------------------------------------------------- /lib/g3-runtime/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod blended; 7 | pub mod unaided; 8 | -------------------------------------------------------------------------------- /lib/g3-smtp-proto/src/command/hello.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use g3_types::net::Host; 7 | 8 | use super::CommandLineError; 9 | 10 | pub(super) fn parse_host(msg: &[u8]) -> Result { 11 | let host_b = match memchr::memchr(b' ', msg) { 12 | Some(p) => &msg[..p], 13 | None => msg, 14 | }; 15 | Host::parse_smtp_host_address(host_b).ok_or(CommandLineError::InvalidClientHost) 16 | } 17 | -------------------------------------------------------------------------------- /lib/g3-smtp-proto/src/io/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod text_reader; 7 | pub use text_reader::TextDataReader; 8 | 9 | mod text_decoder; 10 | pub use text_decoder::TextDataDecodeReader; 11 | 12 | mod text_encoder; 13 | pub use text_encoder::TextDataEncodeTransfer; 14 | -------------------------------------------------------------------------------- /lib/g3-smtp-proto/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod command; 7 | pub mod response; 8 | 9 | pub mod io; 10 | -------------------------------------------------------------------------------- /lib/g3-smtp-proto/src/response/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod parser; 7 | pub use parser::{ReplyCode, ResponseLineError, ResponseParser}; 8 | 9 | mod encoder; 10 | pub use encoder::ResponseEncoder; 11 | -------------------------------------------------------------------------------- /lib/g3-socket/src/cmsg/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod udp; 7 | -------------------------------------------------------------------------------- /lib/g3-socket/src/connect/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod tcp; 7 | pub use tcp::TcpConnectInfo; 8 | 9 | mod udp; 10 | pub use udp::UdpConnectInfo; 11 | -------------------------------------------------------------------------------- /lib/g3-socket/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod sockopt; 7 | 8 | mod raw; 9 | pub use raw::RawSocket; 10 | 11 | mod listen; 12 | 13 | pub mod tcp; 14 | pub mod udp; 15 | pub mod util; 16 | 17 | mod bind; 18 | pub use bind::BindAddr; 19 | 20 | mod connect; 21 | pub use connect::{TcpConnectInfo, UdpConnectInfo}; 22 | 23 | pub mod cmsg; 24 | -------------------------------------------------------------------------------- /lib/g3-socket/src/sockopt/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | #[cfg(unix)] 7 | mod unix; 8 | #[cfg(unix)] 9 | pub(crate) use unix::*; 10 | 11 | #[cfg(windows)] 12 | mod windows; 13 | #[cfg(windows)] 14 | pub(crate) use windows::*; 15 | -------------------------------------------------------------------------------- /lib/g3-socks/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod types; 7 | pub use types::*; 8 | 9 | pub mod v4a; 10 | pub mod v5; 11 | -------------------------------------------------------------------------------- /lib/g3-socks/src/types/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod auth; 7 | pub use auth::SocksAuthMethod; 8 | 9 | mod error; 10 | pub use error::{ 11 | SocksConnectError, SocksNegotiationError, SocksReplyParseError, SocksRequestParseError, 12 | SocksUdpPacketError, 13 | }; 14 | 15 | mod cmd; 16 | pub use cmd::SocksCommand; 17 | 18 | mod version; 19 | pub use version::SocksVersion; 20 | -------------------------------------------------------------------------------- /lib/g3-socks/src/v4a/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::types::*; 7 | 8 | mod reply; 9 | mod request; 10 | 11 | pub use reply::SocksV4Reply; 12 | pub use request::SocksV4aRequest; 13 | 14 | pub mod client; 15 | -------------------------------------------------------------------------------- /lib/g3-socks/src/v5/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use super::types::*; 7 | 8 | mod reply; 9 | mod request; 10 | mod udp_io; 11 | 12 | pub use reply::Socks5Reply; 13 | pub use request::Socks5Request; 14 | pub use udp_io::{SocksUdpHeader, UdpInput, UdpOutput}; 15 | 16 | pub mod auth; 17 | pub mod client; 18 | 19 | #[cfg(feature = "quic")] 20 | mod quic; 21 | #[cfg(feature = "quic")] 22 | pub use quic::Socks5UdpTokioRuntime; 23 | -------------------------------------------------------------------------------- /lib/g3-statsd-client/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod sink; 7 | use sink::StatsdMetricsSink; 8 | 9 | mod client; 10 | pub use client::StatsdClient; 11 | 12 | mod tag; 13 | pub use tag::StatsdTagGroup; 14 | 15 | mod config; 16 | pub use config::{StatsdBackend, StatsdClientConfig}; 17 | -------------------------------------------------------------------------------- /lib/g3-syslog/CHANGELOG: -------------------------------------------------------------------------------- 1 | 2 | v0.4.0: 3 | - Optimization: switch to time crate and use g3-timezone for local time offsets 4 | 5 | v0.3.0: 6 | - Feature: use native async implementation 7 | 8 | v0.2.0: 9 | - Feature: escape all non-printable characters for syslog backend 10 | 11 | v0.1.0: 12 | - Initial version 13 | -------------------------------------------------------------------------------- /lib/g3-tls-cert/build.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use std::env; 7 | 8 | fn main() { 9 | println!("cargo:rustc-check-cfg=cfg(osslconf, values(\"OPENSSL_NO_SM2\"))"); 10 | 11 | if let Ok(vars) = env::var("DEP_OPENSSL_CONF") { 12 | for var in vars.split(',') { 13 | println!("cargo:rustc-cfg=osslconf=\"{var}\""); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/g3-tls-cert/src/ext/ffi.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | use libc::{c_int, c_uchar, c_uint}; 7 | use openssl_sys::RSA; 8 | 9 | unsafe extern "C" { 10 | 11 | pub fn RSA_sign_ASN1_OCTET_STRING( 12 | dummy: c_int, 13 | m: *mut c_uchar, 14 | m_len: c_uint, 15 | sigret: *mut c_uchar, 16 | siglen: *mut c_uint, 17 | rsa: *mut RSA, 18 | ) -> c_int; 19 | } 20 | -------------------------------------------------------------------------------- /lib/g3-tls-cert/src/ext/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod ffi; 7 | 8 | mod x509_builder; 9 | pub use x509_builder::X509BuilderExt; 10 | 11 | mod rsa; 12 | pub use rsa::RsaExt; 13 | 14 | mod pkey; 15 | pub use pkey::PublicKeyExt; 16 | -------------------------------------------------------------------------------- /lib/g3-tls-cert/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | pub mod builder; 7 | 8 | pub mod ext; 9 | -------------------------------------------------------------------------------- /lib/g3-tls-ticket/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod config; 7 | pub use config::TlsTicketConfig; 8 | 9 | mod source; 10 | use source::TicketSourceConfig; 11 | 12 | mod update; 13 | use update::TicketKeyUpdate; 14 | -------------------------------------------------------------------------------- /lib/g3-types/src/acl_set/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod dst_host; 7 | 8 | pub use dst_host::{AclDstHostRuleSet, AclDstHostRuleSetBuilder}; 9 | -------------------------------------------------------------------------------- /lib/g3-types/src/auth/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod error; 7 | mod user; 8 | 9 | pub use error::{AuthParseError, UserAuthError}; 10 | pub use user::{Password, Username}; 11 | 12 | #[cfg(feature = "auth-crypt")] 13 | mod crypt; 14 | 15 | #[cfg(feature = "auth-crypt")] 16 | pub use crypt::FastHashedPassPhrase; 17 | -------------------------------------------------------------------------------- /lib/g3-types/src/collection/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod named_value; 7 | mod selective_vec; 8 | mod weighted_value; 9 | 10 | pub use named_value::NamedValue; 11 | pub use selective_vec::{SelectiveItem, SelectivePickPolicy, SelectiveVec, SelectiveVecBuilder}; 12 | pub use weighted_value::WeightedValue; 13 | -------------------------------------------------------------------------------- /lib/g3-types/src/error/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod str; 7 | 8 | pub use self::str::FoundInvalidChar; 9 | -------------------------------------------------------------------------------- /lib/g3-types/src/ext/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod option; 7 | pub use option::OptionExt; 8 | 9 | mod duration; 10 | pub use duration::DurationExt; 11 | 12 | mod net; 13 | pub use net::SocketAddrExt; 14 | -------------------------------------------------------------------------------- /lib/g3-types/src/fs/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod file; 7 | 8 | pub use file::ConfigFileFormat; 9 | -------------------------------------------------------------------------------- /lib/g3-types/src/limit/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod gauge_semaphore; 7 | pub use gauge_semaphore::{GaugeSemaphore, GaugeSemaphoreAcquireError, GaugeSemaphorePermit}; 8 | 9 | mod rate_limit_quota; 10 | pub use rate_limit_quota::RateLimitQuotaConfig; 11 | 12 | mod stream_speed; 13 | pub use stream_speed::GlobalStreamSpeedLimitConfig; 14 | 15 | mod datagram_speed; 16 | pub use datagram_speed::GlobalDatagramSpeedLimitConfig; 17 | -------------------------------------------------------------------------------- /lib/g3-types/src/log/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod drop; 7 | mod stats; 8 | 9 | pub use drop::LogDropType; 10 | pub use stats::{LogDropSnapshot, LogDropStats, LogIoSnapshot, LogIoStats, LogSnapshot, LogStats}; 11 | 12 | #[cfg(feature = "async-log")] 13 | mod async_log; 14 | 15 | #[cfg(feature = "async-log")] 16 | pub use async_log::{AsyncLogConfig, AsyncLogFormatter, AsyncLogger}; 17 | -------------------------------------------------------------------------------- /lib/g3-types/src/metrics/tag/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod name; 7 | pub use name::MetricTagName; 8 | 9 | mod value; 10 | pub use value::MetricTagValue; 11 | 12 | mod map; 13 | pub use map::MetricTagMap; 14 | -------------------------------------------------------------------------------- /lib/g3-types/src/net/dns/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod encryption; 7 | 8 | pub use encryption::DnsEncryptionProtocol; 9 | #[cfg(feature = "rustls")] 10 | pub use encryption::{DnsEncryptionConfig, DnsEncryptionConfigBuilder}; 11 | -------------------------------------------------------------------------------- /lib/g3-types/src/net/http/capability/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod forward; 7 | 8 | pub use forward::HttpForwardCapability; 9 | -------------------------------------------------------------------------------- /lib/g3-types/src/net/http/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod auth; 7 | mod capability; 8 | mod header; 9 | mod keepalive; 10 | mod proxy; 11 | mod upgrade; 12 | 13 | pub use auth::{HttpAuth, HttpBasicAuth}; 14 | pub use capability::*; 15 | pub use header::*; 16 | pub use keepalive::HttpKeepAliveConfig; 17 | pub use proxy::HttpProxySubProtocol; 18 | pub use upgrade::{HttpUpgradeToken, HttpUpgradeTokenParseError}; 19 | -------------------------------------------------------------------------------- /lib/g3-types/src/net/http/proxy/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod protocol; 7 | pub use protocol::HttpProxySubProtocol; 8 | -------------------------------------------------------------------------------- /lib/g3-types/src/net/http/proxy/protocol.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] 7 | pub enum HttpProxySubProtocol { 8 | TcpConnect, 9 | HttpForward, 10 | HttpsForward, 11 | FtpOverHttp, 12 | } 13 | -------------------------------------------------------------------------------- /lib/g3-types/src/net/port/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod ports; 7 | pub use ports::Ports; 8 | 9 | mod port_range; 10 | pub use port_range::PortRange; 11 | -------------------------------------------------------------------------------- /lib/g3-types/src/net/quinn/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod transport; 7 | pub use transport::QuinnTransportConfigBuilder; 8 | -------------------------------------------------------------------------------- /lib/g3-types/src/net/socks/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod auth; 7 | pub use auth::SocksAuth; 8 | -------------------------------------------------------------------------------- /lib/g3-types/src/net/tcp/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod connect; 7 | mod keepalive; 8 | mod listen; 9 | mod sockopt; 10 | 11 | pub use connect::{HappyEyeballsConfig, TcpConnectConfig}; 12 | pub use listen::TcpListenConfig; 13 | 14 | pub use keepalive::TcpKeepAliveConfig; 15 | pub use sockopt::TcpMiscSockOpts; 16 | -------------------------------------------------------------------------------- /lib/g3-types/src/net/udp/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod listen; 7 | pub use listen::UdpListenConfig; 8 | 9 | mod sockopt; 10 | pub use sockopt::UdpMiscSockOpts; 11 | -------------------------------------------------------------------------------- /lib/g3-types/src/route/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod host; 7 | pub use host::HostMatch; 8 | 9 | mod uri_path; 10 | pub use uri_path::UriPathMatch; 11 | 12 | mod alpn; 13 | pub use alpn::AlpnMatch; 14 | -------------------------------------------------------------------------------- /lib/g3-udpdump/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2024-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod dissector; 7 | pub use dissector::ExportedPduDissectorHint; 8 | 9 | mod stream; 10 | pub use stream::{ 11 | StreamDumpConfig, StreamDumpProxyAddresses, StreamDumper, ToClientStreamDumpWriter, 12 | ToRemoteStreamDumpWriter, 13 | }; 14 | -------------------------------------------------------------------------------- /lib/g3-xcrypt/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "g3-xcrypt" 3 | version = "0.3.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | thiserror.workspace = true 11 | memchr.workspace = true 12 | openssl.workspace = true 13 | constant_time_eq.workspace = true 14 | -------------------------------------------------------------------------------- /lib/g3-xcrypt/src/b64/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod encode; 7 | pub use encode::B64CryptEncoder; 8 | 9 | mod decode; 10 | pub(crate) use decode::B64CryptDecoder; 11 | -------------------------------------------------------------------------------- /lib/g3-yaml/src/humanize/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod size; 7 | pub use size::{as_u32, as_u64, as_usize}; 8 | 9 | mod time; 10 | pub use time::as_duration; 11 | -------------------------------------------------------------------------------- /lib/g3-yaml/src/value/acl_set/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod dst_host; 7 | 8 | pub use dst_host::as_dst_host_rule_set_builder; 9 | -------------------------------------------------------------------------------- /lib/g3-yaml/src/value/route/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * Copyright 2023-2025 ByteDance and/or its affiliates. 4 | */ 5 | 6 | mod host; 7 | pub use host::as_host_matched_obj; 8 | 9 | mod uri_path; 10 | pub use uri_path::as_url_path_matched_obj; 11 | 12 | mod alpn; 13 | pub use alpn::{as_alpn_matched_backends, as_alpn_matched_obj}; 14 | -------------------------------------------------------------------------------- /scripts/build_rpm_from_tar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | SCRIPTS_DIR=$(dirname "$0") 6 | PROJECT_DIR=$(realpath "${SCRIPTS_DIR}/..") 7 | 8 | cd "${PROJECT_DIR}" 9 | 10 | export RUSTFLAGS="--remap-path-prefix ${HOME}=~" 11 | 12 | rpmbuild -bb --build-in-place *.spec 13 | -------------------------------------------------------------------------------- /scripts/capnp-generate/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "capnp-generate" 3 | version = "0.1.0" 4 | license.workspace = true 5 | edition.workspace = true 6 | 7 | [dependencies] 8 | anyhow.workspace = true 9 | clap.workspace = true 10 | capnpc.workspace = true 11 | -------------------------------------------------------------------------------- /scripts/coverage/enter.sh: -------------------------------------------------------------------------------- 1 | RUSTFLAGS="-C instrument-coverage" 2 | LLVM_PROFILE_FILE="${TEST_NAME}-%p-%m.profraw" 3 | PROF_DATA_FILE="${TEST_NAME}.profdata" 4 | 5 | clear_profiles() 6 | { 7 | find . -type f -regex ".*/${TEST_NAME}.*\.profraw" -exec rm \{\} \; 8 | [ ! -f "${PROF_DATA_FILE}" ] || rm "${PROF_DATA_FILE}" 9 | } 10 | 11 | cd "${PROJECT_DIR}" 12 | 13 | clear_profiles 14 | trap clear_profiles EXIT 15 | 16 | export RUSTFLAGS LLVM_PROFILE_FILE 17 | -------------------------------------------------------------------------------- /scripts/coverage/g3bench/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.pem 3 | -------------------------------------------------------------------------------- /scripts/coverage/g3bench/dnsmasq.conf: -------------------------------------------------------------------------------- 1 | resolv-file=/etc/resolv.conf.backup 2 | 3 | listen-address=127.0.0.1 4 | bind-interfaces 5 | 6 | address=/httpbin.local/127.0.0.1 7 | address=/g3proxy.local/127.0.0.1 8 | -------------------------------------------------------------------------------- /scripts/coverage/g3bench/target_openssl.sh: -------------------------------------------------------------------------------- 1 | 2 | g3bench openssl httpbin.local:9443 --tls-ca-cert "${TEST_CA_CERT_FILE}" 3 | 4 | g3bench openssl 127.0.0.1:9443 --tls-name httpbin.local --tls-ca-cert "${TEST_CA_CERT_FILE}" 5 | -------------------------------------------------------------------------------- /scripts/coverage/g3bench/target_rustls.sh: -------------------------------------------------------------------------------- 1 | 2 | g3bench rustls httpbin.local:9443 --tls-ca-cert "${TEST_CA_CERT_FILE}" 3 | 4 | g3bench rustls 127.0.0.1:9443 --tls-name httpbin.local --tls-ca-cert "${TEST_CA_CERT_FILE}" 5 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.pem 3 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/0000_all_resolver/g3proxy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | log: discard 4 | 5 | stat: 6 | target: 7 | udp: 127.0.0.1:8125 8 | 9 | resolver: 10 | - name: cares1 11 | type: c-ares 12 | - name: cares2 13 | type: c-ares 14 | server: 127.0.0.1 15 | - name: main 16 | type: fail_over 17 | primary: cares1 18 | standby: cares2 19 | - name: hickory 20 | type: hickory 21 | server: 127.0.0.1 22 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/0003_base_tcp_stream/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | python3 "${PROJECT_DIR}/g3proxy/ci/python3+curl/test_httpbin.py" -T http://httpbin.local:8080 4 | 5 | python3 "${PROJECT_DIR}/g3proxy/ci/python3+curl/test_httpbin.py" -T https://httpbin.local:8443 --ca-cert "${TEST_CA_CERT_FILE}" 6 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/0003_chain_tcp_stream/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | python3 "${PROJECT_DIR}/g3proxy/ci/python3+curl/test_httpbin.py" -T http://httpbin.local:8080 4 | 5 | python3 "${PROJECT_DIR}/g3proxy/ci/python3+curl/test_httpbin.py" -T https://httpbin.local:8443 --ca-cert "${TEST_CA_CERT_FILE}" 6 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/0005_transparent_proxy/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | python3 "${PROJECT_DIR}/g3proxy/ci/python3+curl/test_httpbin.py" -T http://httpbin.local:8080 --resolve httpbin.local:8080:[::1] --no-auth 4 | python3 "${PROJECT_DIR}/g3proxy/ci/python3+curl/test_httpbin.py" -T https://httpbin.local:8443 --resolve httpbin.local:8443:[::1] --no-auth --ca-cert "${TEST_CA_CERT_FILE}" 5 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/0007_chain_socks_proxy/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | HTTP_PROXY="http://127.0.0.1:8080" 5 | test_http_proxy_http_forward 6 | # FTP not supported in proxy escaper 7 | #test_http_proxy_ftp_over_http 8 | 9 | 10 | for port in 1080 1081 1082 1083 11 | do 12 | SOCKS5_PROXY="socks5h://127.0.0.1:${port}" 13 | test_socks5_proxy_http 14 | test_socks5_proxy_dns 15 | 16 | 17 | SOCKS4_PROXY="socks4a://127.0.0.1:${port}" 18 | test_socks4_proxy_http 19 | done 20 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/0010_escaper_direct_float/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | g3proxy_ctl escaper direct_lazy publish "{\"ipv4\": \"127.0.0.1\"}" 5 | 6 | 7 | HTTP_PROXY="http://127.0.0.1:8080" 8 | test_http_proxy_http_forward 9 | test_http_proxy_ftp_over_http 10 | 11 | 12 | for port in 1080 1081 13 | do 14 | SOCKS5_PROXY="socks5h://127.0.0.1:${port}" 15 | test_socks5_proxy_http 16 | test_socks5_proxy_dns 17 | 18 | 19 | SOCKS4_PROXY="socks4a://127.0.0.1:${port}" 20 | test_socks4_proxy_http 21 | done 22 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/0012_intelli_proxy/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | HTTP_PROXY="http://127.0.0.1:9000" 5 | test_http_proxy_http_forward 6 | # FTP not supported in proxy escaper 7 | #test_http_proxy_ftp_over_http 8 | test_http_proxy_https_connect 9 | test_http_proxy_https_forward 10 | 11 | 12 | SOCKS5_PROXY="socks5h://127.0.0.1:9000" 13 | test_socks5_proxy_http 14 | test_socks5_proxy_dns 15 | 16 | 17 | SOCKS4_PROXY="socks4a://127.0.0.1:9000" 18 | test_socks4_proxy_http 19 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/0013_dynamic_user/group_3.lua: -------------------------------------------------------------------------------- 1 | 2 | local script_dir = __file__:match("(.*/)") 3 | local file = io.open(string.format("%s%s", script_dir, "group_1.json"), "r") 4 | local content = file:read "*a" 5 | file:close() 6 | -- return the json encoded string 7 | return content 8 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/0013_dynamic_user/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | g3proxy_ctl user-group g2 publish-user ${TESTCASE_DIR}/group_2.json 5 | 6 | 7 | for port in 8080 8081 8082 8083 8 | do 9 | for user in "t1:toor" "t2:toor" "t3:toor" 10 | do 11 | HTTP_PROXY="http://${user}@127.0.0.1:${port}" 12 | test_http_proxy_http_forward 13 | test_http_proxy_ftp_over_http 14 | done 15 | done 16 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/0014_escaper_failover/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | HTTP_PROXY="http://127.0.0.1:8080" 5 | test_http_proxy_http_forward 6 | test_http_proxy_ftp_over_http 7 | test_http_proxy_https_connect 8 | test_http_proxy_https_forward 9 | 10 | 11 | for port in 1080 1081 12 | do 13 | SOCKS5_PROXY="socks5h://127.0.0.1:${port}" 14 | test_socks5_proxy_http 15 | test_socks5_proxy_dns 16 | 17 | 18 | SOCKS4_PROXY="socks4a://127.0.0.1:${port}" 19 | test_socks4_proxy_http 20 | done 21 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/0015_escaper_geoip/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | HTTP_PROXY="http://127.0.0.1:8080" 5 | test_http_proxy_http_forward 6 | test_http_proxy_ftp_over_http 7 | test_http_proxy_https_connect 8 | test_http_proxy_https_forward 9 | 10 | 11 | for port in 1080 1081 12 | do 13 | SOCKS5_PROXY="socks5h://127.0.0.1:${port}" 14 | test_socks5_proxy_http 15 | test_socks5_proxy_dns 16 | 17 | 18 | SOCKS4_PROXY="socks4a://127.0.0.1:${port}" 19 | test_socks4_proxy_http 20 | done 21 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/0016_resolve_failover/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ## 4 | for resolver in google-first local-first local 5 | do 6 | echo "==== Query directly on resolver ${resolver}" 7 | resolver_query_verify ${resolver} g3proxy.local 127.0.0.1 8 | resolver_query_verify ${resolver} httpbin.local 127.0.0.1 9 | done 10 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/0020_audit_base/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | HTTP_PROXY="http://127.0.0.1:8080" 5 | test_http_proxy_http_forward 6 | test_http_proxy_ftp_over_http 7 | test_http_proxy_https_connect 8 | test_http_proxy_https_forward 9 | test_http_proxy_h2 10 | 11 | 12 | SOCKS5_PROXY="socks5h://127.0.0.1:1080" 13 | test_socks5_proxy_http 14 | test_socks5_proxy_dns 15 | 16 | 17 | SOCKS4_PROXY="socks4a://127.0.0.1:1080" 18 | test_socks4_proxy_http 19 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/0021_audit_icap_preview/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | HTTP_PROXY="http://127.0.0.1:8080" 5 | test_http_proxy_http_forward 6 | test_http_proxy_ftp_over_http 7 | test_http_proxy_https_connect 8 | test_http_proxy_https_forward 9 | test_http_proxy_h2 10 | 11 | 12 | SOCKS5_PROXY="socks5h://127.0.0.1:1080" 13 | test_socks5_proxy_http 14 | test_socks5_proxy_dns 15 | 16 | 17 | SOCKS4_PROXY="socks4a://127.0.0.1:1080" 18 | test_socks4_proxy_http 19 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/0022_audit_icap_no_preview/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | HTTP_PROXY="http://127.0.0.1:8080" 5 | test_http_proxy_http_forward 6 | test_http_proxy_ftp_over_http 7 | test_http_proxy_https_connect 8 | test_http_proxy_https_forward 9 | test_http_proxy_h2 10 | 11 | 12 | SOCKS5_PROXY="socks5h://127.0.0.1:1080" 13 | test_socks5_proxy_http 14 | test_socks5_proxy_dns 15 | 16 | 17 | SOCKS4_PROXY="socks4a://127.0.0.1:1080" 18 | test_socks4_proxy_http 19 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/0023_audit_user/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | for user in t1:toor t2:toor t3:toor 5 | do 6 | HTTP_PROXY="http://${user}@127.0.0.1:8080" 7 | test_http_proxy_http_forward 8 | # test_http_proxy_ftp_over_http 9 | test_http_proxy_https_connect 10 | test_http_proxy_https_forward 11 | test_http_proxy_h2 12 | 13 | 14 | SOCKS5_PROXY="socks5h://${user}@127.0.0.1:1080" 15 | test_socks5_proxy_http 16 | # test_socks5_proxy_dns 17 | done 18 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/1000_worker_base/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | HTTP_PROXY="http://127.0.0.1:8080" 5 | test_http_proxy_http_forward 6 | test_http_proxy_ftp_over_http 7 | 8 | 9 | SOCKS5_PROXY="socks5h://127.0.0.1:1080" 10 | test_socks5_proxy_http 11 | test_socks5_proxy_dns 12 | 13 | 14 | SOCKS4_PROXY="socks4a://127.0.0.1:1080" 15 | test_socks4_proxy_http 16 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/1001_worker_sched/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | HTTP_PROXY="http://127.0.0.1:8080" 5 | test_http_proxy_http_forward 6 | test_http_proxy_ftp_over_http 7 | 8 | 9 | SOCKS5_PROXY="socks5h://127.0.0.1:1080" 10 | test_socks5_proxy_http 11 | test_socks5_proxy_dns 12 | 13 | 14 | SOCKS4_PROXY="socks4a://127.0.0.1:1080" 15 | test_socks4_proxy_http 16 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/1002_worker_listen/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | HTTP_PROXY="http://127.0.0.1:8080" 5 | test_http_proxy_http_forward 6 | test_http_proxy_ftp_over_http 7 | 8 | 9 | SOCKS5_PROXY="socks5h://127.0.0.1:1080" 10 | test_socks5_proxy_http 11 | test_socks5_proxy_dns 12 | 13 | 14 | SOCKS4_PROXY="socks4a://127.0.0.1:1080" 15 | test_socks4_proxy_http 16 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/1003_worker_multi_rt/testcases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | HTTP_PROXY="http://127.0.0.1:8080" 5 | test_http_proxy_http_forward 6 | test_http_proxy_ftp_over_http 7 | 8 | 9 | SOCKS5_PROXY="socks5h://127.0.0.1:1080" 10 | test_socks5_proxy_http 11 | test_socks5_proxy_dns 12 | 13 | 14 | SOCKS4_PROXY="socks4a://127.0.0.1:1080" 15 | test_socks4_proxy_http 16 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/dnsmasq.conf: -------------------------------------------------------------------------------- 1 | resolv-file=/etc/resolv.conf.backup 2 | 3 | listen-address=127.0.0.1 4 | bind-interfaces 5 | 6 | address=/httpbin.local/127.0.0.1 7 | address=/g3proxy.local/127.0.0.1 8 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/g3fcgen.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | runtime: 4 | thread_number: 1 5 | 6 | stat: 7 | target: 8 | udp: 127.0.0.1:8125 9 | 10 | backend: 11 | ca_certificate: rootCA.pem 12 | ca_private_key: rootCA-key.pem 13 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/g3iploc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | stat: 4 | target: 5 | udp: 127.0.0.1:8125 6 | 7 | geoip_db: 8 | country: ip_location.csv 9 | -------------------------------------------------------------------------------- /scripts/coverage/g3proxy/ip_location.csv: -------------------------------------------------------------------------------- 1 | #network,country 2 | 127.0.0.0/8,CN 3 | -------------------------------------------------------------------------------- /scripts/generate/country/iso3166_alpha2.awk: -------------------------------------------------------------------------------- 1 | 2 | BEGIN { 3 | print "const ALL_ALPHA2_CODES: &[&str] = &["; 4 | } 5 | 6 | $1 ~ "^#.*" { 7 | next; 8 | } 9 | 10 | { 11 | print " \""$1"\", /* "$5" */"; 12 | } 13 | 14 | END { 15 | print "];"; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /scripts/generate/country/iso3166_alpha3.awk: -------------------------------------------------------------------------------- 1 | 2 | BEGIN { 3 | print "const ALL_ALPHA3_CODES: &[&str] = &["; 4 | } 5 | 6 | $1 ~ "^#.*" { 7 | next; 8 | } 9 | 10 | { 11 | print " \""$2"\", /* "$5" */"; 12 | } 13 | 14 | END { 15 | print "];"; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /scripts/generate/country/iso3166_continent.awk: -------------------------------------------------------------------------------- 1 | 2 | BEGIN { 3 | print " pub fn continent(&self) -> ContinentCode {"; 4 | print " match self {"; 5 | } 6 | 7 | $1 ~ "^#.*" { 8 | next; 9 | } 10 | 11 | { 12 | print " IsoCountryCode::"$1" => ContinentCode::"$9","; 13 | } 14 | 15 | END { 16 | print " }"; 17 | print " }"; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /scripts/generate/country/iso3166_enum.awk: -------------------------------------------------------------------------------- 1 | 2 | BEGIN {} 3 | 4 | $1 ~ "^#.*" { 5 | next; 6 | } 7 | 8 | { 9 | print " "$1", /* "$2" - "$5" */"; 10 | } 11 | 12 | END {} 13 | 14 | -------------------------------------------------------------------------------- /scripts/generate/country/iso3166_from_alpha2_str.awk: -------------------------------------------------------------------------------- 1 | 2 | $1 ~ "^#.*" { 3 | next; 4 | } 5 | 6 | { 7 | print " \""$1"\" => Ok(IsoCountryCode::"$1"),"; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /scripts/generate/country/iso3166_from_alpha3_str.awk: -------------------------------------------------------------------------------- 1 | 2 | $1 ~ "^#.*" { 3 | next; 4 | } 5 | 6 | { 7 | print " \""$2"\" => Ok(IsoCountryCode::"$1"),"; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /scripts/generate/country/iso3166_names.awk: -------------------------------------------------------------------------------- 1 | 2 | BEGIN { 3 | print "const ALL_COUNTRY_NAMES: &[&str] = &["; 4 | } 5 | 6 | $1 ~ "^#.*" { 7 | next; 8 | } 9 | 10 | { 11 | print " \""$5"\","; 12 | } 13 | 14 | END { 15 | print "];"; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /scripts/generate/country/iso3166_variant_count.awk: -------------------------------------------------------------------------------- 1 | 2 | BEGIN { 3 | LAST_CODE="AN" 4 | } 5 | 6 | $1 ~ "^#.*" { 7 | next; 8 | } 9 | 10 | { 11 | LAST_CODE=$1; 12 | } 13 | 14 | END { 15 | print " pub fn variant_count() -> usize {"; 16 | print " Self::"LAST_CODE" as usize"; 17 | print " }"; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /scripts/package/detect_c-ares_feature.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if $(pkg-config --atleast-version 1.13.0 libcares) 6 | then 7 | echo "c-ares" 8 | else 9 | echo "vendored-c-ares" 10 | fi 11 | 12 | -------------------------------------------------------------------------------- /scripts/package/detect_lua_feature.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if $(pkg-config --exists lua) 6 | then 7 | pkg-config --variable=lib_name lua | tr -d '.' 8 | else 9 | for lib in lua54 lua53 lua51 10 | do 11 | if $(pkg-config --exists ${lib}) 12 | then 13 | echo "${lib}" 14 | break 15 | fi 16 | done 17 | fi 18 | 19 | -------------------------------------------------------------------------------- /scripts/package/detect_openssl_feature.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if $(pkg-config --atleast-version 1.1.1 libssl) 6 | then 7 | : 8 | else 9 | echo "vendored-openssl" 10 | fi 11 | 12 | -------------------------------------------------------------------------------- /scripts/release/prepare_rpm_spec.awk: -------------------------------------------------------------------------------- 1 | 2 | BEGIN { 3 | OLD_VERSION = ""; 4 | } 5 | 6 | $1 == "Version:" { 7 | OLD_VERSION = $2; 8 | # escape '+' in version string 9 | sub("[+]", "[+]", OLD_VERSION) 10 | sub(OLD_VERSION, VERSION, $0) 11 | print $0; 12 | next; 13 | } 14 | 15 | $1 == "%changelog" { 16 | exit 0; 17 | } 18 | 19 | { 20 | print $0; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /scripts/release/useless_patch.awk: -------------------------------------------------------------------------------- 1 | 2 | $0 ~ /^warning: Patch .* was not used in the crate graph.$/ { 3 | print substr($3,2)"/"substr($4,2); 4 | } 5 | 6 | $0 ~ /^Patch .* was not used in the crate graph.$/ { 7 | print substr($2,2)"/"substr($3,2); 8 | } 9 | -------------------------------------------------------------------------------- /sphinx/README.md: -------------------------------------------------------------------------------- 1 | 2 | This directory contains the sphinx docs for supported components, you can generate html docs for each component in 3 | its sub dir. 4 | 5 | The [conf.py](conf.py) file is intended to be used by [Read the Docs](https://about.readthedocs.com/). 6 | 7 | The [requirements.txt](requirements.txt) contains all the required python3 modules. 8 | -------------------------------------------------------------------------------- /sphinx/conf.py: -------------------------------------------------------------------------------- 1 | # File: docs/conf.py 2 | 3 | extensions = [ 4 | "multiproject", 5 | ] 6 | 7 | # Define the projects that will share this configuration file. 8 | multiproject_projects = { 9 | "project": { 10 | "path": "project", 11 | }, 12 | "g3proxy": { 13 | "path": "g3proxy", 14 | }, 15 | "g3tiles": { 16 | "path": "g3tiles", 17 | }, 18 | "g3statsd": { 19 | "path": "g3statsd", 20 | }, 21 | "g3keymess": { 22 | "path": "g3keymess", 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /sphinx/g3keymess/.gitignore: -------------------------------------------------------------------------------- 1 | _build 2 | -------------------------------------------------------------------------------- /sphinx/g3keymess/_static/.place-holder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/g3/4b629c469b5f0d59c05d626d0295f9d9e09a9b14/sphinx/g3keymess/_static/.place-holder -------------------------------------------------------------------------------- /sphinx/g3keymess/_templates/.place-holder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/g3/4b629c469b5f0d59c05d626d0295f9d9e09a9b14/sphinx/g3keymess/_templates/.place-holder -------------------------------------------------------------------------------- /sphinx/g3keymess/configuration/stat.rst: -------------------------------------------------------------------------------- 1 | .. _configuration_stat: 2 | 3 | **** 4 | Stat 5 | **** 6 | 7 | This file described the stat config, which is optional and can not be reloaded. 8 | If set, it must reside in the main conf file. 9 | 10 | The value should be of type :ref:`statsd client config `, 11 | with the default *prefix* set to "g3keymess". 12 | -------------------------------------------------------------------------------- /sphinx/g3keymess/configuration/values/index.rst: -------------------------------------------------------------------------------- 1 | ****************** 2 | Common Value Types 3 | ****************** 4 | 5 | There are many common values used across this document. 6 | The meanings and formats of them are described as follows: 7 | 8 | .. toctree:: 9 | 10 | base 11 | fs 12 | metrics 13 | network 14 | runtime 15 | tls 16 | -------------------------------------------------------------------------------- /sphinx/g3keymess/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to g3keymess's documentation! 2 | ===================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | Configuration Reference 8 | Metrics Definition 9 | Log Format 10 | -------------------------------------------------------------------------------- /sphinx/g3keymess/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx 2 | sphinx-rtd-theme 3 | -------------------------------------------------------------------------------- /sphinx/g3proxy/.gitignore: -------------------------------------------------------------------------------- 1 | _build 2 | -------------------------------------------------------------------------------- /sphinx/g3proxy/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the sphinx docs about the configuration & metrics & logs for g3proxy. 2 | 3 | To view the docs: 4 | 5 | 1. [install sphinx](https://www.sphinx-doc.org/en/master/usage/installation.html) 6 | 2. run `make html` in this directory 7 | 3. open *_build/html/index.html* with your favourite browser 8 | -------------------------------------------------------------------------------- /sphinx/g3proxy/_static/.place-holder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/g3/4b629c469b5f0d59c05d626d0295f9d9e09a9b14/sphinx/g3proxy/_static/.place-holder -------------------------------------------------------------------------------- /sphinx/g3proxy/_templates/.place-holder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/g3/4b629c469b5f0d59c05d626d0295f9d9e09a9b14/sphinx/g3proxy/_templates/.place-holder -------------------------------------------------------------------------------- /sphinx/g3proxy/configuration/escapers/dummy_deny.rst: -------------------------------------------------------------------------------- 1 | .. _configuration_escaper_dummy_deny: 2 | 3 | ********** 4 | dummy_deny 5 | ********** 6 | 7 | This is the dummy escaper designed to deny all requests. 8 | 9 | There is no path selection support for this escaper. 10 | 11 | Config Keys 12 | =========== 13 | 14 | The following common keys are supported: 15 | 16 | * :ref:`extra_metrics_tags ` 17 | -------------------------------------------------------------------------------- /sphinx/g3proxy/configuration/resolvers/deny_all.rst: -------------------------------------------------------------------------------- 1 | .. _configuration_resolver_deny_all: 2 | 3 | deny_all 4 | ======== 5 | 6 | This is the dummy resolver designed to drop all requests. 7 | 8 | There are no extra config keys for this kind of resolver. 9 | -------------------------------------------------------------------------------- /sphinx/g3proxy/configuration/servers/dummy_close.rst: -------------------------------------------------------------------------------- 1 | .. _configuration_server_dummy_close: 2 | 3 | dummy_close 4 | =========== 5 | 6 | This is the dummy server designed to close all connections. 7 | 8 | There are no extra config keys for this kind of server. 9 | -------------------------------------------------------------------------------- /sphinx/g3proxy/configuration/stat.rst: -------------------------------------------------------------------------------- 1 | .. _configuration_stat: 2 | 3 | **** 4 | Stat 5 | **** 6 | 7 | This file described the stat config, which is optional and can not be reloaded. 8 | If set, it must reside in the main conf file. 9 | 10 | The value should be of type :ref:`statsd client config `, 11 | with the default *prefix* set to "g3proxy". 12 | -------------------------------------------------------------------------------- /sphinx/g3proxy/configuration/values/index.rst: -------------------------------------------------------------------------------- 1 | 2 | ****************** 3 | Common Value Types 4 | ****************** 5 | 6 | There are many common values used across this document. 7 | The meanings and formats of them are described as follows: 8 | 9 | .. toctree:: 10 | 11 | base 12 | fs 13 | network 14 | acl 15 | audit 16 | db 17 | dpi 18 | tls 19 | quic 20 | rate_limit 21 | resolve 22 | metrics 23 | route 24 | runtime 25 | geoip 26 | -------------------------------------------------------------------------------- /sphinx/g3proxy/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to g3proxy's documentation! 2 | =================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | Configuration Reference 8 | Protocol Details 9 | Metrics Definition 10 | Log Format 11 | -------------------------------------------------------------------------------- /sphinx/g3proxy/log/resolve/deny_all.rst: -------------------------------------------------------------------------------- 1 | .. _log_resolve_deny_all: 2 | 3 | ******** 4 | deny-all 5 | ******** 6 | 7 | The deny-all resolver won't generate any logs, as all the queries will be denied. 8 | -------------------------------------------------------------------------------- /sphinx/g3proxy/log/resolve/fail_over.rst: -------------------------------------------------------------------------------- 1 | .. _log_resolve_fail_over: 2 | 3 | ********* 4 | fail-over 5 | ********* 6 | 7 | The error log generated by resolvers of type fail-over. 8 | 9 | The keys are mainly the config options of the resolver. 10 | 11 | next_primary 12 | ------------ 13 | 14 | **required**, **type**: string 15 | 16 | The primary next resolver. 17 | 18 | next_standby 19 | ------------ 20 | 21 | **required**, **type**: string 22 | 23 | The standby next resolver. 24 | -------------------------------------------------------------------------------- /sphinx/g3proxy/protocol/client/socks5_custom_reply.rst: -------------------------------------------------------------------------------- 1 | .. _protocol_client_socks5_custom_reply: 2 | 3 | ################### 4 | Socks5 Custom Reply 5 | ################### 6 | 7 | In addition to the standard reply field defined in `rfc1928`_, the following reply field are also used: 8 | 9 | * X'09' Connection timeout 10 | 11 | .. _rfc1928: https://tools.ietf.org/html/rfc1928 12 | -------------------------------------------------------------------------------- /sphinx/g3proxy/protocol/helper/icap_http.rst: -------------------------------------------------------------------------------- 1 | .. _protocol_helper_icap_http: 2 | 3 | ============= 4 | ICAP for HTTP 5 | ============= 6 | 7 | g3proxy support to enable ICAP reqmod and respmod services for HTTP 1.x request and response. 8 | 9 | The following headers will be added in the ICAP request header: 10 | 11 | - X-HTTP-Upgrade 12 | 13 | The Upgrade header in request will be converted to X-HTTP-Upgrade header in ICAP request with the same value. 14 | -------------------------------------------------------------------------------- /sphinx/g3proxy/protocol/setup/index.rst: -------------------------------------------------------------------------------- 1 | .. _protocol_setup: 2 | 3 | ########### 4 | Setup Guide 5 | ########### 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | Transparent Proxy 11 | Wireshark Udpdump 12 | -------------------------------------------------------------------------------- /sphinx/g3proxy/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx 2 | sphinx-rtd-theme 3 | -------------------------------------------------------------------------------- /sphinx/g3statsd/.gitignore: -------------------------------------------------------------------------------- 1 | _build 2 | -------------------------------------------------------------------------------- /sphinx/g3statsd/_static/.place-holder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/g3/4b629c469b5f0d59c05d626d0295f9d9e09a9b14/sphinx/g3statsd/_static/.place-holder -------------------------------------------------------------------------------- /sphinx/g3statsd/_templates/.place-holder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/g3/4b629c469b5f0d59c05d626d0295f9d9e09a9b14/sphinx/g3statsd/_templates/.place-holder -------------------------------------------------------------------------------- /sphinx/g3statsd/configuration/collector/discard.rst: -------------------------------------------------------------------------------- 1 | .. _configuration_collector_discard: 2 | 3 | discard 4 | ======= 5 | 6 | This is the discard collector designed to discard all received metrics from importer. 7 | 8 | There are no extra config keys for this kind of collector. 9 | -------------------------------------------------------------------------------- /sphinx/g3statsd/configuration/exporter/console.rst: -------------------------------------------------------------------------------- 1 | .. _configuration_exporter_console: 2 | 3 | console 4 | ======= 5 | 6 | This is the console exporter designed to log all received metrics from collector to stdout. 7 | 8 | There are no extra config keys for this kind of exporter. 9 | -------------------------------------------------------------------------------- /sphinx/g3statsd/configuration/exporter/discard.rst: -------------------------------------------------------------------------------- 1 | .. _configuration_exporter_discard: 2 | 3 | discard 4 | ======= 5 | 6 | This is the discard exporter designed to discard all received metrics from collector. 7 | 8 | There are no extra config keys for this kind of exporter. 9 | -------------------------------------------------------------------------------- /sphinx/g3statsd/configuration/exporter/memory.rst: -------------------------------------------------------------------------------- 1 | .. _configuration_exporter_memory: 2 | 3 | memory 4 | ====== 5 | 6 | This is the memory exporter designed to store all received metrics from collector to local memory. 7 | 8 | store_count 9 | ----------- 10 | 11 | **optional**, **type**: usize 12 | 13 | Set how many values should be stored for each metric. 14 | 15 | **default**: 3600 16 | -------------------------------------------------------------------------------- /sphinx/g3statsd/configuration/importer/dummy.rst: -------------------------------------------------------------------------------- 1 | .. _configuration_importer_dummy: 2 | 3 | dummy 4 | ===== 5 | 6 | This is the dummy importer designed to do nothing. 7 | 8 | There are no extra config keys for this kind of importer. 9 | -------------------------------------------------------------------------------- /sphinx/g3statsd/configuration/values/index.rst: -------------------------------------------------------------------------------- 1 | ****************** 2 | Common Value Types 3 | ****************** 4 | 5 | There are many common values used across this document. 6 | The meanings and formats of them are described as follows: 7 | 8 | .. toctree:: 9 | 10 | acl 11 | base 12 | fs 13 | metrics 14 | network 15 | -------------------------------------------------------------------------------- /sphinx/g3statsd/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to g3statsd's documentation! 2 | ==================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | Configuration Reference 8 | -------------------------------------------------------------------------------- /sphinx/g3statsd/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx 2 | sphinx-rtd-theme 3 | -------------------------------------------------------------------------------- /sphinx/g3tiles/.gitignore: -------------------------------------------------------------------------------- 1 | _build 2 | -------------------------------------------------------------------------------- /sphinx/g3tiles/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the sphinx docs about the configuration & metrics & logs for g3tiles. 2 | 3 | To view the docs: 4 | 5 | 1. [install sphinx](https://www.sphinx-doc.org/en/master/usage/installation.html) 6 | 2. run `make html` in this directory 7 | 3. open *_build/html/index.html* with your favourite browser 8 | -------------------------------------------------------------------------------- /sphinx/g3tiles/_static/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/g3/4b629c469b5f0d59c05d626d0295f9d9e09a9b14/sphinx/g3tiles/_static/.placeholder -------------------------------------------------------------------------------- /sphinx/g3tiles/_templates/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/g3/4b629c469b5f0d59c05d626d0295f9d9e09a9b14/sphinx/g3tiles/_templates/.placeholder -------------------------------------------------------------------------------- /sphinx/g3tiles/configuration/backends/dummy_close.rst: -------------------------------------------------------------------------------- 1 | .. _configuration_backend_dummy_close: 2 | 3 | *********** 4 | dummy_close 5 | *********** 6 | 7 | This is the dummy backend designed to close all requests. 8 | 9 | Config Keys 10 | =========== 11 | 12 | There are no extra config keys for this kind of backend. 13 | -------------------------------------------------------------------------------- /sphinx/g3tiles/configuration/servers/dummy_close.rst: -------------------------------------------------------------------------------- 1 | .. _configuration_server_dummy_close: 2 | 3 | dummy_close 4 | =========== 5 | 6 | This is the dummy server designed to close all connections. 7 | 8 | There are no extra config keys for this kind of server. 9 | -------------------------------------------------------------------------------- /sphinx/g3tiles/configuration/stat.rst: -------------------------------------------------------------------------------- 1 | .. _configuration_stat: 2 | 3 | **** 4 | Stat 5 | **** 6 | 7 | This file described the stat config, which is optional and can not be reloaded. 8 | If set, it must reside in the main conf file. 9 | 10 | The value should be of type :ref:`statsd client config `, 11 | with the default *prefix* set to "g3tiles". 12 | -------------------------------------------------------------------------------- /sphinx/g3tiles/configuration/values/index.rst: -------------------------------------------------------------------------------- 1 | 2 | ****************** 3 | Common Value Types 4 | ****************** 5 | 6 | There are many common values used across this document. 7 | The meanings and formats of them are described as follows: 8 | 9 | .. toctree:: 10 | 11 | base 12 | fs 13 | db 14 | network 15 | acl 16 | tls 17 | quic 18 | rate_limit 19 | metrics 20 | route 21 | runtime 22 | -------------------------------------------------------------------------------- /sphinx/g3tiles/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to g3tiles's documentation! 2 | =================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | Configuration Reference 8 | Metrics Definition 9 | Log Format 10 | -------------------------------------------------------------------------------- /sphinx/g3tiles/metrics/backend/index.rst: -------------------------------------------------------------------------------- 1 | .. _metrics_backend: 2 | 3 | ############### 4 | Backend Metrics 5 | ############### 6 | 7 | The backend metrics are grouped by task type. 8 | 9 | The following are the tags for all backend metrics: 10 | 11 | * :ref:`daemon_group ` 12 | * :ref:`stat_id ` 13 | 14 | * backend 15 | 16 | Show the backend name. 17 | 18 | .. toctree:: 19 | 20 | stream 21 | keyless 22 | -------------------------------------------------------------------------------- /sphinx/g3tiles/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx 2 | sphinx-rtd-theme 3 | -------------------------------------------------------------------------------- /sphinx/project/.gitignore: -------------------------------------------------------------------------------- 1 | _build 2 | -------------------------------------------------------------------------------- /sphinx/project/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx 2 | sphinx-rtd-theme 3 | -------------------------------------------------------------------------------- /sphinx/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx 2 | sphinx-multiproject 3 | sphinx-rtd-theme 4 | --------------------------------------------------------------------------------