mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
refactor: move media channel handling to common/ and setup duplex channel
a duplex media channel should be more realistic, you generally both send and receive media when doing video call and stuff
This commit is contained in:
parent
ff738ff045
commit
01bde142d4
5 changed files with 187 additions and 102 deletions
|
@ -1,9 +1,7 @@
|
|||
package snowflake_client
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"log"
|
||||
"math/big"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -71,12 +69,3 @@ 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