Closed NinoSkopac closed 2 months ago
This is my manifest (adopted from squid example):
--- runtime: thread_number: 2 controller: local: recv_timeout: 30 send_timeout: 1 server: - name: socks escaper: squid type: socks_proxy listen: address: "[::]:11080" - name: http escaper: squid type: http_proxy listen: address: "[::]:13128" resolver: - name: default type: c-ares server: 127.0.0.1 escaper: - name: squid type: proxy_http proxy_addr: host.docker.internal:10000 no_ipv6: true resolver: default resolve_strategy: IPv4Only
I built a docker image and I run it like this (my cwd is the manifest file dir):
docker run -p 13128:13128 -v ./:/etc/g3proxy/config/ g3proxy -v -c /etc/g3proxy/config/g3proxy.yaml # Aug 18 01:17:41.565 INFO started SocksProxy SRT[socks_v1#0] <g3_daemon::listen::tcp(tcp.rs:71)> # Aug 18 01:17:41.565 INFO started HttpProxy SRT[http_v1#0] <g3_daemon::listen::tcp(tcp.rs:71)>
You can also set log: stdout
in the main yaml config to see task logs, and you can add more -v to g3proxy command line to see more debug logs.
When i try to proxy (from the host, outside the container):
curl -v -x localhost:13128 ipinfo.io
I get
* Host localhost:13128 was resolved. * IPv6: ::1 * IPv4: 127.0.0.1 * Trying [::1]:13128... * Connected to localhost (::1) port 13128 > GET http://ipinfo.io/ HTTP/1.1 > Host: ipinfo.io > User-Agent: curl/8.7.1 > Accept: */* > Proxy-Connection: Keep-Alive > * Request completely sent off < HTTP/1.1 530 Origin DNS Error < Content-Type: text/html < Content-Length: 148 < Connection: Close < <html> <head><title>530 Origin DNS Error</title></head> <body> <div style="text-align: center;"><h1>530 Origin DNS Error</h1></div> </body> </html> * Closing connection
As you can see, I'm trying to forward proxy from g3proxy (port 13128) to the backend http proxy (port 10000).
I can exec into the g3proxy container and
curl -x host.docker.internal:10000 ipinfo.io
successfully.
What's the resolved address for host.docker.internal? The 530 error response tells that this domain can't be resolved by 127.0.0.1:53.
I think the technical side of the docs are great but they do lack some prose. Squid's wikis are a great example.
Here's what I need for a production setup:
- Logging: assuming user:pass@host access, I must log
user, bytes sent, bytes received
- Auth: I love squid's approach
You can find the logging/metrics format and the detailed configuration in dir g3proxy/doc
, and you can use sphinx to generate html files, then it will be a bit easier to read.
Notes:
- no caching
Yes there is no caching. You can archive this by using a caching ICAP server.
- acl? do i need to worry about that? it's going to be hosted in k8s and exposed both externally as a NodePort service (to the internet) and internally as a ClusterIP.
Check the configuration doc and you will find options at server / user level.
Could you please help me out with a proper manifest file?
- Http proxy from 13128 to 10000 (this will eventually be in the same pod with the app container; right now testing on docker locally)
The one you pasted is OK as long as you set a correct resolver.
- Logging with the format described
- Sensible easy auth
Just add a user-group to the main yaml config file, you can found examples in https://github.com/bytedance/g3/tree/master/g3proxy/examples/hybrid_user_auth/user-group.d, which use a file as a dynamic source.
If you guys can get the docs in a human-readable state so people can get things done quickly this is gonna take over.
You can check the user guide first, and then use the sphinx generated html docs as a reference. It will be appreciated if you can help us to improve the docs.
Great Mr. Jingqiang, got it.
I've spent another day going thru this and here's my feedback about the project:
Now back to my specific issues:
nslookup host.docker.internal
inside the g3 container and using that IP in the resolver. the docker dns ip is in the 192.168.65.0/28 range. maybe on linux this isn't needed. probably on k8s as well. i haven't tried yet.Thank you so much and have a great day sir!
I'll keep this open for now in case you'd like to reply but feel free to close it any time you deem appropriate.
Nino
I'm trying to get auth working, via user_group.source.type: lua
but it isn't working.
This is working:
user_group:
- name: default
source:
type: file
path: dynamic_users.json
This is not:
user_group:
- name: default
source:
type: lua
path: auth.lua
(yes, I made sure auth.lua is in the same dir)
The startup error I get is
Error: failed to load config, opts: ProcArgs { daemon_config: DaemonArgs { with_systemd: false, daemon_mode: false, verbose_level: 0, process_name: "g3proxy", pid_file: None, test_config: false }, output_graphviz_graph: false, output_mermaid_graph: false, output_plantuml_graph: false }
Caused by:
0: failed to parse value of key user_group
1: value is an array, with 1 objects
2: #0: failed to load map {String("name"): String("default"), String("source"): Hash({String("type"): String("lua"), String("path"): String("auth.lua")})}
3: failed to parse value of key source
4: invalid value for key source
5: unsupported source type lua
I literally cp'ed your sample auth.lua script:
-- TODO fetch users
local result = "[]"
-- return the json encoded string
return result
I don't know how to generate the result
, to be honest. How do you compute the tokens? I tried salt + toor and it didn't yield the m5 or sha1 found in examples.
Let me try to ask a simpler question:
If this is your standard dynamic_users.json:
[
{
"name": "foo",
"token": {
"salt": "113323bdab6fd2cc",
"md5": "5c81f2becadde7fa5fde9026652ccc84",
"sha1": "ff9d5c1a14328dd85ee95d4e574bd0558a1dfa96"
}
},
{
"name": "bar",
"token": "$1$rnfSARNK$DJNIbbMpjjSmral92rE3k1"
}
]
I'm guessing I can return "bar"-style maps in a list from the lua script. Can you please let me know the exact formula/function you're using to generate the token, please?
In the docs, the previously mentioned Lua sample script should be updated with some code that returns a couple of users, not an empty list, ideally. Ideally even include the crypto function in the Lua code, e.g. crypto.digest("sha1", "toor")
- create a github pages for the sphinx docs (i'd love to pr it but i've never created github.io pages before)
The sphinx docs need improvements before we publish them.
- i love how scalable this is. i'm totally on board with the configuration syntax. you guys might as well setup some automation and maintain a docker container on dockerhub (i havent done it either/not the best person to pr).
Will do that after rust support reproducible build.
- logging: i scoured the sphinx docs and i found explanations for all fields - great! i haven't been able to figure out how to configure the log format yet. but i can see the logs now at least and they're great. i wish there was an example on customizing them in https://github.com/bytedance/g3/tree/master/g3proxy/examples
There is no support for customization yet.
The startup error I get is
Error: failed to load config, opts: ProcArgs { daemon_config: DaemonArgs { with_systemd: false, daemon_mode: false, verbose_level: 0, process_name: "g3proxy", pid_file: None, test_config: false }, output_graphviz_graph: false, output_mermaid_graph: false, output_plantuml_graph: false } Caused by: 0: failed to parse value of key user_group 1: value is an array, with 1 objects 2: #0: failed to load map {String("name"): String("default"), String("source"): Hash({String("type"): String("lua"), String("path"): String("auth.lua")})} 3: failed to parse value of key source 4: invalid value for key source 5: unsupported source type lua
You need to compile g3proxy with the proper lua feature, such as --feature lua54
.
I literally cp'ed your sample auth.lua script:
-- TODO fetch users local result = "[]" -- return the json encoded string return result
I don't know how to generate the
result
, to be honest. How do you compute the tokens? I tried salt + toor and it didn't yield the m5 or sha1 found in examples.
You can use this https://github.com/bytedance/g3/blob/master/scripts/passphrase_hash.py to generate the token.
I'm trying to get lua working.
I added lua54
to features:
FROM rust:alpine AS builder
WORKDIR /usr/src/g3
COPY . .
RUN apk add --no-cache musl-dev cmake capnproto-dev openssl-dev openssl-libs-static c-ares-dev c-ares-static
RUN cargo build --profile release-lto \
--no-default-features --features quic,c-ares,hickory,lua54 \
-p g3proxy -p g3proxy-ctl
FROM alpine:latest
RUN apk add --no-cache ca-certificates
COPY --from=builder /usr/src/g3/target/release-lto/g3proxy /usr/bin/g3proxy
COPY --from=builder /usr/src/g3/target/release-lto/g3proxy-ctl /usr/bin/g3proxy-ctl
ENTRYPOINT ["/usr/bin/g3proxy"]
CMD ["-Vvv"]
docker build -t g3proxy -f g3proxy/docker/alpine.Dockerfile .
=> ERROR [builder 5/5] RUN cargo build --profile release-lto --no-default-features --features quic,c-ares,h 42.9s
------
> [builder 5/5] RUN cargo build --profile release-lto --no-default-features --features quic,c-ares,hickory,lua54 -p g3proxy -p g3proxy-ctl:
0.184 Updating crates.io index
2.605 Downloading crates ...
2.982 Downloaded atomic-waker v1.1.2
2.986 Downloaded async-recursion v1.1.1
2.990 Downloaded anstyle v1.0.8
2.992 Downloaded arrayref v0.3.8
2.994 Downloaded anstyle-query v1.1.1
2.997 Downloaded foreign-types v0.3.2
2.998 Downloaded daemonize v0.5.0
3.002 Downloaded equivalent v1.0.1
3.003 Downloaded endian-type v0.1.2
3.011 Downloaded arrayvec v0.7.4
3.015 Downloaded block-buffer v0.10.4
3.016 Downloaded atoi v2.0.0
3.017 Downloaded fixedbitset v0.4.2
3.018 Downloaded constant_time_eq v0.3.0
3.020 Downloaded digest v0.10.7
3.021 Downloaded futures-task v0.3.30
3.023 Downloaded form_urlencoded v1.2.1
3.023 Downloaded futures-macro v0.3.30
3.024 Downloaded futures-core v0.3.30
3.026 Downloaded alloc-stdlib v0.2.2
3.027 Downloaded colorchoice v1.0.2
3.028 Downloaded alloc-no-stdlib v2.0.4
3.029 Downloaded gethostname v0.5.0
3.031 Downloaded cmake v0.1.50
3.032 Downloaded heck v0.5.0
3.033 Downloaded futures-io v0.3.30
3.034 Downloaded anstyle-parse v0.2.5
3.036 Downloaded foreign-types-shared v0.1.1
3.037 Downloaded autocfg v1.3.0
3.038 Downloaded atomic v0.6.0
3.039 Downloaded hickory-client v0.24.1
3.042 Downloaded crc32fast v1.4.2
3.043 Downloaded bytes v1.7.1
3.047 Downloaded toml_datetime v0.6.8
3.048 Downloaded tinystr v0.7.6
3.049 Downloaded hex v0.4.3
3.050 Downloaded heck v0.4.1
3.051 Downloaded clap_complete v4.5.16
3.054 Downloaded futures v0.3.30
3.058 Downloaded arc-swap v1.7.1
3.060 Downloaded hashlink v0.8.4
3.062 Downloaded pin-project-lite v0.2.14
3.065 Downloaded pin-utils v0.1.0
3.065 Downloaded erased-serde v0.3.31
3.067 Downloaded serde_spanned v0.6.7
3.067 Downloaded futures-channel v0.3.30
3.068 Downloaded fs_extra v1.3.0
3.070 Downloaded fastrand v2.1.0
3.070 Downloaded cfg-expr v0.15.8
3.072 Downloaded c-ares v11.0.0
3.074 Downloaded tinyvec_macros v0.1.1
3.074 Downloaded fixedbitset v0.5.7
3.075 Downloaded futures-timer v3.0.3
3.076 Downloaded enum-as-inner v0.6.0
3.077 Downloaded data-encoding v2.6.0
3.078 Downloaded capnpc v0.19.0
3.079 Downloaded anyhow v1.0.86
3.081 Downloaded allocator-api2 v0.2.18
3.083 Downloaded displaydoc v0.2.5
3.084 Downloaded clap v4.5.16
3.089 Downloaded futures-executor v0.3.30
3.089 Downloaded fnv v1.0.7
3.090 Downloaded crypto-common v0.1.6
3.091 Downloaded ascii v1.1.0
3.092 Downloaded h3-quinn v0.0.7
3.092 Downloaded futures-sink v0.3.30
3.093 Downloaded cpufeatures v0.2.13
3.094 Downloaded clap_lex v0.7.2
3.094 Downloaded capnp-futures v0.19.0
3.095 Downloaded c-types v4.0.0
3.096 Downloaded c-ares-resolver v10.0.0
3.096 Downloaded async-trait v0.1.81
3.098 Downloaded generic-array v0.14.7
3.099 Downloaded bytemuck v1.16.3
3.102 Downloaded flume v0.11.0
3.105 Downloaded getrandom v0.2.15
3.107 Downloaded cc v1.1.11
3.110 Downloaded subtle v2.6.1
3.111 Downloaded polling v3.7.3
3.113 Downloaded slab v0.4.9
3.114 Downloaded ppv-lite86 v0.2.20
3.115 Downloaded socket2 v0.5.7
3.117 Downloaded zerofrom v0.1.4
3.118 Downloaded signal-hook-registry v1.4.2
3.119 Downloaded icu_provider_macros v1.5.0
3.120 Downloaded hashbrown v0.14.5
3.124 Downloaded h3 v0.0.6
3.127 Downloaded governor v0.6.3
3.130 Downloaded capnp v0.19.6
3.134 Downloaded brotli-decompressor v4.0.1
3.140 Downloaded pkg-config v0.3.30
3.141 Downloaded capnp-rpc v0.19.2
3.143 Downloaded base64 v0.22.1
3.146 Downloaded either v1.13.0
3.147 Downloaded bitflags v2.6.0
3.149 Downloaded arraydeque v0.5.1
3.150 Downloaded anstream v0.6.15
3.152 Downloaded byteorder v1.5.0
3.154 Downloaded openssl-probe v0.1.5
3.154 Downloaded metrohash v1.0.6
3.157 Downloaded combine v4.6.7
3.162 Downloaded rmpv v1.3.0
3.163 Downloaded clap_builder v4.5.15
3.168 Downloaded rustls-pemfile v2.1.3
3.170 Downloaded rustls-native-certs v0.7.1
3.171 Downloaded rand_chacha v0.3.1
3.172 Downloaded rand v0.8.5
3.174 Downloaded strsim v0.11.1
3.175 Downloaded semver v1.0.23
3.177 Downloaded scopeguard v1.2.0
3.177 Downloaded ryu v1.0.18
3.179 Downloaded quinn v0.11.3
3.181 Downloaded rustls-pki-types v1.8.0
3.183 Downloaded serde_json v1.0.125
3.191 Downloaded is_terminal_polyfill v1.70.1
3.192 Downloaded sha2 v0.10.8
3.193 Downloaded sha-1 v0.10.1
3.194 Downloaded rustc-hash v2.0.0
3.195 Downloaded rmp v0.8.14
3.197 Downloaded proc-macro2 v1.0.86
3.199 Downloaded smol_str v0.2.2
3.200 Downloaded openssl-macros v0.1.1
3.200 Downloaded slog v2.7.0
3.202 Downloaded stable_deref_trait v1.2.0
3.203 Downloaded spinning_top v0.3.0
3.204 Downloaded spin v0.9.8
3.205 Downloaded rmp-serde v1.3.0
3.207 Downloaded thiserror-impl v1.0.63
3.208 Downloaded serde v1.0.208
3.210 Downloaded quinn-proto v0.11.6
3.215 Downloaded rustls-webpki v0.102.6
3.225 Downloaded zerovec-derive v0.10.3
3.226 Downloaded zeroize v1.8.1
3.227 Downloaded portable-atomic v1.7.0
3.235 Downloaded hdrhistogram v7.5.4
3.241 Downloaded shlex v1.3.0
3.242 Downloaded redis v0.26.1
3.248 Downloaded utf8_iter v1.0.4
3.249 Downloaded rustc_version v0.4.0
3.250 Downloaded radix_trie v0.2.1
3.254 Downloaded quinn-udp v0.5.4
3.255 Downloaded smallvec v1.13.2
3.257 Downloaded paste v1.0.15
3.258 Downloaded quote v1.0.36
3.260 Downloaded regex-syntax v0.8.4
3.267 Downloaded regex-automata v0.4.7
3.281 Downloaded num-integer v0.1.46
3.282 Downloaded md-5 v0.10.6
3.283 Downloaded version-compare v0.2.0
3.284 Downloaded synstructure v0.13.1
3.286 Downloaded c-ares-sys v10.0.0
3.307 Downloaded nonzero_ext v0.3.0
3.310 Downloaded regex v1.10.6
3.317 Downloaded encoding_rs v0.8.34
3.350 Downloaded brotli v6.0.0
3.372 Downloaded rustls v0.23.12
3.384 Downloaded rustix v0.38.34
3.398 Downloaded writeable v0.5.5
3.399 Downloaded system-deps v7.0.1
3.400 Downloaded hickory-proto v0.24.1
3.412 Downloaded bstr v1.10.0
3.421 Downloaded chrono v0.4.38
3.426 Downloaded yoke-derive v0.7.4
3.427 Downloaded write16 v1.0.0
3.428 Downloaded tokio-macros v2.4.0
3.428 Downloaded h2 v0.4.5
3.434 Downloaded thiserror v1.0.63
3.436 Downloaded futures-util v0.3.30
3.444 Downloaded humanize-rs v0.1.5
3.445 Downloaded zerofrom-derive v0.1.4
3.445 Downloaded blake3 v1.5.3
3.451 Downloaded aho-corasick v1.1.3
3.456 Downloaded ip_network_table-deps-treebitmap v0.5.0
3.457 Downloaded no-std-compat v0.4.1
3.457 Downloaded nanorand v0.7.0
3.459 Downloaded utf16_iter v1.0.5
3.459 Downloaded itoa v1.0.11
3.460 Downloaded ip_network_table v0.2.0
3.461 Downloaded ahash v0.8.11
3.463 Downloaded embedded-io v0.6.1
3.463 Downloaded errno v0.3.9
3.464 Downloaded cfg-if v1.0.0
3.470 Downloaded ip_network v0.4.1
3.472 Downloaded ring v0.17.8
3.534 Downloaded percent-encoding v2.3.1
3.535 Downloaded nibble_vec v0.1.0
3.535 Downloaded mime v0.3.17
3.536 Downloaded lru v0.12.4
3.537 Downloaded ipnet v2.9.0
3.538 Downloaded version_check v0.9.5
3.538 Downloaded untrusted v0.9.0
3.539 Downloaded target-lexicon v0.12.16
3.540 Downloaded iana-time-zone v0.1.60
3.545 Downloaded once_cell v1.19.0
3.546 Downloaded mlua-sys v0.6.2
3.583 Downloaded tracing v0.1.40
3.590 Downloaded tracing-attributes v0.1.27
3.597 Downloaded zerocopy-derive v0.7.35
3.599 Downloaded icu_locid_transform v1.5.0
3.601 Downloaded yoke v0.7.4
3.602 Downloaded utf8parse v0.2.2
3.619 Downloaded lock_api v0.4.12
3.640 Downloaded parking_lot_core v0.9.10
3.660 Downloaded uuid v1.10.0
3.668 Downloaded icu_locid_transform_data v1.5.0
3.671 Downloaded icu_locid v1.5.0
3.687 Downloaded log v0.4.22
3.689 Downloaded typenum v1.17.0
3.691 Downloaded parking_lot v0.12.3
3.693 Downloaded litemap v0.7.3
3.695 Downloaded tokio-rustls v0.26.0
3.697 Downloaded toml v0.8.19
3.699 Downloaded tinyvec v1.8.0
3.702 Downloaded tracing-core v0.1.32
3.705 Downloaded rand_core v0.6.4
3.709 Downloaded unicode-ident v1.0.12
3.720 Downloaded icu_normalizer v1.5.0
3.747 Downloaded unicode-bidi v0.3.15
3.750 Downloaded variant-ssl-sys v0.13.10
3.757 Downloaded num-traits v0.2.19
3.790 Downloaded tokio-util v0.7.11
3.808 Downloaded icu_provider v1.5.0
3.903 Downloaded icu_properties v1.5.1
3.946 Downloaded indexmap v2.4.0
3.963 Downloaded icu_normalizer_data v1.5.0
3.990 Downloaded icu_collections v1.5.0
4.011 Downloaded http v1.1.0
4.051 Downloaded memchr v2.7.4
4.074 Downloaded mio v1.0.2
4.085 Downloaded toml_edit v0.22.20
4.106 Downloaded url v2.5.2
4.110 Downloaded num-bigint v0.4.6
4.150 Downloaded unicode-normalization v0.1.23
4.175 Downloaded itertools v0.13.0
4.181 Downloaded yaml-rust2 v0.8.1
4.197 Downloaded zerovec v0.10.4
4.219 Downloaded idna v1.0.2
4.223 Downloaded zerocopy v0.7.35
4.249 Downloaded winnow v0.6.18
4.311 Downloaded syn v2.0.74
4.322 Downloaded mlua v0.9.9
4.330 Downloaded icu_properties_data v1.5.0
4.425 Downloaded vcpkg v0.2.15
4.485 Downloaded idna v0.5.0
4.494 Downloaded idna v0.4.0
4.500 Downloaded webpki-roots v0.26.3
4.517 Downloaded variant-ssl v0.14.10
4.736 Downloaded petgraph v0.6.5
4.772 Downloaded libc v0.2.156
4.802 Downloaded tokio v1.39.2
4.982 Downloaded linux-raw-sys v0.4.14
5.103 Compiling proc-macro2 v1.0.86
5.103 Compiling unicode-ident v1.0.12
5.103 Compiling libc v0.2.156
5.103 Compiling autocfg v1.3.0
5.103 Compiling cfg-if v1.0.0
5.103 Compiling shlex v1.3.0
5.103 Compiling pin-project-lite v0.2.14
5.103 Compiling once_cell v1.19.0
5.152 Compiling byteorder v1.5.0
5.168 Compiling serde v1.0.208
5.172 Compiling memchr v2.7.4
5.308 Compiling cc v1.1.11
5.321 Compiling pkg-config v0.3.30
5.380 Compiling version_check v0.9.5
5.391 Compiling futures-sink v0.3.30
5.416 Compiling slab v0.4.9
5.449 Compiling futures-core v0.3.30
5.523 Compiling bytes v1.7.1
5.662 Compiling futures-io v0.3.30
5.751 Compiling lock_api v0.4.12
5.784 Compiling quote v1.0.36
5.828 Compiling futures-channel v0.3.30
5.924 Compiling getrandom v0.2.15
5.937 Compiling socket2 v0.5.7
5.955 Compiling syn v2.0.74
5.992 Compiling mio v1.0.2
6.056 Compiling signal-hook-registry v1.4.2
6.085 Compiling num-traits v0.2.19
6.102 Compiling scopeguard v1.2.0
6.118 Compiling pin-utils v0.1.0
6.161 Compiling futures-task v0.3.30
6.273 Compiling tinyvec_macros v0.1.1
6.307 Compiling thiserror v1.0.63
6.313 Compiling tinyvec v1.8.0
6.414 Compiling tracing-core v0.1.32
6.449 Compiling stable_deref_trait v1.2.0
6.465 Compiling typenum v1.17.0
6.481 Compiling rustls-pki-types v1.8.0
6.561 Compiling spin v0.9.8
6.689 Compiling ring v0.17.8
6.717 Compiling rand_core v0.6.4
6.872 Compiling generic-array v0.14.7
6.879 Compiling ahash v0.8.11
6.918 Compiling smallvec v1.13.2
7.000 Compiling alloc-no-stdlib v2.0.4
7.091 Compiling alloc-stdlib v0.2.2
7.113 Compiling untrusted v0.9.0
7.134 Compiling itoa v1.0.11
7.134 Compiling bitflags v2.6.0
7.170 Compiling brotli-decompressor v4.0.1
7.183 Compiling rustls v0.23.12
7.233 Compiling allocator-api2 v0.2.18
7.277 Compiling unicode-normalization v0.1.23
7.309 Compiling unicode-bidi v0.3.15
7.322 Compiling vcpkg v0.2.15
7.674 Compiling litemap v0.7.3
7.858 Compiling zeroize v1.8.1
7.973 Compiling subtle v2.6.1
8.006 Compiling percent-encoding v2.3.1
8.070 Compiling writeable v0.5.5
8.161 Compiling variant-ssl-sys v0.13.10
8.168 Compiling brotli v6.0.0
8.245 Compiling anyhow v1.0.86
8.285 Compiling crypto-common v0.1.6
8.340 Compiling block-buffer v0.10.4
8.368 Compiling form_urlencoded v1.2.1
8.432 Compiling idna v0.5.0
8.541 Compiling fnv v1.0.7
8.549 Compiling rustc-hash v2.0.0
8.596 Compiling http v1.1.0
9.108 Compiling url v2.5.2
9.569 Compiling digest v0.10.7
9.725 Compiling parking_lot_core v0.9.10
9.761 Compiling equivalent v1.0.1
9.799 Compiling icu_locid_transform_data v1.5.0
9.852 Compiling synstructure v0.13.1
9.872 Compiling portable-atomic v1.7.0
10.17 Compiling nibble_vec v0.1.0
10.25 Compiling cpufeatures v0.2.13
10.27 Compiling foreign-types-shared v0.1.1
10.30 Compiling fastrand v2.1.0
10.31 Compiling variant-ssl v0.14.10
10.48 Compiling icu_properties_data v1.5.0
10.49 Compiling endian-type v0.1.2
10.51 Compiling foreign-types v0.3.2
10.58 Compiling radix_trie v0.2.1
10.82 Compiling blake3 v1.5.3
10.88 Compiling aho-corasick v1.1.3
11.01 Compiling utf16_iter v1.0.5
11.09 Compiling write16 v1.0.0
11.10 Compiling base64 v0.22.1
11.15 Compiling slog v2.7.0
11.37 Compiling ip_network v0.4.1
11.47 Compiling icu_normalizer_data v1.5.0
11.51 Compiling utf8_iter v1.0.4
11.52 Compiling regex-syntax v0.8.4
11.63 Compiling rustls-pemfile v2.1.3
11.85 Compiling erased-serde v0.3.31
12.09 Compiling parking_lot v0.12.3
12.29 Compiling zerocopy-derive v0.7.35
12.32 Compiling tokio-macros v2.4.0
12.42 Compiling futures-macro v0.3.30
12.68 Compiling zerofrom-derive v0.1.4
12.72 Compiling thiserror-impl v1.0.63
12.77 Compiling tracing-attributes v0.1.27
13.00 Compiling tokio v1.39.2
13.31 Compiling zerocopy v0.7.35
13.33 Compiling futures-util v0.3.30
13.66 Compiling yoke-derive v0.7.4
14.05 Compiling ppv-lite86 v0.2.20
14.05 Compiling zerovec-derive v0.10.3
14.12 Compiling zerofrom v0.1.4
14.21 Compiling displaydoc v0.2.5
14.27 Compiling tracing v0.1.40
14.27 Compiling rand_chacha v0.3.1
14.52 Compiling rand v0.8.5
14.83 Compiling yoke v0.7.4
15.16 Compiling hashbrown v0.14.5
15.18 Compiling icu_provider_macros v1.5.0
15.20 Compiling zerovec v0.10.4
15.50 Compiling quinn-udp v0.5.4
15.71 Compiling openssl-macros v0.1.1
15.80 Compiling regex-automata v0.4.7
15.90 Compiling indexmap v2.4.0
16.04 Compiling rustls-webpki v0.102.6
16.11 Compiling futures-executor v0.3.30
16.32 Compiling tinystr v0.7.6
16.44 Compiling futures v0.3.30
16.45 Compiling icu_locid v1.5.0
16.48 Compiling icu_collections v1.5.0
17.06 Compiling icu_provider v1.5.0
17.21 Compiling md-5 v0.10.6
17.27 Compiling spinning_top v0.3.0
17.30 Compiling nanorand v0.7.0
17.35 Compiling log v0.4.22
17.56 Compiling icu_locid_transform v1.5.0
17.57 Compiling arrayref v0.3.8
17.60 Compiling constant_time_eq v0.3.0
17.67 Compiling openssl-probe v0.1.5
17.74 Compiling nonzero_ext v0.3.0
17.79 Compiling no-std-compat v0.4.1
17.81 Compiling futures-timer v3.0.3
17.85 Compiling smol_str v0.2.2
18.03 Compiling ip_network_table-deps-treebitmap v0.5.0
18.15 Compiling icu_properties v1.5.1
18.31 Compiling hex v0.4.3
18.34 Compiling arrayvec v0.7.4
18.54 Compiling arc-swap v1.7.1
18.82 Compiling ip_network_table v0.2.0
18.93 Compiling regex v1.10.6
19.01 Compiling governor v0.6.3
19.04 Compiling rustls-native-certs v0.7.1
19.48 Compiling flume v0.11.0
19.79 Compiling sha-1 v0.10.1
19.81 Compiling quinn-proto v0.11.6
19.82 Compiling webpki-roots v0.26.3
19.91 Compiling icu_normalizer v1.5.0
19.97 Compiling crc32fast v1.4.2
20.12 Compiling metrohash v1.0.6
20.22 Compiling lru v0.12.4
20.63 Compiling idna v1.0.2
20.68 Compiling target-lexicon v0.12.16
21.34 Compiling winnow v0.6.18
21.69 Compiling tokio-util v0.7.11
22.17 Compiling quinn v0.11.3
22.22 Compiling cfg-expr v0.15.8
22.58 Compiling version-compare v0.2.0
22.79 Compiling heck v0.5.0
22.80 Compiling cmake v0.1.50
22.95 Compiling g3-types v0.5.0 (/usr/src/g3/lib/g3-types)
23.07 Compiling rustix v0.38.34
23.21 Compiling fs_extra v1.3.0
23.34 Compiling serde_spanned v0.6.7
23.39 Compiling toml_datetime v0.6.8
23.46 Compiling linux-raw-sys v0.4.14
23.51 Compiling toml_edit v0.22.20
23.54 Compiling async-trait v0.1.81
23.58 Compiling atomic-waker v1.1.2
23.63 Compiling heck v0.4.1
23.78 Compiling enum-as-inner v0.6.0
24.20 Compiling tokio-rustls v0.26.0
24.41 Compiling idna v0.4.0
24.63 Compiling c-types v4.0.0
24.67 Compiling data-encoding v2.6.0
24.75 Compiling c-ares v11.0.0
24.87 Compiling either v1.13.0
25.05 Compiling ipnet v2.9.0
25.47 Compiling toml v0.8.19
25.75 Compiling hickory-proto v0.24.1
25.99 Compiling system-deps v7.0.1
26.48 Compiling itertools v0.13.0
26.66 Compiling h2 v0.4.5
26.89 Compiling c-ares-sys v10.0.0
27.46 Compiling h3 v0.0.6
27.93 Compiling c-ares-resolver v10.0.0
28.07 Compiling g3-resolver v0.6.0 (/usr/src/g3/lib/g3-resolver)
28.10 Compiling async-recursion v1.1.1
28.18 Compiling polling v3.7.3
28.34 Compiling hickory-client v0.24.1
28.76 Compiling h3-quinn v0.0.7
29.50 Compiling iana-time-zone v0.1.60
29.51 Compiling ryu v1.0.18
29.58 Compiling g3-hickory-client v0.1.0 (/usr/src/g3/lib/g3-hickory-client)
29.67 Compiling chrono v0.4.38
29.69 Compiling paste v1.0.15
29.79 Compiling atoi v2.0.0
29.88 Compiling g3-socket v0.4.0 (/usr/src/g3/lib/g3-socket)
30.27 Compiling bytemuck v1.16.3
30.43 Compiling serde_json v1.0.125
30.47 Compiling rmp v0.8.14
30.57 Compiling g3-io-ext v0.7.0 (/usr/src/g3/lib/g3-io-ext)
30.78 Compiling utf8parse v0.2.2
30.84 Compiling anstyle v1.0.8
31.07 Compiling anstyle-parse v0.2.5
31.25 Compiling atomic v0.6.0
31.37 Compiling colorchoice v1.0.2
31.43 Compiling is_terminal_polyfill v1.70.1
31.46 Compiling anstyle-query v1.1.1
31.50 Compiling anstream v0.6.15
31.65 Compiling uuid v1.10.0
32.02 Compiling capnp v0.19.6
32.11 Compiling clap_lex v0.7.2
32.21 Compiling semver v1.0.23
32.29 Compiling mime v0.3.17
32.43 Compiling strsim v0.11.1
32.49 Compiling rmpv v1.3.0
32.59 Compiling clap_builder v4.5.15
32.60 Compiling g3-datetime v0.1.0 (/usr/src/g3/lib/g3-datetime)
32.65 Compiling g3-geoip-types v0.1.0 (/usr/src/g3/lib/g3-geoip-types)
33.02 Compiling g3-msgpack v0.2.0 (/usr/src/g3/lib/g3-msgpack)
33.36 Compiling g3-http v0.3.0 (/usr/src/g3/lib/g3-http)
33.72 Compiling gethostname v0.5.0
33.79 Compiling sha2 v0.10.8
34.26 Compiling hdrhistogram v7.5.4
34.50 Compiling g3-compat v0.1.0 (/usr/src/g3/lib/g3-compat)
34.56 Compiling fixedbitset v0.5.7
34.68 Compiling mlua-sys v0.6.2
34.87 Compiling capnp-futures v0.19.0
34.97 Compiling g3-dpi v0.1.0 (/usr/src/g3/lib/g3-dpi)
35.05 Compiling g3-runtime v0.3.0 (/usr/src/g3/lib/g3-runtime)
35.14 Compiling capnp-rpc v0.19.2
35.45 Compiling capnpc v0.19.0
35.82 Compiling clap v4.5.16
35.86 Compiling g3-h2 v0.1.0 (/usr/src/g3/lib/g3-h2)
36.06 Compiling g3-histogram v0.1.0 (/usr/src/g3/lib/g3-histogram)
36.16 Compiling rustc_version v0.4.0
36.21 Compiling g3-smtp-proto v0.1.0 (/usr/src/g3/lib/g3-smtp-proto)
36.26 Compiling rmp-serde v1.3.0
36.42 Compiling hashlink v0.8.4
36.47 Compiling num-integer v0.1.46
36.69 Compiling encoding_rs v0.8.34
36.70 Compiling humanize-rs v0.1.5
36.71 Compiling ascii v1.1.0
36.86 Compiling arraydeque v0.5.1
36.95 Compiling num-bigint v0.4.6
37.03 Compiling g3-fluentd v0.1.0 (/usr/src/g3/lib/g3-fluentd)
37.16 Compiling g3-icap-client v0.2.0 (/usr/src/g3/lib/g3-icap-client)
37.39 Compiling g3proxy-proto v0.1.0 (/usr/src/g3/g3proxy/proto)
37.66 Compiling g3-build-env v0.1.0 (/usr/src/g3/lib/g3-build-env)
37.75 Compiling clap_complete v4.5.16
38.73 Compiling yaml-rust2 v0.8.1
39.42 Compiling g3-udpdump v0.1.0 (/usr/src/g3/lib/g3-udpdump)
39.49 error: failed to run custom build command for `mlua-sys v0.6.2`
39.49
39.49 Caused by:
39.49 process didn't exit successfully: `/usr/src/g3/target/release-lto/build/mlua-sys-cf178c0ccb4196bf/build-script-main` (exit status: 101)
39.49 --- stdout
39.49 cargo:rerun-if-changed=build
39.49 cargo:rerun-if-env-changed=LUA_LIB
39.49 cargo:rerun-if-env-changed=LUA_LIB_NAME
39.49 cargo:rerun-if-env-changed=LUA_LINK
39.49 cargo:rerun-if-env-changed=LUA_NO_PKG_CONFIG
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-musl
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_musl
39.49 cargo:rerun-if-env-changed=HOST_PKG_CONFIG
39.49 cargo:rerun-if-env-changed=PKG_CONFIG
39.49 cargo:rerun-if-env-changed=LUA_STATIC
39.49 cargo:rerun-if-env-changed=LUA_DYNAMIC
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-unknown-linux-musl
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_unknown_linux_musl
39.49 cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_PATH
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-unknown-linux-musl
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_unknown_linux_musl
39.49 cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-unknown-linux-musl
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_musl
39.49 cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
39.49 cargo:rerun-if-env-changed=LUA5.4_NO_PKG_CONFIG
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-musl
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_musl
39.49 cargo:rerun-if-env-changed=HOST_PKG_CONFIG
39.49 cargo:rerun-if-env-changed=PKG_CONFIG
39.49 cargo:rerun-if-env-changed=LUA5.4_STATIC
39.49 cargo:rerun-if-env-changed=LUA5.4_DYNAMIC
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-unknown-linux-musl
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_unknown_linux_musl
39.49 cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_PATH
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-unknown-linux-musl
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_unknown_linux_musl
39.49 cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-unknown-linux-musl
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_musl
39.49 cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
39.49 cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
39.49
39.49 --- stderr
39.49 thread 'main' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/mlua-sys-0.6.2/build/find_normal.rs:57:30:
39.49 cannot find Lua5.4 using `pkg-config`:
39.49 pkg-config exited with status code 1
39.49 > PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags lua5.4
39.49
39.49 The system library `lua5.4` required by crate `mlua-sys` was not found.
39.49 The file `lua5.4.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
39.49 The PKG_CONFIG_PATH environment variable is not set.
39.49
39.49 HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `lua5.4.pc`.
39.49
39.49 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
39.49 warning: build failed, waiting for other jobs to finish...
------
alpine.Dockerfile:5
--------------------
4 | RUN apk add --no-cache musl-dev cmake capnproto-dev openssl-dev openssl-libs-static c-ares-dev c-ares-static
5 | >>> RUN cargo build --profile release-lto \
6 | >>> --no-default-features --features quic,c-ares,hickory,lua54 \
7 | >>> -p g3proxy -p g3proxy-ctl
8 |
--------------------
ERROR: failed to solve: process "/bin/sh -c cargo build --profile release-lto --no-default-features --features quic,c-ares,hickory,lua54 -p g3proxy -p g3proxy-ctl" did not complete successfully: exit code: 101
@NinoSkopac apk add lua5.4
Builds after adding lua-dev and pkgconfig to Dockerfile
FROM rust:alpine AS builder
WORKDIR /usr/src/g3
COPY . .
RUN apk add --no-cache musl-dev cmake capnproto-dev openssl-dev openssl-libs-static c-ares-dev c-ares-static lua5.4-dev pkgconfig
ENV PKG_CONFIG_PATH=/usr/lib/pkgconfig
RUN cargo build --profile release-lto \
--no-default-features --features quic,c-ares,hickory,lua54 \
-p g3proxy -p g3proxy-ctl
FROM alpine:latest
RUN apk add --no-cache ca-certificates
COPY --from=builder /usr/src/g3/target/release-lto/g3proxy /usr/bin/g3proxy
COPY --from=builder /usr/src/g3/target/release-lto/g3proxy-ctl /usr/bin/g3proxy-ctl
ENTRYPOINT ["/usr/bin/g3proxy"]
CMD ["-Vvv"]
Now it builds but it crashes after I start it:
% docker run --rm -p 11080:11080 -p 13128:13128 -v ./:/etc/g3proxy/ g3proxy -c /etc/g3proxy/config.yaml
Error: failed to load config, opts: ProcArgs { daemon_config: DaemonArgs { with_systemd: false, daemon_mode: false, verbose_level: 0, process_name: "g3proxy", pid_file: None, test_config: false }, output_graphviz_graph: false, output_mermaid_graph: false, output_plantuml_graph: false }
Caused by:
0: failed to parse value of key user_group
1: value is an array, with 1 objects
2: #0: failed to load map {String("name"): String("default"), String("source"): Hash({String("type"): String("lua"), String("path"): String("auth.lua")})}
3: failed to parse value of key source
4: invalid value for key source
5: failed to parse value of key path
6: invalid key path
The config key path
is not a supported config option, use fetch_script
as described here https://github.com/bytedance/g3/blob/master/g3proxy/doc/configuration/user_group/source.rst#lua
And a cache_file
is needed.
Got it! Thank you!!!
Yep Lua is working! Now onto returning a proper map from there. thank youuuu
d o n e
I haven’t been able to get a forward proxy working yet. I’m trying to proxy to a http proxy (not squid, it’s a custom app coded in Go).
This is my manifest (adopted from squid example):
I built a docker image and I run it like this (my cwd is the manifest file dir):
When i try to proxy (from the host, outside the container):
I get
As you can see, I'm trying to forward proxy from g3proxy (port 13128) to the backend http proxy (port 10000).
I can exec into the g3proxy container and
curl -x host.docker.internal:10000 ipinfo.io
successfully.I think the technical side of the docs are great but they do lack some prose. Squid's wikis are a great example.
Here's what I need for a production setup:
user, bytes sent, bytes received
Notes:
Could you please help me out with a proper manifest file?
This would greatly expedite my journey.
As always, Kind regards and have a great day, dear team behind this incredible piece of software.
Oh, and btw, memory consumption on this thing in Docker? Right now it's 9MB! That's more than 15x less than the good old Squid. If you guys can get the docs in a human-readable state so people can get things done quickly this is gonna take over.
Amazing work.
Nino