summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorn8fr8 <nathan@freitas.net>2023-11-30 14:05:18 +0000
committerShelikhoo <xiaokangwang@outlook.com>2023-12-18 12:58:48 +0000
commit36a8eb487fb374e36f0f5bcf85fb50fa8ddfbba2 (patch)
treeaced0fbd41fa848335d15413b695d04ef27a5cab
parentcd0167fe65e88c8b67c4f5c7d29921e56714bcba (diff)
downloadsnowflake-36a8eb487fb374e36f0f5bcf85fb50fa8ddfbba2.tar.gz
snowflake-36a8eb487fb374e36f0f5bcf85fb50fa8ddfbba2.zip
Add Ignore Android Restriction Workaround for Proxy
-rw-r--r--proxy/lib/snowflake.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/proxy/lib/snowflake.go b/proxy/lib/snowflake.go
index b8d8930..0957a29 100644
--- a/proxy/lib/snowflake.go
+++ b/proxy/lib/snowflake.go
@@ -42,6 +42,7 @@ import (
"github.com/gorilla/websocket"
"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"
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/messages"
@@ -374,6 +375,13 @@ func (d dataChannelHandlerWithRelayURL) datachannelHandler(conn *webRTCConn, rem
func (sf *SnowflakeProxy) makeWebRTCAPI() *webrtc.API {
settingsEngine := webrtc.SettingEngine{}
+ // 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()
+ settingsEngine.SetNet(vnet)
+
if sf.EphemeralMinPort != 0 && sf.EphemeralMaxPort != 0 {
err := settingsEngine.SetEphemeralUDPPortRange(sf.EphemeralMinPort, sf.EphemeralMaxPort)
if err != nil {