GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit 1867f895 authored by Arlo Breault's avatar Arlo Breault
Browse files

Remove local LAN address ICE candidates in proxy-go answer

Trac: 19026
parent 670e4ba4
......@@ -72,6 +72,7 @@ func remoteIPFromSDP(sdp string) net.IP {
type Broker struct {
url *url.URL
transport http.RoundTripper
keepLocalAddresses bool
}
type webRTCConn struct {
......@@ -209,7 +210,14 @@ func (b *Broker) pollOffer(sid string) *webrtc.SessionDescription {
func (b *Broker) sendAnswer(sid string, pc *webrtc.PeerConnection) error {
brokerPath := b.url.ResolveReference(&url.URL{Path: "answer"})
answer := string([]byte(util.SerializeSessionDescription(pc.LocalDescription())))
ld := pc.LocalDescription()
if !b.keepLocalAddresses {
ld = &webrtc.SessionDescription{
Type: ld.Type,
SDP: util.StripLocalAddresses(ld.SDP),
}
}
answer := string([]byte(util.SerializeSessionDescription(ld)))
body, err := messages.EncodeAnswerRequest(answer, sid)
if err != nil {
return err
......@@ -409,6 +417,7 @@ func main() {
var logFilename string
var rawBrokerURL string
var unsafeLogging bool
var keepLocalAddresses bool
flag.UintVar(&capacity, "capacity", 10, "maximum concurrent clients")
flag.StringVar(&rawBrokerURL, "broker", defaultBrokerURL, "broker URL")
......@@ -416,6 +425,7 @@ func main() {
flag.StringVar(&stunURL, "stun", defaultSTUNURL, "stun URL")
flag.StringVar(&logFilename, "log", "", "log filename")
flag.BoolVar(&unsafeLogging, "unsafe-logging", false, "prevent logs from being scrubbed")
flag.BoolVar(&keepLocalAddresses, "keep-local-addresses", false, "keep local LAN address ICE candidates")
flag.Parse()
var logOutput io.Writer = os.Stderr
......@@ -439,6 +449,7 @@ func main() {
var err error
broker = new(Broker)
broker.keepLocalAddresses = keepLocalAddresses
broker.url, err = url.Parse(rawBrokerURL)
if err != nil {
log.Fatalf("invalid broker url: %s", err)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment