mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Pass the incoming client_ip into the ExtORPort.
This commit is contained in:
parent
eca7ebb265
commit
9e5eb7f5ee
1 changed files with 12 additions and 4 deletions
|
@ -139,10 +139,18 @@ func webSocketHandler(ws *websocket.WebSocket) {
|
|||
handlerChan <- -1
|
||||
}()
|
||||
|
||||
// Pass an empty string for the client address. The remote address on
|
||||
// the incoming connection reflects that of the browser proxy, not of
|
||||
// the client. See https://bugs.torproject.org/18628.
|
||||
or, err := pt.DialOr(&ptInfo, "", ptMethodName)
|
||||
// Check if client addr is a valid IP
|
||||
addr := ws.Request().URL.Query().Get("client_ip")
|
||||
clientIP := net.ParseIP(addr)
|
||||
|
||||
if clientIP == nil {
|
||||
// Set client addr to empty
|
||||
addr = ""
|
||||
}
|
||||
|
||||
// Pass the address of client as the remote address of incoming connection
|
||||
or, err := pt.DialOr(&ptInfo, addr, ptMethodName)
|
||||
|
||||
if err != nil {
|
||||
log.Printf("failed to connect to ORPort: %s", err)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue