mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 23:11:29 -04:00
Bug 18628: Pass the client_ip parameter in the JavaScript proxy as well.
This commit is contained in:
parent
0c7ddeb1d0
commit
eca7ebb265
2 changed files with 16 additions and 3 deletions
|
@ -93,7 +93,20 @@ class ProxyPair
|
|||
# Assumes WebRTC datachannel is connected.
|
||||
connectRelay: =>
|
||||
dbg 'Connecting to relay...'
|
||||
@relay = makeWebsocket @relayAddr
|
||||
|
||||
# Get a remote IP address from the PeerConnection, if possible. Add it to
|
||||
# the WebSocket URL's query string if available.
|
||||
# MDN marks remoteDescription as "experimental". However the other two
|
||||
# options, currentRemoteDescription and pendingRemoteDescription, which
|
||||
# are not marked experimental, were undefined when I tried them in Firefox
|
||||
# 52.2.0.
|
||||
# https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/remoteDescription
|
||||
peer_ip = Parse.ipFromSDP(@pc.remoteDescription?.sdp)
|
||||
params = []
|
||||
if peer_ip?
|
||||
params.push(["client_ip", peer_ip])
|
||||
|
||||
@relay = makeWebsocket @relayAddr, params
|
||||
@relay.label = 'websocket-relay'
|
||||
@relay.onopen = =>
|
||||
if @timer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue