Commit e4e06864 authored by Serene Han's avatar Serene Han Committed by Arlo Breault
Browse files

begin appengine rendezvous component - domain fronting works,

although it just reflects the offer.
next step is to retrieve browser proxy answer (#1)
parent ff5d23b0
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ package main
import (
	"bytes"
	"io/ioutil"
	"log"
	"net/http"
	"net/url"

@@ -31,8 +32,9 @@ func NewRequestInfo(meekUrl string, front string) *RequestInfo {
		return nil
	}
	info.URL = requestUrl
	info.Host = info.URL.Host
	info.URL.Host = front
	info.Host = front
	// info.URL.Host = front
	// info.Host = info.URL.Host
	return info
}

@@ -57,13 +59,13 @@ func NewMeekChannel(info *RequestInfo) *MeekChannel {

// Do an HTTP roundtrip using the payload data in buf.
func (m *MeekChannel) roundTripHTTP(buf []byte) (*http.Response, error) {
	req, err := http.NewRequest("POST", m.info.URL.String(), bytes.NewReader(buf))
	// Compose an innocent looking request.
	req, err := http.NewRequest("POST", m.info.Host+"/reg/123", bytes.NewReader(buf))
	if nil != err {
		return nil, err
	}
	if "" != m.info.Host {
		req.Host = m.info.Host
	}
	// Set actually desired target host.
	req.Host = m.info.URL.String()
	// req.Header.Set("X-Session-Id", m.info.SessionID)
	return m.transport.RoundTrip(req)
}
@@ -78,7 +80,12 @@ func (m *MeekChannel) Negotiate(offer *webrtc.SessionDescription) (
		return nil, err
	}
	defer resp.Body.Close()
	log.Println("MeekChannel Response: ", resp)
	body, err := ioutil.ReadAll(resp.Body)
	if nil != err {
		return nil, err
	}
	log.Println("MeekChannel Body: ", string(body))
	answer := webrtc.DeserializeSessionDescription(string(body))
	return answer, nil
}
+9 −4
Original line number Diff line number Diff line
@@ -25,8 +25,9 @@ import (
// Hard-coded meek signalling channel for now.
// TODO: expose as param
const (
	MEEK_URL     = "not implemented yet"
	FRONT_DOMAIN = "www.google.com"
	MEEK_URL     = "snowflake-reg.appspot.com"
	FRONT_DOMAIN = "https://www.google.com"
	// FRONT_DOMAIN = "https://www.google.com"
)

var ptInfo pt.ClientInfo
@@ -187,7 +188,11 @@ func dialWebRTC(config *webrtc.Configuration, meek *MeekChannel) (
			// if nil == answer {
			// 	log.Printf("No answer received from meek channel.")
			// } else {
			// 	signalChan <- answer
			// 	// TODO: Once this is correct, uncomment and remove copy-paste
			// 	// signalling.
			// 	log.Println("Recieved answer from Meek channel: \n",
			// 		answer.Serialize())
			// 	// signalChan <- answer
			// }
			if offerURL != "" {
				answer, err := sendOfferHTTP(offerURL, offer)
@@ -207,7 +212,7 @@ func dialWebRTC(config *webrtc.Configuration, meek *MeekChannel) (
		pc.Close()
		return nil, fmt.Errorf("no answer received")
	}
	log.Printf("got answer %s", answer.Serialize())
	log.Printf("Received Answer: %s", answer.Serialize())
	err = pc.SetRemoteDescription(answer)
	if err != nil {
		pc.Close()

rendezvous/README.md

0 → 100644
+0 −0

Empty file added.

rendezvous/app.yaml

0 → 100644
+10 −0
Original line number Diff line number Diff line
# 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

rendezvous/config.go

0 → 100644
+16 −0
Original line number Diff line number Diff line
/*
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 = ""
Loading