connecting with mysql, when using mysql client is ok, but with golang product and "go run" command cannot work.
heliping opened this issue · 2 comments
heliping commented
- use mysql client is ok
huaxreplay git:(dev) proxychains4 mysql -u root -h 10.100.0.211 -p********
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.16
mysql: [Warning] Using a password on the command line interface can be insecure.
[proxychains] Dynamic chain ... 10.11.192.135:1080 ... 10.100.0.211:3306 ... OK
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1387631
Server version: 5.5.5-10.1.40-MariaDB MariaDB Server
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> exit;
Bye
- with go run is fail
huaxreplay git:(dev) proxychains4 go run main.go
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.16
# command-line-arguments
[proxychains] DLL init: proxychains-ng 4.16
[proxychains] DLL init: proxychains-ng 4.16
[proxychains] DLL init: proxychains-ng 4.16
[proxychains] DLL init: proxychains-ng 4.16
2022/12/13 09:53:31 /root/src/gomy/huaxreplay/huaxreplay/models/db.go:42
[error] failed to initialize database, got error dial tcp 10.100.0.211:3306: connect: connection timed out
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)
[GIN-debug] GET /metrics --> github.com/zsais/go-gin-prometheus.prometheusHandler.func1 (5 handlers)
[GIN-debug] POST /api/v1/huaxreplay/run --> huaxreplay/controllers.ReplayAdd (7 handlers)
[GIN-debug] DELETE /api/v1/huaxreplay/run --> huaxreplay/controllers.ReplayDel (7 handlers)
[GIN-debug] Listening and serving HTTP on :5001
^Csignal: interrupt
I use the wireshark to trace, no package to send when with golang.
heliping commented
same environment, rust by cargo is ok
rhuax git:(dev) ✗ proxychains4 cargo run
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.16
[proxychains] DLL init: proxychains-ng 4.16
Finished dev [unoptimized + debuginfo] target(s) in 0.09s
Running `target/debug/rhuax`
[proxychains] DLL init: proxychains-ng 4.16
current_dir "/root/src/rustmy/rhuax"
current_dir "/root/src/rustmy/rhuax"
2022-12-13T11:14:38.581545700+08:00 INFO rhuax::configs::config - 启动日志服务成功 "/root/src/rustmy/rhuax/src/configs/config.yaml"
2022-12-13T11:14:38.581953600+08:00 INFO rhuax::models::db - 连接数据库:"mysql://evi_test:*********@10.100.22.64:3306/iot"
2022-12-13T11:14:38.582789300+08:00 INFO rhuax::models::db - 连接数据库:"mysql://root:*********@10.100.0.211:3306/huaxrobot"
2022-12-13T11:14:38.583621100+08:00 INFO rhuax::router::router - Starting server...
model: MyObj { raw: "1F8B080074147763000325C3B10D00101000C0670A8901B49E8FC430143AE69088352CA7D57E47E2921B15ED87026473E8E9450A1A40F469B65A257A4E5422713E172917779B2F000000" }
[proxychains] Dynamic chain ... 10.11.192.135:1080 ... 10.100.22.64:3306 ... OK
2022-12-13T11:14:43.731377100+08:00 INFO rbatis::plugin::log - [rbatis] [445061304076603392] Fetch ==> select * from tab_iot_column_base
[rbatis] Args ==> []
2022-12-13T11:14:43.805185400+08:00 INFO rbatis::plugin::log - [rbatis] [445061304076603392] ReturnRows <== 69
haad commented
proxychains work on libc level, with go binaries/products you have often your libraries compiled in.