diff options
author | Cecylia Bocovich <cohosh@torproject.org> | 2023-05-30 15:30:07 -0400 |
---|---|---|
committer | Shelikhoo <xiaokangwang@outlook.com> | 2023-08-24 16:33:22 +0100 |
commit | b632c7d49cd7634eb9b58f96fb81f8f289568e9f (patch) | |
tree | 5cb8e84fbcf6c4425bcbe6a321060e0f378daca8 /client | |
parent | 0cb2975fd84bef997800f46079006bef9792be7c (diff) | |
download | snowflake-b632c7d49cd7634eb9b58f96fb81f8f289568e9f.tar.gz snowflake-b632c7d49cd7634eb9b58f96fb81f8f289568e9f.zip |
Workaround for shadow in lieu of AF_NETLINK support
For details, see https://github.com/shadow/shadow/issues/2980
Diffstat (limited to 'client')
-rw-r--r-- | client/lib/webrtc.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/client/lib/webrtc.go b/client/lib/webrtc.go index 7d986d3..fedf299 100644 --- a/client/lib/webrtc.go +++ b/client/lib/webrtc.go @@ -12,6 +12,7 @@ import ( "time" "github.com/pion/ice/v2" + "github.com/pion/transport/v2/stdnet" "github.com/pion/webrtc/v3" "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 s := webrtc.SettingEngine{} 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)) c.pc, err = api.NewPeerConnection(*config) if err != nil { |