apernet / hysteria

Hysteria is a powerful, lightning fast and censorship resistant proxy.
https://v2.hysteria.network/
MIT License
14.62k stars 1.63k forks source link

Client not being connected to sever even if server shows the logs of up and running #1207

Open shivani446 opened 2 days ago

shivani446 commented 2 days ago

I have deployed hysteria2 server and it shows the logs of server up and running image but when I try to connect to the sever client shows this error Screenshot from 2024-09-23 12-15-21 This is my values for server , I tried with both acme and tls which works fine

    listen: :443 

    tls:
      cert: tls.crt
      key: tls.key
    # acme:
    #   domains:
    #     - domain

    auth:
      type: password
      password: "my_pass"

    masquerade: 
      type: proxy
      proxy:
        url: "https://news.ycombinator.com/" 
        rewriteHost: true

and client values follows

server: domain:443

auth: "pass"

bandwidth: 
  up: 20 mbps
  down: 100 mbps

lazy: true

tls:
  insecure: true

socks5:
  listen: 127.0.0.1:1080

http:
  listen: 127.0.0.1:8088

I am aware of this docs https://v2.hysteria.network/docs/advanced/Troubleshooting/ the sever running on ubuntu >>22.04

i would like to debug it further If might be helpful if i can debug that the server is properly running or not, I have added the debug logs but when i try to connect the client the server does not show any logs as the request from client itself is not reaching to sever. @haruue

haruue commented 1 day ago

Hello.

The error you got is the same as failed to initialize client (connect error: timeout: no recent network activity) in the troubleshooting guide. And it is recommended to disable lazy mode when debugging such a problem, so the Hysteria client will try to connect to the server immediately after it is started.

shivani446 commented 1 day ago

I think I am progressing

2024-09-23T19:33:25+05:30   INFO    client mode
2024-09-23T19:33:25+05:30   INFO    connected to server {"udpEnabled": true, "tx": 2500000, "count": 1}
2024-09-23T19:33:25+05:30   INFO    use this URI to share your server   {"uri": "}
2024-09-23T19:33:25+05:30   DEBUG   checking for updates    {"version": "v2.5.1", "platform": "linux", "arch": "amd64", "channel": "release"}
2024-09-23T19:33:25+05:30   INFO    HTTP proxy server listening {"addr": "127.0.0.1:8088"}
2024-09-23T19:33:25+05:30   INFO    SOCKS5 server listening {"addr": "127.0.0.1:1080"}
2024-09-23T19:33:26+05:30   DEBUG   no update available
2024-09-23T19:33:33+05:30   DEBUG   HTTP CONNECT request    {"addr": "127.0.0.1:45454", "reqAddr": "}
2024-09-23T19:33:33+05:30   DEBUG   HTTP CONNECT request    {"addr": "127.0.0.1:45456", "reqAddr": org:443"}
2024-09-23T19:33:34+05:30   DEBUG   HTTP CONNECT closed {"addr": "127.0.0.1:45454", "reqAddr": "}

but I m not getting the response from the server https://github.com/apernet/hysteria/discussions/939 followed this and it got connected to sever

Sep 23 13:45:12  systemd[1]: Started Hysteria Server Service (config.yaml).
Sep 23 13:45:12  hysteria[3551460]: 2024-09-23T13:45:12Z        INFO        server mode
Sep 23 13:45:12  hysteria[3551460]: 2024-09-23T13:45:12Z        INFO        server up and running        {"listen": ":443"}
Sep 23 13:45:44  hysteria[3551460]: 2024-09-23T13:45:44Z        INFO        client connected        {"addr": "43.254.176.154:12434", "id": "user", "tx": 12500000}
Sep 23 13:45:55  hysteria[3551460]: 2024-09-23T13:45:55Z        WARN        TCP error        {"addr": "ip:12434", "id": "user", "reqAddr": "api.hy2.io:443", "error": "readfrom tcp4 ip:35362->ip:443: Application error 0x100 (remote)"}
Sep 23 13:45:55  hysteria[3551460]: 2024-09-23T13:45:55Z        WARN        TCP error        {"addr": "4ip:12434", "id": "user", "reqAddr": "detectportal.firefox.com:80", "error": "readfrom tcp4 ip:49516->34.107.221.82:80: Application error 0x100 (remote)"}
Sep 23 13:45:55  hysteria[3551460]: 2024-09-23T13:45:55Z        WARN        TCP error        {"addr": "ip:12434", "id": "user", "reqAddr": "ping.archlinux.org:80", "error": "readfrom tcp4 ip:39624->ip:80: Application error 0x100 (remote)"}

got this error in server can u help me with this btw Thanks @haruue

haruue commented 1 day ago

Can you successfully execute the following curl command on your server?

curl -vv https://api.hy2.io/cdn-cgi/trace

The Application error 0x100 (remote) error on the server side is an unusual error that indicates that the peer (client) has actively closed the Hysteria connection while the server is handling the TCP connection.

So I think what actually happens is that the Hysteria server has been stuck trying to connect to the target website, until you decided to restart the Hysteria client.

You can use journalctl -f -u hysteria-server to see the server output in real time.

shivani446 commented 1 day ago

I ran this command curl -vv https://api.hy2.io/cdn-cgi/trace and i was successfully able to run it It says Connected to api.hy2.io(ip) port 443 journalctl -f -u hysteria-server got te same TCP and application errors as before I think there is some network related issue here