mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 23:11:29 -04:00
Initialize snowflake instance with a config
This commit is contained in:
parent
edbbea1d03
commit
2d8a1690ba
11 changed files with 125 additions and 113 deletions
|
@ -24,14 +24,14 @@ class ProxyPair
|
|||
- @relayAddr is the destination relay
|
||||
- @rateLimit specifies a rate limit on traffic
|
||||
###
|
||||
constructor: (@relayAddr, @rateLimit) ->
|
||||
constructor: (@relayAddr, @rateLimit, @pcConfig) ->
|
||||
@id = Util.genSnowflakeID()
|
||||
@c2rSchedule = []
|
||||
@r2cSchedule = []
|
||||
|
||||
# Prepare a WebRTC PeerConnection and await for an SDP offer.
|
||||
begin: ->
|
||||
@pc = new PeerConnection config, {
|
||||
@pc = new PeerConnection @pcConfig, {
|
||||
optional: [
|
||||
{ DtlsSrtpKeyAgreement: true }
|
||||
{ RtpDataChannels: false }
|
||||
|
@ -126,15 +126,13 @@ class ProxyPair
|
|||
|
||||
# WebRTC --> websocket
|
||||
onClientToRelayMessage: (msg) =>
|
||||
if DEBUG
|
||||
log 'WebRTC --> websocket data: ' + msg.data.byteLength + ' bytes'
|
||||
dbg 'WebRTC --> websocket data: ' + msg.data.byteLength + ' bytes'
|
||||
@c2rSchedule.push msg.data
|
||||
@flush()
|
||||
|
||||
# websocket --> WebRTC
|
||||
onRelayToClientMessage: (event) =>
|
||||
if DEBUG
|
||||
log 'websocket --> WebRTC data: ' + event.data.byteLength + ' bytes'
|
||||
dbg 'websocket --> WebRTC data: ' + event.data.byteLength + ' bytes'
|
||||
@r2cSchedule.push event.data
|
||||
@flush()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue