mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Classify proxies with unknown NATs as restricted
This commit is contained in:
parent
1b29ad7de1
commit
bae0bacbfd
2 changed files with 15 additions and 14 deletions
|
@ -144,10 +144,10 @@ func (ctx *BrokerContext) Broker() {
|
|||
ctx.snowflakeLock.Lock()
|
||||
defer ctx.snowflakeLock.Unlock()
|
||||
if snowflake.index != -1 {
|
||||
if request.natType == NATRestricted {
|
||||
heap.Remove(ctx.restrictedSnowflakes, snowflake.index)
|
||||
} else {
|
||||
if request.natType == NATUnrestricted {
|
||||
heap.Remove(ctx.snowflakes, snowflake.index)
|
||||
} else {
|
||||
heap.Remove(ctx.restrictedSnowflakes, snowflake.index)
|
||||
}
|
||||
delete(ctx.idToSnowflake, snowflake.id)
|
||||
close(request.offerChannel)
|
||||
|
@ -169,10 +169,10 @@ func (ctx *BrokerContext) AddSnowflake(id string, proxyType string, natType stri
|
|||
snowflake.offerChannel = make(chan *ClientOffer)
|
||||
snowflake.answerChannel = make(chan []byte)
|
||||
ctx.snowflakeLock.Lock()
|
||||
if natType == NATRestricted {
|
||||
heap.Push(ctx.restrictedSnowflakes, snowflake)
|
||||
} else {
|
||||
if natType == NATUnrestricted {
|
||||
heap.Push(ctx.snowflakes, snowflake)
|
||||
} else {
|
||||
heap.Push(ctx.restrictedSnowflakes, snowflake)
|
||||
}
|
||||
ctx.snowflakeLock.Unlock()
|
||||
ctx.idToSnowflake[id] = snowflake
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue