mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Add Ignore Android Restriction Workaround for Proxy
This commit is contained in:
parent
cd0167fe65
commit
36a8eb487f
1 changed files with 8 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue