mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Proxy: add outbound-address config
This commit is contained in:
parent
36d5d2dd83
commit
fb35e80b0a
3 changed files with 16 additions and 1 deletions
|
@ -114,6 +114,8 @@ type SnowflakeProxy struct {
|
|||
KeepLocalAddresses bool
|
||||
// RelayURL is the URL of the Snowflake server that all traffic will be relayed to
|
||||
RelayURL string
|
||||
// OutboundAddress specify an IP address to use as SDP host candidate
|
||||
OutboundAddress string
|
||||
// Ephemeral*Port limits the pool of ports that ICE UDP connections can allocate from
|
||||
EphemeralMinPort uint16
|
||||
EphemeralMaxPort uint16
|
||||
|
@ -360,6 +362,11 @@ func (sf *SnowflakeProxy) makeWebRTCAPI() *webrtc.API {
|
|||
}
|
||||
}
|
||||
|
||||
if sf.OutboundAddress != "" {
|
||||
// replace SDP host candidates with the given IP without validation
|
||||
// still have server reflexive candidates to fall back on
|
||||
settingsEngine.SetNAT1To1IPs([]string{sf.OutboundAddress}, webrtc.ICECandidateTypeHost)
|
||||
}
|
||||
settingsEngine.SetICEMulticastDNSMode(ice.MulticastDNSModeDisabled)
|
||||
|
||||
return webrtc.NewAPI(webrtc.WithSettingEngine(settingsEngine))
|
||||
|
@ -672,8 +679,8 @@ func (sf *SnowflakeProxy) checkNATType(config webrtc.Configuration, probeURL str
|
|||
}
|
||||
|
||||
offer := pc.LocalDescription()
|
||||
log.Printf("Offer: \n\t%s", strings.ReplaceAll(offer.SDP, "\n", "\n\t"))
|
||||
sdp, err := util.SerializeSessionDescription(offer)
|
||||
log.Printf("Offer: %s", sdp)
|
||||
if err != nil {
|
||||
log.Printf("Error encoding probe message: %s", err.Error())
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue