dndx / phantun

Transforms UDP stream into (fake) TCP streams that can go through Layer 3 & Layer 4 (NAPT) firewalls/NATs.
Apache License 2.0
1.71k stars 137 forks source link

Not compatible with LotServer (aka. 锐速) #95

Closed pexcn closed 1 year ago

pexcn commented 1 year ago

I found phantun not working with LotServer, it always reports the following error:

Connection (Fake TCP connection from 10.10.110.2:1024 to xxx.xxx.xxx.xxx:xxxxx) reset by peer

But when I turned off LotServer, everything works fine.

Here attach my boot command and logs:

# server
RUST_LOG=trace phantun-server --local 1024 --remote 127.0.0.1:1024 --ipv4-only \
  --tun ptun-t --tun-local 10.10.110.1 --tun-peer 10.10.110.2

# client
RUST_LOG=trace phantun-client --local 192.168.1.10:1024 --remote xx.xx.xx.xx:1024 --ipv4-only \
  --tun ptun-t --tun-local 10.10.110.1 --tun-peer 10.10.110.2

# server logs
 INFO  server > Remote address is: 127.0.0.1:1024
 INFO  server > 1 cores available
 TRACE mio::poll > registering event source with poller: token=Token(0), interests=READABLE | WRITABLE
 INFO  server    > Created TUN device ptun-t
 INFO  server    > Listening on 1024
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Sent SYN + ACK to client
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 TRACE fake_tcp  > Storing connection information into local tuples
 INFO  fake_tcp  > Connection from <client_ip>:48071 established
 INFO  server    > New connection: (Fake TCP connection from 10.10.110.2:1024 to <client_ip>:48071)
 TRACE mio::poll > registering event source with poller: token=Token(1), interests=READABLE | WRITABLE
 TRACE mio::poll > deregistering event source from poller
 TRACE mio::poll > registering event source with poller: token=Token(16777217), interests=READABLE | WRITABLE
 INFO  fake_tcp  > Connection (Fake TCP connection from 10.10.110.2:1024 to <client_ip>:48071) reset by peer
 TRACE mio::poll > deregistering event source from poller
 INFO  fake_tcp  > Fake TCP connection to (Fake TCP connection from 10.10.110.2:1024 to <client_ip>:48071) closed
 TRACE fake_tcp  > Removed cached tuple: AddrTuple { local_addr: 10.10.110.2:1024, remote_addr: <client_ip>:48071 }
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Sent SYN + ACK to client
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 TRACE fake_tcp  > Storing connection information into local tuples
 INFO  fake_tcp  > Connection from <client_ip>:2858 established
 INFO  server    > New connection: (Fake TCP connection from 10.10.110.2:1024 to <client_ip>:2858)
 TRACE mio::poll > registering event source with poller: token=Token(33554433), interests=READABLE | WRITABLE
 TRACE mio::poll > deregistering event source from poller
 TRACE mio::poll > registering event source with poller: token=Token(50331649), interests=READABLE | WRITABLE
 INFO  fake_tcp  > Connection (Fake TCP connection from 10.10.110.2:1024 to <client_ip>:2858) reset by peer
 TRACE mio::poll > deregistering event source from poller
 INFO  fake_tcp  > Fake TCP connection to (Fake TCP connection from 10.10.110.2:1024 to <client_ip>:2858) closed
 TRACE fake_tcp  > Removed cached tuple: AddrTuple { local_addr: 10.10.110.2:1024, remote_addr: <client_ip>:2858 }
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Sent SYN + ACK to client
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 TRACE fake_tcp  > Storing connection information into local tuples
 INFO  fake_tcp  > Connection from <client_ip>:64466 established
 INFO  server    > New connection: (Fake TCP connection from 10.10.110.2:1024 to <client_ip>:64466)
 TRACE mio::poll > registering event source with poller: token=Token(67108865), interests=READABLE | WRITABLE
 TRACE mio::poll > deregistering event source from poller
 TRACE mio::poll > registering event source with poller: token=Token(83886081), interests=READABLE | WRITABLE

# client logs
 INFO  client > Remote address is: <server_ip>:1024
 INFO  client > 2 cores available
 TRACE mio::poll > registering event source with poller: token=Token(0), interests=READABLE | WRITABLE
 TRACE mio::poll > registering event source with poller: token=Token(1), interests=READABLE | WRITABLE
 INFO  client    > Created TUN device ptun-t
 TRACE mio::poll > registering event source with poller: token=Token(2), interests=READABLE | WRITABLE
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Unknown TCP packet from <server_ip>:1024, sending RST
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Unknown TCP packet from <server_ip>:1024, sending RST
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Unknown TCP packet from <server_ip>:1024, sending RST
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Unknown TCP packet from <server_ip>:1024, sending RST
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Unknown TCP packet from <server_ip>:1024, sending RST
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Unknown TCP packet from <server_ip>:1024, sending RST
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Unknown TCP packet from <server_ip>:1024, sending RST
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Unknown TCP packet from <server_ip>:1024, sending RST
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Unknown TCP packet from <server_ip>:1024, sending RST
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Unknown TCP packet from <server_ip>:1024, sending RST
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Unknown TCP packet from <server_ip>:1024, sending RST
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Unknown TCP packet from <server_ip>:1024, sending RST
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Unknown TCP packet from <server_ip>:1024, sending RST
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Unknown TCP packet from <server_ip>:1024, sending RST
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Unknown TCP packet from <server_ip>:1024, sending RST
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  fake_tcp  > Unknown TCP packet from <server_ip>:1024, sending RST
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 INFO  client    > New UDP client from 192.168.1.1:48104
 INFO  fake_tcp  > Sent SYN to server
 TRACE fake_tcp  > Cache miss, checking the shared tuples table for connection
 TRACE fake_tcp  > Storing connection information into local tuples
 INFO  fake_tcp  > Connection to <server_ip>:1024 established
 DEBUG client    > inserted fake TCP socket into connection table
 TRACE mio::poll > registering event source with poller: token=Token(4), interests=READABLE | WRITABLE
 TRACE mio::poll > registering event source with poller: token=Token(3), interests=READABLE | WRITABLE
pexcn commented 1 year ago

Note: LotServer and crack patch can found here: https://github.com/fei5seven/lotServer https://github.com/Tai7sy/LotServer_KeyGen

dndx commented 1 year ago

Unsupported by Phantun as this is not real TCP protocol.