diff options
author | Cecylia Bocovich <cohosh@torproject.org> | 2024-01-06 13:51:57 -0500 |
---|---|---|
committer | Cecylia Bocovich <cohosh@torproject.org> | 2024-01-10 11:06:39 -0500 |
commit | fe2f7de9a875f4b0c3065d6df3587fd9aa3f59f0 (patch) | |
tree | e2b60de8a5ad0639cbdcd35da9fd657dedaa0d5e | |
parent | 3939554058bf84c103cc102e576adc63a67cc27c (diff) | |
download | snowflake-fe2f7de9a875f4b0c3065d6df3587fd9aa3f59f0.tar.gz snowflake-fe2f7de9a875f4b0c3065d6df3587fd9aa3f59f0.zip |
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.
-rw-r--r-- | probetest/probetest.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/probetest/probetest.go b/probetest/probetest.go index 5efce2d..4f7cce5 100644 --- a/probetest/probetest.go +++ b/probetest/probetest.go @@ -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/util" + "github.com/pion/transport/v2/stdnet" "github.com/pion/webrtc/v3" "golang.org/x/crypto/acme/autocert" ) @@ -39,6 +40,14 @@ const ( func makePeerConnectionFromOffer(sdp *webrtc.SessionDescription, 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{ 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 { return nil, fmt.Errorf("accept: NewPeerConnection: %s", err) } |