mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Use SetNet setting in probetest to ignore net.Interfaces error
Needed to get probetest running in shadow. Applies the fix from https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40278 to the probetest server.
This commit is contained in:
parent
3939554058
commit
fe2f7de9a8
1 changed files with 10 additions and 1 deletions
|
@ -24,6 +24,7 @@ import (
|
||||||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/safelog"
|
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/safelog"
|
||||||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/util"
|
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/util"
|
||||||
|
|
||||||
|
"github.com/pion/transport/v2/stdnet"
|
||||||
"github.com/pion/webrtc/v3"
|
"github.com/pion/webrtc/v3"
|
||||||
"golang.org/x/crypto/acme/autocert"
|
"golang.org/x/crypto/acme/autocert"
|
||||||
)
|
)
|
||||||
|
@ -39,6 +40,14 @@ const (
|
||||||
func makePeerConnectionFromOffer(sdp *webrtc.SessionDescription,
|
func makePeerConnectionFromOffer(sdp *webrtc.SessionDescription,
|
||||||
dataChan chan struct{}) (*webrtc.PeerConnection, error) {
|
dataChan chan struct{}) (*webrtc.PeerConnection, error) {
|
||||||
|
|
||||||
|
settingsEngine := webrtc.SettingEngine{}
|
||||||
|
// Use the SetNet setting https://pkg.go.dev/github.com/pion/webrtc/v3#SettingEngine.SetNet
|
||||||
|
// to functionally revert a new change in pion by silently ignoring
|
||||||
|
// when net.Interfaces() fails, rather than throwing an error
|
||||||
|
vnet, _ := stdnet.NewNet()
|
||||||
|
settingsEngine.SetNet(vnet)
|
||||||
|
api := webrtc.NewAPI(webrtc.WithSettingEngine(settingsEngine))
|
||||||
|
|
||||||
config := webrtc.Configuration{
|
config := webrtc.Configuration{
|
||||||
ICEServers: []webrtc.ICEServer{
|
ICEServers: []webrtc.ICEServer{
|
||||||
{
|
{
|
||||||
|
@ -46,7 +55,7 @@ func makePeerConnectionFromOffer(sdp *webrtc.SessionDescription,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
pc, err := webrtc.NewPeerConnection(config)
|
pc, err := api.NewPeerConnection(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("accept: NewPeerConnection: %s", err)
|
return nil, fmt.Errorf("accept: NewPeerConnection: %s", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue