narrowlink / ipstack

Asynchronous lightweight userspace implementation of TCP/IP stack for Tun device
Apache License 2.0
51 stars 12 forks source link

Fix timeout issues #25

Closed ssrlive closed 7 months ago

ssrlive commented 8 months ago

But I find another issue: the TCP connection can NOT exit.

We can reproduce it with tun2proxy and rperf. Command line rperf -c my_rmt_svr -u -r.

image

ssrlive commented 8 months ago

After this commit https://github.com/narrowlink/ipstack/pull/25/commits/8f232ce9e542b0294bf508db92d8454f33a02643 , it seems fixed. but it is in timeout situation, not a good solution.

image

SajjadPourali commented 8 months ago

Placing the flags in a line before affects my readability. We can put them on the same line if you don't mind.

let flags = tcp_flags::RST | tcp_flags::ACK;
pkt_sender.send(stream.create_rev_packet(flags, TTL, None, Vec::new())?)

I cannot reproduce the timeout issue, and working with tun2socks entails some complexities for me. Is it possible to describe the issue using an example or a proof of concept (PoC)?

ssrlive commented 8 months ago

I think this can significantly reduce the number of lines of code, otherwise readability will be reduced for me. how about add file rustfmt.toml with max_width = 140?

Placing the flags in a line before affects my readability.


testing steps for me:

  1. install and run rperf server on one VPS1:
    cargo install rperf --git=https://github.com/ssrlive/rperf.git --branch=nat
    rperf -s &
  2. install and run a SOCKS5 server on another VPS2:
    cargo install socks5-impl --example s5-server
    s5-server -l 0.0.0.0:1080 &
  3. install and run tun2proxy on local PC:
    cargo install tun2proxy
    sudo ~/.cargo/bin/tun2proxy -p socks5://vps2_addr:1080 -s -b vps2_addr -v trace
  4. open another terminal on local PC, intstall and run rperf client:
    cargo install rperf --git=https://github.com/ssrlive/rperf.git --branch=nat
    rperf -c vps1_addr -u -r

    Watch the output of tun2proxy, we can find some issues.

ssrlive commented 7 months ago

now, it looks the issue fixed indeed. And all the issues can closed.

image

ssrlive commented 7 months ago

Please publish a new version.