mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Add Relay Info Forwarding for Snowflake
This commit is contained in:
parent
d5a87c3c02
commit
5d7a3766d6
2 changed files with 26 additions and 1 deletions
|
@ -102,7 +102,13 @@ func (i *IPC) ProxyPolls(arg messages.Arg, response *[]byte) error {
|
|||
}
|
||||
|
||||
i.ctx.metrics.promMetrics.ProxyPollTotal.With(prometheus.Labels{"nat": natType, "status": "matched"}).Inc()
|
||||
b, err = messages.EncodePollResponse(string(offer.sdp), true, offer.natType)
|
||||
var relayURL string
|
||||
if info, err := i.ctx.bridgeList.GetBridgeInfo(offer.fingerprint); err != nil {
|
||||
return err
|
||||
} else {
|
||||
relayURL = info.WebSocketAddress
|
||||
}
|
||||
b, err = messages.EncodePollResponseWithRelayURL(string(offer.sdp), true, offer.natType, relayURL)
|
||||
if err != nil {
|
||||
return messages.ErrInternal
|
||||
}
|
||||
|
@ -141,6 +147,10 @@ func (i *IPC) ClientOffers(arg messages.Arg, response *[]byte) error {
|
|||
}
|
||||
copy(offer.fingerprint[:], fingerprint)
|
||||
|
||||
if _, err := i.ctx.GetBridgeInfo(offer.fingerprint); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Only hand out known restricted snowflakes to unrestricted clients
|
||||
var snowflakeHeap *SnowflakeHeap
|
||||
if offer.natType == NATUnrestricted {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue