Do simple HTTP POST signaling in the client.

This is just enough to be compatible with the HTTP signaling in the
server, and doesn't do domain fronting or anything like that. It's just
an interim replacement for the copy-paste FIFO signaling while we
continue to develop the other pieces that'll be dropped in the middle.
This commit is contained in:
David Fifield 2016-01-18 22:53:22 -08:00
parent c9eeff6fc2
commit e0b36d2f33
2 changed files with 38 additions and 9 deletions

View file

@ -82,3 +82,19 @@ func (m *MeekChannel) Negotiate(offer *webrtc.SessionDescription) (
answer := webrtc.DeserializeSessionDescription(string(body))
return answer, nil
}
// Simple interim non-fronting HTTP POST negotiation, to be removed when more
// general fronting is present.
func sendOfferHTTP(url string, offer *webrtc.SessionDescription) (*webrtc.SessionDescription, error) {
resp, err := http.Post(url, "", bytes.NewBuffer([]byte(offer.Serialize())))
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
answer := webrtc.DeserializeSessionDescription(string(body))
return answer, nil
}