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.
This commit is contained in:
Cecylia Bocovich 2021-01-25 10:28:17 -05:00
parent 83c01565ef
commit 1b29ad7de1
4 changed files with 11 additions and 10 deletions

View file

@ -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
}