diff --git a/.gitignore b/.gitignore index 6c2eb4e..514221e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ ignore/ datadir/ snowflake -webrtc-client.log +snowflake.log diff --git a/README.md b/README.md index 1006d70..f15a1b8 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,12 @@ A Pluggable Transport using WebRTC Open up four terminals: 1. tor -f torrc SOCKSPort auto -2. tail -F webrtc-client.log +2. tail -F snowflake.log 3. cat > signal 4. open proxy/snowflake.html -Look for the offer in terminal 2; copy and paste it into the browswer window -opened from terminal 4. Copy and paste the answer from terminal 4 to terminal 3. +Look for the offer in terminal 2; copy and paste it into the browser window +opened from terminal 4. Copy and paste the browser to terminal 3. At this point you should see some TLS garbage in the chat window. ### More diff --git a/proxy/snowflake.js b/proxy/snowflake.js index ae8cddc..6d66673 100644 --- a/proxy/snowflake.js +++ b/proxy/snowflake.js @@ -19,7 +19,9 @@ window.RTCIceCandidate = window.RTCIceCandidate || window.mozRTCIceCandidate; window.RTCSessionDescription = window.RTCSessionDescription || window.mozRTCSessionDescription; var pc; // PeerConnection -var answer; +var offer, answer; +var channel; + // Janky state machine var MODE = { INIT: 0, @@ -65,7 +67,6 @@ function welcome() { } function start(initiator) { - username + ": " + msg; log("Starting up RTCPeerConnection..."); pc = new PeerConnection(config, { optional: [ @@ -211,6 +212,12 @@ function prepareDataChannel(channel) { } } +function startChat() { + currentMode = MODE.CHAT; + $chatlog.className = "active"; + log("------- chat enabled! -------"); +} + // Get DOM elements and setup interactions. function init() { console.log("loaded"); diff --git a/webrtc-client.go b/snowflake.go similarity index 98% rename from webrtc-client.go rename to snowflake.go index ab17e90..56787bd 100644 --- a/webrtc-client.go +++ b/snowflake.go @@ -254,7 +254,7 @@ func readSignalingMessages(f *os.File) { func main() { var err error - logFile, err = os.OpenFile("webrtc-client.log", os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600) + logFile, err = os.OpenFile("snowflake.log", os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600) if err != nil { log.Fatal(err) } @@ -292,7 +292,7 @@ func main() { listeners := make([]net.Listener, 0) for _, methodName := range ptInfo.MethodNames { switch methodName { - case "webrtc": + case "snowflake": ln, err := pt.ListenSocks("tcp", "127.0.0.1:0") if err != nil { pt.CmethodError(methodName, err.Error()) diff --git a/torrc b/torrc index 8f081a1..79717ef 100644 --- a/torrc +++ b/torrc @@ -1,5 +1,5 @@ UseBridges 1 DataDirectory datadir -ClientTransportPlugin webrtc exec ./snowflake -Bridge webrtc 0.0.3.0:1 +ClientTransportPlugin snowflake exec ./snowflake +Bridge snowflake 0.0.3.0:1