erebe / wstunnel

Tunnel all your traffic over Websocket or HTTP2 - Bypass firewalls/DPI - Static binary available
Other
3.22k stars 290 forks source link

failed to do websocket handshake with the server #205

Closed Hhk78 closed 4 months ago

Hhk78 commented 4 months ago

Server log ➜ ~ ./wstunnel server ws://0.0.0.0:443 2023-12-29T16:30:54.342119Z INFO wstunnel: Starting wstunnel server v8.5.2 with config WsServerConfig { socket_so_mark: None, bind: x.x.x.x:443, restrict_to: None, restrict_http_upgrade_path_prefix: None, websocket_ping_frequency: None, timeout_connect: 10s, websocket_mask_frame: false, tls: false } 2023-12-29T16:30:54.342770Z INFO wstunnel::tunnel::server: Starting wstunnel server listening on x.x.x.x:443 2023-12-29T16:30:55.369475Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:30:55.379006Z WARN tunnel{peer="x.x.x.x.x.209:4994"}: wstunnel::tunnel::server: error while decoding jwt for tunnel info Err(Error(InvalidToken)) header None 2023-12-29T16:30:55.451774Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:30:55.463895Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:30:55.464622Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:30:55.465062Z WARN tunnel{peer="x.x.x.x.x:4296"}: wstunnel::tunnel::server: error while decoding jwt for tunnel info Err(Error(InvalidToken)) header None 2023-12-29T16:30:55.471467Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:30:55.472044Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:30:55.472521Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:31:36.593339Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:31:36.596198Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:31:36.602253Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:31:36.605328Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:31:36.618256Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:31:44.065886Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:31:44.066092Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:31:44.066226Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:31:44.066367Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:31:44.066986Z INFO wstunnel::tunnel::server: Accepting connection 2023-12-29T16:31:48.568479Z WARN tunnel{peer="x.x.x.x.x:5118"}: wstunnel::tunnel::server: error while decoding jwt for tunnel info Err(Error(InvalidToken)) header None 2023-12-29T16:31:48.707513Z INFO wstunnel::tunnel::server: Accepting connection

Client log

➜ ~ wstunnel client -L socks5://127.0.0.1:8888 --connection-min-idle 5 ws://x.x.x.x:443 2023-12-29T16:31:44.614592Z INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2023-12-29T16:31:44.614800Z INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2023-12-29T16:31:44.614862Z INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2023-12-29T16:31:44.615025Z INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2023-12-29T16:31:44.615179Z INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2023-12-29T16:31:44.734573Z INFO wstunnel::socks5: Starting SOCKS5 server listening cnx on 127.0.0.1:8888 2023-12-29T16:31:49.247141Z INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2023-12-29T16:31:49.382146Z ERROR tunnel{id="018cb66a-e9fe-71ba-86a0-019c4887299b" remote="212.102.35.236:80"}: wstunnel::tunnel::client: failed to do websocket handshake with the server (Ipv4(x.x.x.x), 443)

Caused by: Invalid status code: 400

farivar-tabatabaei commented 4 months ago

Are your client and server binaries both the same version?

I had the same issue, my client was 8.4.2 and my server was 8.5.0, updating the client to 8.5.0 resolved the issue.

erebe commented 4 months ago

@farivar-tabatabaei is most likely right

wstunnel::tunnel::server: error while decoding jwt for tunnel info Err(Error(InvalidToken)) header None

means the header where is passed the JWT is not present.

v8.5.x is a breaking change release, you need to update client and server

erebe commented 4 months ago

Feel free to re-open if needed

Hhk78 commented 4 months ago

sorry for the late replies I couldn't take care of it for a while due to some problems. I used the same version on both the server and the client and still got the error.

sorry for bad english

2024-01-04T14:04:05.199319Z  INFO wstunnel::tcp: Opening TCP connection tox.x.x.x:443    
Error polling connection: error shutting down connection
2024-01-04T14:04:11.533136Z ERROR tunnel{id="018cd4c9-ccfb-7edf-bf9d-740c72982ad6" remote="212.102.35.236:80"}: wstunnel::tunnel::client: failed to do websocket handshake with the server (Ipv4(x.x.x.x), 443)

Caused by:
    0: connection error
    1: Connection reset by peer (os error 104)
2024-01-04T14:04:35.197259Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T14:05:05.197535Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T14:05:05.197836Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T14:05:05.197959Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T14:05:05.198074Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T14:05:35.197592Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T14:05:53.553526Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
Error polling connection: error shutting down connection
2024-01-04T14:06:00.816841Z ERROR tunnel{id="018cd4cb-780f-7038-bba1-e37be5da30c2" remote="212.102.35.236:80"}: wstunnel::tunnel::client: failed to do websocket handshake with the server (Ipv4(x.x.x.x), 443)

Caused by:
    0: connection error
    1: Connection reset by peer (os error 104)
erebe commented 4 months ago

It seems something in the middle between your client and the server is force closing the connection. Would you mind trying by starting the server and client with tls activated.

P.s: note wss:// instead of ws://

wstunnel server wss://0.0.0.0:443
 wstunnel client -L socks5://127.0.0.1:8888 --connection-min-idle 5 wss://x.x.x.x:443

if it does not work, please start the client and server with this option --log-lvl=trace and paste me the logs of client and server.

Hhk78 commented 4 months ago

client


➜  antiC ./wstunnel client -L socks5://127.0.0.1:10800 --connection-min-idle 5 wss://x.x.x.x:443
2024-01-04T15:52:53.130948Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:52:53.131321Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:52:53.131498Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:52:53.131635Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:52:53.131856Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:52:53.202198Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:52:53.212826Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:52:53.222340Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:52:53.230127Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:52:53.239477Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:53:00.927718Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:53:00.928331Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:53:00.930867Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:53:00.932035Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:53:00.932546Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:53:01.000709Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:53:01.038908Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:53:01.061423Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:53:01.075588Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:53:01.089131Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:53:09.011284Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:53:09.012408Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:53:09.013015Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:53:09.082940Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:53:09.103963Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:53:09.120095Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:53:09.264463Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:53:09.265534Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:53:09.336227Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:53:09.359241Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:53:17.999307Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:53:18.000135Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:53:18.000741Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:53:18.071956Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:53:18.081400Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:53:18.088487Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:53:18.259589Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:53:18.259893Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T15:53:18.330750Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
2024-01-04T15:53:18.344484Z  INFO wstunnel::tls: Doing TLS handshake using sni IpAddress(x.x.x.x) with the server x.x.x.x:443
thread 'main' panicked at src/main.rs:638:18:
called `Result::unwrap()` on an `Err` value: failed to do TLS handshake with the server (Ipv4(x.x.x.x), 443)

Caused by:
    tls handshake eof
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[1]    14124 IOT instruction (core dumped)  ./wstunnel client -L socks5://127.0.0.1:10800 --connection-min-idle 5 ```

server 

`
➜  ~ ./wstunnel server wss://0.0.0.0:443
2024-01-04T15:51:40.427235Z  INFO wstunnel::embedded_certificate: Loading embedded tls certificate
2024-01-04T15:51:40.427806Z  INFO wstunnel::embedded_certificate: Loading embedded tls private key
2024-01-04T15:51:40.428073Z  INFO wstunnel: Starting wstunnel server v8.5.2 with config WsServerConfig { socket_so_mark: None, bind: 0.0.0.0:443, restrict_to: None, restrict_http_upgrade_path_prefix: None, websocket_ping_frequency: None>
2024-01-04T15:51:40.428289Z  INFO wstunnel::tunnel::server: Starting wstunnel server listening on 0.0.0.0:443`

sorry for english
erebe commented 4 months ago

Can you retry but this time by starting the client with

./wstunnel client -L socks5://127.0.0.1:10800 --tls-sni-override=google.com --connection-min-idle 5 wss://x.x.x.x:443 

You can replace google.com by a domain that you know is allowed (i.e: github.com, cloudflare.com)

Would you mind describing me your setup (i.e: if you have a reverse proxy in front ?) and what kind of firewall you are trying to bypass ?

Hhk78 commented 4 months ago

I'm trying to bypass a TLS Inspection firewall at my school. It won't work with TLS, but I'm trying what you said with my home internet and it still causes problems. It was working fine before but suddenly it stopped working. I changed the version and went back to the old version and it still doesn't work. By the way, Google is among the domains allowed by the firewall. That's what I wanted to explain. Thanks.

client


➜  antiC ./wstunnel client -L socks5://127.0.0.1:10800 --tls-sni-override=google.com --connection-min-idle 5 wss://x.x.x.x:443
2024-01-04T16:40:56.255015Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2024-01-04T16:40:56.255291Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2024-01-04T16:40:56.255372Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2024-01-04T16:40:56.255443Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2024-01-04T16:40:56.255543Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2024-01-04T16:41:06.256583Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed
2024-01-04T16:41:06.256743Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed
2024-01-04T16:41:06.256806Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed
2024-01-04T16:41:06.256865Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed
2024-01-04T16:41:06.256922Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed
2024-01-04T16:41:06.657911Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2024-01-04T16:41:06.658287Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2024-01-04T16:41:06.658436Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2024-01-04T16:41:06.659130Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2024-01-04T16:41:06.659487Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2024-01-04T16:41:16.660229Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed
2024-01-04T16:41:16.660461Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed
2024-01-04T16:41:16.660583Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed
2024-01-04T16:41:16.660787Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed
2024-01-04T16:41:16.660926Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed
2024-01-04T16:41:17.461971Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2024-01-04T16:41:17.462581Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2024-01-04T16:41:17.463030Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2024-01-04T16:41:17.463288Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2024-01-04T16:41:17.463695Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443
2024-01-04T16:41:27.464088Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed
thread 'main' panicked at src/main.rs:638:18:
called `Result::unwrap()` on an `Err` value: Cannot connect to tcp endpoint x.x.x.x:443 reason None
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[1]    17309 IOT instruction (core dumped)  ./wstunnel client -L socks5://127.0.0.1:10800 --tls-sni-override=google.com```

Server 
`➜  ~ ./wstunnel server wss://x.x.x.x:443
2024-01-04T16:40:50.021533Z  INFO wstunnel::embedded_certificate: Loading embedded tls certificate
2024-01-04T16:40:50.021997Z  INFO wstunnel::embedded_certificate: Loading embedded tls private key
2024-01-04T16:40:50.022405Z  INFO wstunnel: Starting wstunnel server v8.5.2 with config WsServerConfig { socket_so_mark: None, bind: x.x.x.x:443, restrict_to: None, restrict_http_upgrade_path_prefix: None, websocket_ping_frequency: None>
2024-01-04T16:40:50.022687Z  INFO wstunnel::tunnel::server: Starting wstunnel server listening on x.x.x.x:443`

I'm trying to bypass a TLS Inspection firewall at my school. It won't work with TLS, but I'm trying what you said with my home internet and it still causes problems.
It was working fine before but suddenly it stopped working. I changed the version and went back to the old version and it still doesn't work.
By the way, Google is among the domains allowed by the firewall.
That's what I wanted to explain. Thanks.

sorry for english
erebe commented 4 months ago

Would you mind providing the logs with the client started the with cmd line --log-lvl=trace ?

You can try also without TLS but by adding --websocket-mask-frame to the client (server needs to be started without TLS too)

wstunnel client -L socks5://127.0.0.1:8888 --connection-min-idle 5 --websocket-mask-frame ws://x.x.x.x:443

I assume your setup is like

[client] ----> firewall ---> [server]

Without any reverse proxy on the server, and that your server is publicly accessible from internet.

Hhk78 commented 4 months ago

Yes, you are right, I connect to the internet as you said. sorry for english


➜  antiC ./wstunnel client -L socks5://127.0.0.1:10800 --connection-min-idle 5 --websocket-mask-frame ws://x.x.x.x:443 --log-lvl=trace
2024-01-04T17:16:48.170275Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T17:16:48.170364Z DEBUG wstunnel::tcp: connecting to x.x.x.x:443
2024-01-04T17:16:48.170544Z TRACE mio::poll: registering event source with poller: token=Token(140040792550272), interests=READABLE | WRITABLE    
2024-01-04T17:16:48.170587Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T17:16:48.170622Z DEBUG wstunnel::tcp: connecting to x.x.x.x:443
2024-01-04T17:16:48.170696Z TRACE mio::poll: registering event source with poller: token=Token(140040792550656), interests=READABLE | WRITABLE    
2024-01-04T17:16:48.170716Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T17:16:48.170728Z DEBUG wstunnel::tcp: connecting to x.x.x.x:443
2024-01-04T17:16:48.170785Z TRACE mio::poll: registering event source with poller: token=Token(140040792551040), interests=READABLE | WRITABLE    
2024-01-04T17:16:48.170804Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T17:16:48.170816Z DEBUG wstunnel::tcp: connecting to x.x.x.x:443
2024-01-04T17:16:48.170874Z TRACE mio::poll: registering event source with poller: token=Token(140040792888320), interests=READABLE | WRITABLE    
2024-01-04T17:16:48.170919Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T17:16:48.170932Z DEBUG wstunnel::tcp: connecting to x.x.x.x:443
2024-01-04T17:16:48.170992Z TRACE mio::poll: registering event source with poller: token=Token(140040792888704), interests=READABLE | WRITABLE    
2024-01-04T17:16:58.172435Z TRACE mio::poll: deregistering event source from poller    
2024-01-04T17:16:58.172655Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed    
2024-01-04T17:16:58.172707Z TRACE mio::poll: deregistering event source from poller    
2024-01-04T17:16:58.172757Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed    
2024-01-04T17:16:58.172790Z TRACE mio::poll: deregistering event source from poller    
2024-01-04T17:16:58.172831Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed    
2024-01-04T17:16:58.172863Z TRACE mio::poll: deregistering event source from poller    
2024-01-04T17:16:58.172908Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed    
2024-01-04T17:16:58.172941Z TRACE mio::poll: deregistering event source from poller    
2024-01-04T17:16:58.172981Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed    
2024-01-04T17:16:58.574563Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T17:16:58.574680Z DEBUG wstunnel::tcp: connecting to x.x.x.x:443
2024-01-04T17:16:58.574920Z TRACE mio::poll: registering event source with poller: token=Token(140040792889088), interests=READABLE | WRITABLE    
2024-01-04T17:16:58.574981Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T17:16:58.575016Z DEBUG wstunnel::tcp: connecting to x.x.x.x:443
2024-01-04T17:16:58.575137Z TRACE mio::poll: registering event source with poller: token=Token(140040792889472), interests=READABLE | WRITABLE    
2024-01-04T17:16:58.575180Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T17:16:58.575210Z DEBUG wstunnel::tcp: connecting to x.x.x.x:443
2024-01-04T17:16:58.575338Z TRACE mio::poll: registering event source with poller: token=Token(140040792889856), interests=READABLE | WRITABLE    
2024-01-04T17:16:58.575375Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T17:16:58.575408Z DEBUG wstunnel::tcp: connecting to x.x.x.x:443
2024-01-04T17:16:58.575539Z TRACE mio::poll: registering event source with poller: token=Token(140040792890240), interests=READABLE | WRITABLE    
2024-01-04T17:16:58.575662Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T17:16:58.575698Z DEBUG wstunnel::tcp: connecting to x.x.x.x:443
2024-01-04T17:16:58.575814Z TRACE mio::poll: registering event source with poller: token=Token(140040792890752), interests=READABLE | WRITABLE    
2024-01-04T17:17:08.576347Z TRACE mio::poll: deregistering event source from poller    
2024-01-04T17:17:08.576536Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed    
2024-01-04T17:17:08.576667Z TRACE mio::poll: deregistering event source from poller    
2024-01-04T17:17:08.576734Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed    
2024-01-04T17:17:08.576806Z TRACE mio::poll: deregistering event source from poller    
2024-01-04T17:17:08.576950Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed    
2024-01-04T17:17:08.577176Z TRACE mio::poll: deregistering event source from poller    
2024-01-04T17:17:08.577408Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed    
2024-01-04T17:17:08.577468Z TRACE mio::poll: deregistering event source from poller    
2024-01-04T17:17:08.577976Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed    
2024-01-04T17:17:09.378700Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T17:17:09.378837Z DEBUG wstunnel::tcp: connecting to x.x.x.x:443
2024-01-04T17:17:09.379207Z TRACE mio::poll: registering event source with poller: token=Token(140040792891136), interests=READABLE | WRITABLE    
2024-01-04T17:17:09.379329Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T17:17:09.379377Z DEBUG wstunnel::tcp: connecting to x.x.x.x:443
2024-01-04T17:17:09.379667Z TRACE mio::poll: registering event source with poller: token=Token(140040792543488), interests=READABLE | WRITABLE    
2024-01-04T17:17:09.379754Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T17:17:09.379807Z DEBUG wstunnel::tcp: connecting to x.x.x.x:443
2024-01-04T17:17:09.380099Z TRACE mio::poll: registering event source with poller: token=Token(140040792543872), interests=READABLE | WRITABLE    
2024-01-04T17:17:09.380187Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T17:17:09.380233Z DEBUG wstunnel::tcp: connecting to x.x.x.x:443
2024-01-04T17:17:09.380477Z TRACE mio::poll: registering event source with poller: token=Token(140040792544256), interests=READABLE | WRITABLE    
2024-01-04T17:17:09.380704Z  INFO wstunnel::tcp: Opening TCP connection to x.x.x.x:443    
2024-01-04T17:17:09.380761Z DEBUG wstunnel::tcp: connecting to x.x.x.x:443
2024-01-04T17:17:09.381038Z TRACE mio::poll: registering event source with poller: token=Token(140040792544640), interests=READABLE | WRITABLE    
2024-01-04T17:17:19.381118Z TRACE mio::poll: deregistering event source from poller    
2024-01-04T17:17:19.381456Z  WARN wstunnel::tcp: Cannot connect to tcp endpoint x.x.x.x:443 due to timeout of 10s elapsed    
2024-01-04T17:17:19.381599Z TRACE mio::poll: deregistering event source from poller    
2024-01-04T17:17:19.381893Z TRACE mio::poll: deregistering event source from poller    
2024-01-04T17:17:19.382050Z TRACE mio::poll: deregistering event source from poller    
2024-01-04T17:17:19.382150Z TRACE mio::poll: deregistering event source from poller    
thread 'main' panicked at src/main.rs:638:18:
called `Result::unwrap()` on an `Err` value: Cannot connect to tcp endpoint x.x.x.x:443 reason None
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[1]    19209 IOT instruction (core dumped)  ./wstunnel client -L socks5://127.0.0.1:10800 --connection-min-idle 5```
erebe commented 4 months ago

Can you send me your server ip by email, so I can check it is reachable from internet.

This timeout you have timeout, so it means your packets are being dropped completely. It may mean that your IP address has been blacklisted.

Hhk78 commented 4 months ago

Yes I can send it by email By the way, I connect to my server via ssh and when I open an http server on port 443, I can connect. you can give your email

erebe commented 4 months ago

github@erebe.eu

Will check tomorrow, or saturday, I haveto leave for the time being.

Hhk78 commented 4 months ago

okay

erebe commented 4 months ago

Hi back,

I got the time to try out, and indeed it is hardcore firewalling that you have. Funnily, I don't have the same behavior all the time, depending on the network I use to connect.

My guess is that this is some low lvl firewall where whole IP ranges are blacklisted from exchanging traffic. Can't do much in this case, beside trying to tunnel traffic through a third party that is allowed.

Last time, I helped another Turkish guy that was using Cloudflare as middle man. https://github.com/erebe/wstunnel/issues/150 maybe this can help you.

Hhk78 commented 4 months ago

Hi back,

I got the time to try out, and indeed it is hardcore firewalling that you have. Funnily, I don't have the same behavior all the time, depending on the network I use to connect.

* If use my home network in France, I can't even do a TCP connect to your server. It seems like packet are dropped completely.

* If I use a server located in Germany from a cloud provider, same, packets are completely dropped

* If I use mobile carrier network, which are harder to blacklist, I manage to do a TCP handshake and start a TLS negotiation with _something_ but after that the traffic is completely staled/nothing respond.

My guess is that this is some low lvl firewall where whole IP ranges are blacklisted from exchanging traffic. Can't do much in this case, beside trying to tunnel traffic through a third party that is allowed.

Last time, I helped another Turkish guy that was using Cloudflare as middle man. #150 maybe this can help you.

Thanks for your help and interest. A friend of mine recommended v2ray. When I make a connection via V2ray with the http header "Host: www.google.com" it works. I did the same thing with wstunnel with the -H parameter and it was working before. Maybe they have now solved wstunnel's traffic algorithm and that's why it is now blocked. I don't know much about this, so I apologize if I gave the wrong example. Thank you despite everything.

sorry for english

erebe commented 4 months ago

Hello, No worries, thanks for letting me know in any case :)

If I can ask you 1 last thing, would you mind trying this website https://websocketking.com/ and let me know if it works for you. That you can send and get back data.

Hhk78 commented 4 months ago

Hello, No worries, thanks for letting me know in any case :)

If I can ask you 1 last thing, would you mind trying this website https://websocketking.com/ and let me know if it works for you. That you can send and get back data.

can't connect :(