mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
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:
parent
83c01565ef
commit
1b29ad7de1
4 changed files with 11 additions and 10 deletions
|
@ -5,7 +5,8 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/pion/sdp/v2"
|
"github.com/pion/ice/v2"
|
||||||
|
"github.com/pion/sdp/v3"
|
||||||
"github.com/pion/webrtc/v3"
|
"github.com/pion/webrtc/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -77,9 +78,9 @@ func StripLocalAddresses(str string) string {
|
||||||
attrs := make([]sdp.Attribute, 0)
|
attrs := make([]sdp.Attribute, 0)
|
||||||
for _, a := range m.Attributes {
|
for _, a := range m.Attributes {
|
||||||
if a.IsICECandidate() {
|
if a.IsICECandidate() {
|
||||||
ice, err := a.ToICECandidate()
|
c, err := ice.UnmarshalCandidate(a.Value)
|
||||||
if err == nil && ice.Typ == "host" {
|
if err == nil && c.Type() == ice.CandidateTypeHost {
|
||||||
ip := net.ParseIP(ice.Address)
|
ip := net.ParseIP(c.Address())
|
||||||
if ip != nil && (IsLocal(ip) || ip.IsUnspecified() || ip.IsLoopback()) {
|
if ip != nil && (IsLocal(ip) || ip.IsUnspecified() || ip.IsLoopback()) {
|
||||||
/* no append in this case */
|
/* no append in this case */
|
||||||
continue
|
continue
|
||||||
|
|
3
go.mod
3
go.mod
|
@ -5,7 +5,8 @@ go 1.13
|
||||||
require (
|
require (
|
||||||
git.torproject.org/pluggable-transports/goptlib.git v1.1.0
|
git.torproject.org/pluggable-transports/goptlib.git v1.1.0
|
||||||
github.com/gorilla/websocket v1.4.1
|
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/stun v0.3.5
|
||||||
github.com/pion/webrtc/v3 v3.0.0
|
github.com/pion/webrtc/v3 v3.0.0
|
||||||
github.com/smartystreets/goconvey v1.6.4
|
github.com/smartystreets/goconvey v1.6.4
|
||||||
|
|
2
go.sum
2
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.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 h1:UCnj7MsobLKLuP/Hh+JMiI/6W5Bs/VF45lWKgHFjSIE=
|
||||||
github.com/pion/sctp v1.7.11/go.mod h1:EhpTUQu1/lcK3xI+eriS6/96fWetHGCvBi9MSsnaBN0=
|
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 h1:gJK9hk+JFD2NGIM1nXmqNCq1DkVaIZ9dlA3u3otnkaw=
|
||||||
github.com/pion/sdp/v3 v3.0.3/go.mod h1:bNiSknmJE0HYBprTHXKPQ3+JjacTv5uap92ueJZKsRk=
|
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=
|
github.com/pion/srtp/v2 v2.0.0-rc.3 h1:1fPiK1nJlNyh235tSGgBnXrPc99wK1/D707f6ntb3qY=
|
||||||
|
|
|
@ -23,7 +23,8 @@ import (
|
||||||
"git.torproject.org/pluggable-transports/snowflake.git/common/util"
|
"git.torproject.org/pluggable-transports/snowflake.git/common/util"
|
||||||
"git.torproject.org/pluggable-transports/snowflake.git/common/websocketconn"
|
"git.torproject.org/pluggable-transports/snowflake.git/common/websocketconn"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"github.com/pion/sdp/v2"
|
"github.com/pion/ice/v2"
|
||||||
|
"github.com/pion/sdp/v3"
|
||||||
"github.com/pion/webrtc/v3"
|
"github.com/pion/webrtc/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -83,9 +84,9 @@ func remoteIPFromSDP(str string) net.IP {
|
||||||
for _, m := range desc.MediaDescriptions {
|
for _, m := range desc.MediaDescriptions {
|
||||||
for _, a := range m.Attributes {
|
for _, a := range m.Attributes {
|
||||||
if a.IsICECandidate() {
|
if a.IsICECandidate() {
|
||||||
ice, err := a.ToICECandidate()
|
c, err := ice.UnmarshalCandidate(a.Value)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
ip := net.ParseIP(ice.Address)
|
ip := net.ParseIP(c.Address())
|
||||||
if ip != nil && isRemoteAddress(ip) {
|
if ip != nil && isRemoteAddress(ip) {
|
||||||
return ip
|
return ip
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue