hmgle / graftcp

A flexible tool for redirecting a given program's TCP traffic to SOCKS5 or HTTP proxy.
GNU General Public License v3.0
2.07k stars 174 forks source link

v0.5.0-beta.1 pre-release: It doesn't work #51

Closed phantomcraft closed 1 year ago

phantomcraft commented 1 year ago

Describe the bug

I would like to use the latest version of graftcp, but it doesn't work.

To Reproduce Steps to reproduce the behavior:

$ ./graftcp curl 1.1.1.1
curl: (56) Recv failure: Connection reset by peer
./graftcp-local -select_proxy_mode direct 
[2022-08-12 19:42:33] [NOTICE] graftcp-local start
[2022-08-12 19:42:33] [INFO] select_proxy_mode: direct
[2022-08-12 19:42:33] [INFO] graftcp-local start listening :2233...
[2022-08-12 19:42:47] [ERROR] getPidByAddr(127.0.0.1:34528, 127.0.0.1:2233) failed
[2022-08-12 19:43:01] [ERROR] getPidByAddr(127.0.0.1:40190, 127.0.0.1:2233) failed
[2022-08-12 19:43:03] [ERROR] getPidByAddr(127.0.0.1:40206, 127.0.0.1:2233) failed
[2022-08-12 19:43:05] [ERROR] getPidByAddr(127.0.0.1:40222, 127.0.0.1:2233) failed
[2022-08-12 19:44:22] [ERROR] getPidByAddr(127.0.0.1:47046, 127.0.0.1:2233) failed
[2022-08-12 19:44:26] [ERROR] getPidByAddr(127.0.0.1:47056, 127.0.0.1:2233) failed

I'm using Debian testing, Linux kernel 5.18.14 amd64, graftcp compiled with GCC 11.3.0, graftcp-local compiled with go 1.18.3.

hmgle commented 1 year ago

It can't be reproduced on my machine. Does the mgraftcp(mgraftcp --select_proxy_mode=direct --enable-debug-log curl 1.1.1.1) work?

phantomcraft commented 1 year ago
user@localhost:~$ /dev/shm/mgraftcp --select_proxy_mode=direct  --enable-debug-log curl 1.1.1.1
[2022-08-13 16:24:42] [INFO] graftcp-local start listening :0...
[2022-08-13 16:24:42] [INFO] Request PID: 684272, Source Addr: 127.0.0.1:53052, Dest Addr: 1.1.1.1:80
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
[2022-08-13 16:24:42] [ERROR] accept err: accept tcp [::]:43351: use of closed network connection

I tested graftcp and graftcp-local again:

user@localhost:~$ /dev/shm/graftcp-local -select_proxy_mode direct
[2022-08-13 16:25:49] [NOTICE] graftcp-local start
[2022-08-13 16:25:49] [INFO] select_proxy_mode: direct
[2022-08-13 16:25:49] [INFO] graftcp-local start listening :2233...
[2022-08-13 16:26:18] [INFO] Request PID: 684367, Source Addr: 127.0.0.1:54246, Dest Addr: 1.1.1.1:80
user@localhost:~$ /dev/shm/graftcp curl 1.1.1.1
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>cloudflare</center>
</body>
</html>

========================

I don't know why it was not working yesterday.

Closing this issue, sorry. If I find more problem I post here.