mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Workaround for shadow in lieu of AF_NETLINK support
For details, see https://github.com/shadow/shadow/issues/2980
This commit is contained in:
parent
0cb2975fd8
commit
b632c7d49c
2 changed files with 8 additions and 1 deletions
|
@ -12,6 +12,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pion/ice/v2"
|
"github.com/pion/ice/v2"
|
||||||
|
"github.com/pion/transport/v2/stdnet"
|
||||||
"github.com/pion/webrtc/v3"
|
"github.com/pion/webrtc/v3"
|
||||||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/event"
|
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/event"
|
||||||
)
|
)
|
||||||
|
@ -194,6 +195,12 @@ func (c *WebRTCPeer) preparePeerConnection(config *webrtc.Configuration) error {
|
||||||
var err error
|
var err error
|
||||||
s := webrtc.SettingEngine{}
|
s := webrtc.SettingEngine{}
|
||||||
s.SetICEMulticastDNSMode(ice.MulticastDNSModeDisabled)
|
s.SetICEMulticastDNSMode(ice.MulticastDNSModeDisabled)
|
||||||
|
// Use the SetNet setting https://pkg.go.dev/github.com/pion/webrtc/v3#SettingEngine.SetNet
|
||||||
|
// to get snowflake working in shadow (where the AF_NETLINK family is not implemented).
|
||||||
|
// These two lines of code functionally revert a new change in pion by silently ignoring
|
||||||
|
// when net.Interfaces() fails, rather than throwing an error
|
||||||
|
vnet, _ := stdnet.NewNet()
|
||||||
|
s.SetNet(vnet)
|
||||||
api := webrtc.NewAPI(webrtc.WithSettingEngine(s))
|
api := webrtc.NewAPI(webrtc.WithSettingEngine(s))
|
||||||
c.pc, err = api.NewPeerConnection(*config)
|
c.pc, err = api.NewPeerConnection(*config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -8,6 +8,7 @@ require (
|
||||||
github.com/pion/ice/v2 v2.3.8
|
github.com/pion/ice/v2 v2.3.8
|
||||||
github.com/pion/sdp/v3 v3.0.6
|
github.com/pion/sdp/v3 v3.0.6
|
||||||
github.com/pion/stun v0.6.1
|
github.com/pion/stun v0.6.1
|
||||||
|
github.com/pion/transport/v2 v2.2.1
|
||||||
github.com/pion/webrtc/v3 v3.2.11
|
github.com/pion/webrtc/v3 v3.2.11
|
||||||
github.com/prometheus/client_golang v1.16.0
|
github.com/prometheus/client_golang v1.16.0
|
||||||
github.com/prometheus/client_model v0.4.0
|
github.com/prometheus/client_model v0.4.0
|
||||||
|
@ -49,7 +50,6 @@ require (
|
||||||
github.com/pion/rtp v1.7.13 // indirect
|
github.com/pion/rtp v1.7.13 // indirect
|
||||||
github.com/pion/sctp v1.8.7 // indirect
|
github.com/pion/sctp v1.8.7 // indirect
|
||||||
github.com/pion/srtp/v2 v2.0.15 // indirect
|
github.com/pion/srtp/v2 v2.0.15 // indirect
|
||||||
github.com/pion/transport/v2 v2.2.1 // indirect
|
|
||||||
github.com/pion/turn/v2 v2.1.2 // indirect
|
github.com/pion/turn/v2 v2.1.2 // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue