[tor-commits] [snowflake/master] rename rendezvous to broker

arlo at torproject.org arlo at torproject.org
Wed Jan 20 02:28:44 UTC 2016


commit 62e6704d1f3cbafd843369da6a53d97a2b8eb615
Author: Serene Han <keroserene+git at gmail.com>
Date:   Tue Jan 19 18:07:59 2016 -0800

    rename rendezvous to broker
---
 broker/app.yaml             |   10 +++++++
 broker/config.go            |   16 +++++++++++
 broker/snowflake-broker.go  |   65 +++++++++++++++++++++++++++++++++++++++++++
 rendezvous/app.yaml         |   10 -------
 rendezvous/config.go        |   16 -----------
 rendezvous/snowflake-reg.go |   65 -------------------------------------------
 6 files changed, 91 insertions(+), 91 deletions(-)

diff --git a/broker/README.md b/broker/README.md
new file mode 100644
index 0000000..e69de29
diff --git a/broker/app.yaml b/broker/app.yaml
new file mode 100644
index 0000000..14fcf0a
--- /dev/null
+++ b/broker/app.yaml
@@ -0,0 +1,10 @@
+# override this with appcfg.py -A $YOUR_APP_ID
+application: snowflake-reg
+version: 1
+runtime: go
+api_version: go1
+
+handlers:
+- url: /.*
+  script: _go_app
+  secure: always
diff --git a/broker/config.go b/broker/config.go
new file mode 100644
index 0000000..55d1e69
--- /dev/null
+++ b/broker/config.go
@@ -0,0 +1,16 @@
+/*
+This is the server-side code that runs on Google App Engine for the
+"appspot" registration method.
+
+See doc/appspot-howto.txt for more details about setting up an
+application, and advice on running one.
+
+To upload a new version:
+$ torify ~/go_appengine/appcfg.py --no_cookies -A $YOUR_APP_ID update .
+*/
+package snowflake_broker
+
+// host:port/basepath of the facilitator you want to register with
+// for example, fp-facilitator.org or example.com:12345/facilitator
+// https:// and /reg/ will be prepended and appended respectively.
+const SNOWFLAKE_FACILITATOR = ""
diff --git a/broker/snowflake-broker.go b/broker/snowflake-broker.go
new file mode 100644
index 0000000..784f2da
--- /dev/null
+++ b/broker/snowflake-broker.go
@@ -0,0 +1,65 @@
+package snowflake_broker
+
+import (
+	// "io"
+	"io/ioutil"
+	"log"
+	"net"
+	"net/http"
+	"path"
+
+	// "appengine"
+	// "appengine/urlfetch"
+)
+
+// This is an intermediate step - a basic hardcoded appengine rendezvous
+// to a single browser snowflake.
+
+var snowflakeProxy = ""
+
+func robotsTxtHandler(w http.ResponseWriter, r *http.Request) {
+	w.Header().Set("Content-Type", "text/plain; charset=utf-8")
+	w.Write([]byte("User-agent: *\nDisallow:\n"))
+}
+
+func ipHandler(w http.ResponseWriter, r *http.Request) {
+	remoteAddr := r.RemoteAddr
+	if net.ParseIP(remoteAddr).To4() == nil {
+		remoteAddr = "[" + remoteAddr + "]"
+	}
+	w.Header().Set("Content-Type", "text/plain; charset=utf-8")
+	w.Write([]byte(remoteAddr))
+}
+
+/*
+Expects a WebRTC SDP offer in the Request to give to an assigned
+snowflake proxy, which responds with the SDP answer to be sent in
+the HTTP response back to the client.
+*/
+func regHandler(w http.ResponseWriter, r *http.Request) {
+	// TODO: Maybe don't pass anything on path, since it will always be bidirectional
+	dir, _ := path.Split(path.Clean(r.URL.Path))
+	if dir != "/reg/" {
+		http.NotFound(w, r)
+		return
+	}
+	body, err := ioutil.ReadAll(r.Body)
+	if nil != err {
+		return
+		log.Println("Invalid data.")
+	}
+
+	// TODO: Get browser snowflake to talkto this appengine instance
+	// so it can reply with an answer, and not just the offer again :)
+	// TODO: Real facilitator which matches clients and snowflake proxies.
+	w.Write(body)
+}
+
+func init() {
+	http.HandleFunc("/robots.txt", robotsTxtHandler)
+	http.HandleFunc("/ip", ipHandler)
+	http.HandleFunc("/reg/", regHandler)
+	// if SNOWFLAKE_FACILITATOR == "" {
+	// panic("SNOWFLAKE_FACILITATOR empty; did you forget to edit config.go?")
+	// }
+}
diff --git a/rendezvous/README.md b/rendezvous/README.md
deleted file mode 100644
index e69de29..0000000
diff --git a/rendezvous/app.yaml b/rendezvous/app.yaml
deleted file mode 100644
index 14fcf0a..0000000
--- a/rendezvous/app.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
-# override this with appcfg.py -A $YOUR_APP_ID
-application: snowflake-reg
-version: 1
-runtime: go
-api_version: go1
-
-handlers:
-- url: /.*
-  script: _go_app
-  secure: always
diff --git a/rendezvous/config.go b/rendezvous/config.go
deleted file mode 100644
index eabbe65..0000000
--- a/rendezvous/config.go
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
-This is the server-side code that runs on Google App Engine for the
-"appspot" registration method.
-
-See doc/appspot-howto.txt for more details about setting up an
-application, and advice on running one.
-
-To upload a new version:
-$ torify ~/go_appengine/appcfg.py --no_cookies -A $YOUR_APP_ID update .
-*/
-package snowflake_reg
-
-// host:port/basepath of the facilitator you want to register with
-// for example, fp-facilitator.org or example.com:12345/facilitator
-// https:// and /reg/ will be prepended and appended respectively.
-const SNOWFLAKE_FACILITATOR = ""
diff --git a/rendezvous/snowflake-reg.go b/rendezvous/snowflake-reg.go
deleted file mode 100644
index 094612d..0000000
--- a/rendezvous/snowflake-reg.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package snowflake_reg
-
-import (
-	// "io"
-	"io/ioutil"
-	"log"
-	"net"
-	"net/http"
-	"path"
-
-	// "appengine"
-	// "appengine/urlfetch"
-)
-
-// This is an intermediate step - a basic hardcoded appengine rendezvous
-// to a single browser snowflake.
-
-var snowflakeProxy = ""
-
-func robotsTxtHandler(w http.ResponseWriter, r *http.Request) {
-	w.Header().Set("Content-Type", "text/plain; charset=utf-8")
-	w.Write([]byte("User-agent: *\nDisallow:\n"))
-}
-
-func ipHandler(w http.ResponseWriter, r *http.Request) {
-	remoteAddr := r.RemoteAddr
-	if net.ParseIP(remoteAddr).To4() == nil {
-		remoteAddr = "[" + remoteAddr + "]"
-	}
-	w.Header().Set("Content-Type", "text/plain; charset=utf-8")
-	w.Write([]byte(remoteAddr))
-}
-
-/*
-Expects a WebRTC SDP offer in the Request to give to an assigned
-snowflake proxy, which responds with the SDP answer to be sent in
-the HTTP response back to the client.
-*/
-func regHandler(w http.ResponseWriter, r *http.Request) {
-	// TODO: Maybe don't pass anything on path, since it will always be bidirectional
-	dir, _ := path.Split(path.Clean(r.URL.Path))
-	if dir != "/reg/" {
-		http.NotFound(w, r)
-		return
-	}
-	body, err := ioutil.ReadAll(r.Body)
-	if nil != err {
-		return
-		log.Println("Invalid data.")
-	}
-
-	// TODO: Get browser snowflake to talkto this appengine instance
-	// so it can reply with an answer, and not just the offer again :)
-	// TODO: Real facilitator which matches clients and snowflake proxies.
-	w.Write(body)
-}
-
-func init() {
-	http.HandleFunc("/robots.txt", robotsTxtHandler)
-	http.HandleFunc("/ip", ipHandler)
-	http.HandleFunc("/reg/", regHandler)
-	// if SNOWFLAKE_FACILITATOR == "" {
-	// panic("SNOWFLAKE_FACILITATOR empty; did you forget to edit config.go?")
-	// }
-}



More information about the tor-commits mailing list