commit cee3dd3448edff1ceac3b263de8b753717f9bf1b Author: David Fifield david@bamsoftware.com Date: Sun May 19 19:33:00 2013 -0700
Move appspot → appengine. --- appengine/app.yaml | 9 +++++++++ appengine/fp.go | 37 +++++++++++++++++++++++++++++++++++++ appspot/app.yaml | 9 --------- appspot/fp.go | 37 ------------------------------------- 4 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/appengine/app.yaml b/appengine/app.yaml new file mode 100644 index 0000000..fa86e75 --- /dev/null +++ b/appengine/app.yaml @@ -0,0 +1,9 @@ +application: flashproxy-reg +version: 1 +runtime: go +api_version: go1 + +handlers: +- url: /(ip|reg/.+) + script: _go_app + secure: always diff --git a/appengine/fp.go b/appengine/fp.go new file mode 100644 index 0000000..93465c3 --- /dev/null +++ b/appengine/fp.go @@ -0,0 +1,37 @@ +package fp + +import ( + "fmt" + "net" + "net/http" + + "appengine" + "appengine/urlfetch" +) + +const BASE = "https://fp-facilitator.org/reg/" + +func ipHandler(w http.ResponseWriter, r *http.Request) { + remoteAddr := r.RemoteAddr + if net.ParseIP(remoteAddr).To4() == nil { + remoteAddr = "[" + remoteAddr + "]" + } + fmt.Fprintf(w, "%s", remoteAddr) +} + +func regHandler(w http.ResponseWriter, r *http.Request) { + c := appengine.NewContext(r) + blob := r.URL.Path[5:] + client := urlfetch.Client(c) + _, err := client.Get(BASE + blob) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + fmt.Fprintf(w, "Thanks.") +} + +func init() { + http.HandleFunc("/ip", ipHandler) + http.HandleFunc("/reg/", regHandler) +} diff --git a/appspot/app.yaml b/appspot/app.yaml deleted file mode 100644 index fa86e75..0000000 --- a/appspot/app.yaml +++ /dev/null @@ -1,9 +0,0 @@ -application: flashproxy-reg -version: 1 -runtime: go -api_version: go1 - -handlers: -- url: /(ip|reg/.+) - script: _go_app - secure: always diff --git a/appspot/fp.go b/appspot/fp.go deleted file mode 100644 index 93465c3..0000000 --- a/appspot/fp.go +++ /dev/null @@ -1,37 +0,0 @@ -package fp - -import ( - "fmt" - "net" - "net/http" - - "appengine" - "appengine/urlfetch" -) - -const BASE = "https://fp-facilitator.org/reg/" - -func ipHandler(w http.ResponseWriter, r *http.Request) { - remoteAddr := r.RemoteAddr - if net.ParseIP(remoteAddr).To4() == nil { - remoteAddr = "[" + remoteAddr + "]" - } - fmt.Fprintf(w, "%s", remoteAddr) -} - -func regHandler(w http.ResponseWriter, r *http.Request) { - c := appengine.NewContext(r) - blob := r.URL.Path[5:] - client := urlfetch.Client(c) - _, err := client.Get(BASE + blob) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - fmt.Fprintf(w, "Thanks.") -} - -func init() { - http.HandleFunc("/ip", ipHandler) - http.HandleFunc("/reg/", regHandler) -}
tor-commits@lists.torproject.org