mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
client,proxy: add a media channel
This commit is contained in:
parent
70974640ab
commit
0a7291e90f
3 changed files with 70 additions and 0 deletions
|
@ -1,7 +1,9 @@
|
|||
package snowflake_client
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"log"
|
||||
"math/big"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -69,3 +71,12 @@ func (b *bytesSyncLogger) addOutbound(amount int64) {
|
|||
func (b *bytesSyncLogger) addInbound(amount int64) {
|
||||
b.inboundChan <- amount
|
||||
}
|
||||
|
||||
func randomInt(min, max int) int {
|
||||
nBig, err := rand.Int(rand.Reader, big.NewInt(int64(max-min)))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return int(nBig.Int64()) + min
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue