aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCecylia Bocovich <cohosh@torproject.org>2021-01-25 10:28:17 -0500
committerCecylia Bocovich <cohosh@torproject.org>2021-01-25 10:28:17 -0500
commit1b29ad7de14fb0a6d2bf88aea38353733682cd26 (patch)
treeff128661a087000692c09da0c7398a7d4cc5cb26
parent83c01565ef90a13b0cab390fd59d7d36da76ec1e (diff)
downloadsnowflake-1b29ad7de14fb0a6d2bf88aea38353733682cd26.tar.gz
snowflake-1b29ad7de14fb0a6d2bf88aea38353733682cd26.zip
Bump version of pion/sdp
Update our dependency on pion/sdp from v2 to v3, to match pion/webrtc v3. This requires some changes in how we parse out addresses from ice candidates. This will ease tor browser builds of snowflake since we are now only relying on one version of pion/sdp instead of two different ones.
-rw-r--r--common/util/util.go9
-rw-r--r--go.mod3
-rw-r--r--go.sum2
-rw-r--r--proxy/snowflake.go7
4 files changed, 11 insertions, 10 deletions
diff --git a/common/util/util.go b/common/util/util.go
index 3d2acc3..00f7302 100644
--- a/common/util/util.go
+++ b/common/util/util.go
@@ -5,7 +5,8 @@ import (
"errors"
"net"
- "github.com/pion/sdp/v2"
+ "github.com/pion/ice/v2"
+ "github.com/pion/sdp/v3"
"github.com/pion/webrtc/v3"
)
@@ -77,9 +78,9 @@ func StripLocalAddresses(str string) string {
attrs := make([]sdp.Attribute, 0)
for _, a := range m.Attributes {
if a.IsICECandidate() {
- ice, err := a.ToICECandidate()
- if err == nil && ice.Typ == "host" {
- ip := net.ParseIP(ice.Address)
+ c, err := ice.UnmarshalCandidate(a.Value)
+ if err == nil && c.Type() == ice.CandidateTypeHost {
+ ip := net.ParseIP(c.Address())
if ip != nil && (IsLocal(ip) || ip.IsUnspecified() || ip.IsLoopback()) {
/* no append in this case */
continue
diff --git a/go.mod b/go.mod
index 2931be7..a7f9ad2 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,8 @@ go 1.13
require (
git.torproject.org/pluggable-transports/goptlib.git v1.1.0
github.com/gorilla/websocket v1.4.1
- github.com/pion/sdp/v2 v2.3.4
+ github.com/pion/ice/v2 v2.0.14
+ github.com/pion/sdp/v3 v3.0.3
github.com/pion/stun v0.3.5
github.com/pion/webrtc/v3 v3.0.0
github.com/smartystreets/goconvey v1.6.4
diff --git a/go.sum b/go.sum
index 6214f5c..eac95e1 100644
--- a/go.sum
+++ b/go.sum
@@ -66,8 +66,6 @@ github.com/pion/rtp v1.6.2/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko
github.com/pion/sctp v1.7.10/go.mod h1:EhpTUQu1/lcK3xI+eriS6/96fWetHGCvBi9MSsnaBN0=
github.com/pion/sctp v1.7.11 h1:UCnj7MsobLKLuP/Hh+JMiI/6W5Bs/VF45lWKgHFjSIE=
github.com/pion/sctp v1.7.11/go.mod h1:EhpTUQu1/lcK3xI+eriS6/96fWetHGCvBi9MSsnaBN0=
-github.com/pion/sdp/v2 v2.3.4 h1:+f3F5Xl7ynVhc9Il8Dc7BFroYJWG3PMbfWtwFlVI+kg=
-github.com/pion/sdp/v2 v2.3.4/go.mod h1:jccXVYW0fuK6ds2pwKr89SVBDYlCjhgMI6nucl5R5rA=
github.com/pion/sdp/v3 v3.0.3 h1:gJK9hk+JFD2NGIM1nXmqNCq1DkVaIZ9dlA3u3otnkaw=
github.com/pion/sdp/v3 v3.0.3/go.mod h1:bNiSknmJE0HYBprTHXKPQ3+JjacTv5uap92ueJZKsRk=
github.com/pion/srtp/v2 v2.0.0-rc.3 h1:1fPiK1nJlNyh235tSGgBnXrPc99wK1/D707f6ntb3qY=
diff --git a/proxy/snowflake.go b/proxy/snowflake.go
index 78a053d..1bc21ab 100644
--- a/proxy/snowflake.go
+++ b/proxy/snowflake.go
@@ -23,7 +23,8 @@ import (
"git.torproject.org/pluggable-transports/snowflake.git/common/util"
"git.torproject.org/pluggable-transports/snowflake.git/common/websocketconn"
"github.com/gorilla/websocket"
- "github.com/pion/sdp/v2"
+ "github.com/pion/ice/v2"
+ "github.com/pion/sdp/v3"
"github.com/pion/webrtc/v3"
)
@@ -83,9 +84,9 @@ func remoteIPFromSDP(str string) net.IP {
for _, m := range desc.MediaDescriptions {
for _, a := range m.Attributes {
if a.IsICECandidate() {
- ice, err := a.ToICECandidate()
+ c, err := ice.UnmarshalCandidate(a.Value)
if err == nil {
- ip := net.ParseIP(ice.Address)
+ ip := net.ParseIP(c.Address())
if ip != nil && isRemoteAddress(ip) {
return ip
}