Implement redirect logic in UDP proxy

This commit is contained in:
Zoltán Papp
2025-02-17 14:58:01 +01:00
parent 06a17f0eee
commit 4db73a13d7
5 changed files with 213 additions and 27 deletions

View File

@@ -11,6 +11,11 @@ type Proxy interface {
EndpointAddr() *net.UDPAddr // EndpointAddr returns the address of the WireGuard peer endpoint
Work() // Work start or resume the proxy
Pause() // Pause to forward the packages from remote connection to WireGuard. The opposite way still works.
/*
RedirectAs resume the forwarding the packages from relayed connection to WireGuard interface if it was paused
and rewrite the src address to the endpoint address.
With this logic can avoid the package loss from relayed connections.
*/
RedirectAs(endpoint *net.UDPAddr)
CloseConn() error
RedirectTo(endpoint *net.UDPAddr)
}