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
|
handlerChan <- -1
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Pass an empty string for the client address. The remote address on
|
// Check if client addr is a valid IP
|
||||||
// the incoming connection reflects that of the browser proxy, not of
|
addr := ws.Request().URL.Query().Get("client_ip")
|
||||||
// the client. See https://bugs.torproject.org/18628.
|
clientIP := net.ParseIP(addr)
|
||||||
or, err := pt.DialOr(&ptInfo, "", ptMethodName)
|
|
||||||
|
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 {
|
if err != nil {
|
||||||
log.Printf("failed to connect to ORPort: %s", err)
|
log.Printf("failed to connect to ORPort: %s", err)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue