pufferffish / wireproxy

Wireguard client that exposes itself as a socks5 proxy
ISC License
4.54k stars 272 forks source link

Add support of DynDNS IP address refresh #109

Open valeryplotnik opened 7 months ago

valeryplotnik commented 7 months ago

I'm using wireproxy for connecting to my home router with WireGuard and configured DynDNS service to have an up-to-date IP address of my router under specific DNS record.

So my wireguard config looks like this:

[Peer]
PublicKey = XXX
Endpoint = dyndns.addr:1234
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25

As soon as my router restarted and IP address has been changed, wireproxy cannot re-connect to new address.

DEBUG: 2024/04/15 14:27:15 peer(w0Jb…T4lU) - Sending keepalive packet
DEBUG: 2024/04/15 14:27:15 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:27:20 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 2)
DEBUG: 2024/04/15 14:27:20 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:27:25 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 3)
DEBUG: 2024/04/15 14:27:25 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:27:31 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 4)
DEBUG: 2024/04/15 14:27:31 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:27:36 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 5)
DEBUG: 2024/04/15 14:27:36 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:27:41 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 6)
DEBUG: 2024/04/15 14:27:41 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:27:46 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 7)
DEBUG: 2024/04/15 14:27:46 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:27:51 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 8)
DEBUG: 2024/04/15 14:27:51 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:27:56 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 9)
DEBUG: 2024/04/15 14:27:56 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:28:02 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 10)
DEBUG: 2024/04/15 14:28:02 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:28:07 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 11)
DEBUG: 2024/04/15 14:28:07 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:28:12 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 12)
DEBUG: 2024/04/15 14:28:12 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:28:17 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 13)
DEBUG: 2024/04/15 14:28:17 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:28:22 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 14)
DEBUG: 2024/04/15 14:28:22 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:28:28 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 15)
DEBUG: 2024/04/15 14:28:28 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:28:33 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 16)
DEBUG: 2024/04/15 14:28:33 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:28:38 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 17)
DEBUG: 2024/04/15 14:28:38 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:28:43 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 18)
DEBUG: 2024/04/15 14:28:43 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:28:48 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 19)
DEBUG: 2024/04/15 14:28:48 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:28:54 peer(w0Jb…T4lU) - Handshake did not complete after 5 seconds, retrying (try 20)
DEBUG: 2024/04/15 14:28:54 peer(w0Jb…T4lU) - Sending handshake initiation
DEBUG: 2024/04/15 14:28:59 peer(w0Jb…T4lU) - Handshake did not complete after 20 attempts, giving up

As soon as I restart container with wireproxy, everything starts working.

Is it possible to support this scenario and refresh IP address of the peer if non-IP address provided in the endpoint config?

Thank you in advance.

hhs66317 commented 7 months ago

I also encountered the same problem