mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Make capacity a uint.
This prohibits some nonsense like "./proxy-go -capacity -550", which otherwise results in a panic like: INFO: configuration.go:174: Created Configuration at &{[{[stun:stun.l.google.com:19302] }] All Balanced } panic: makechan: size out of range
This commit is contained in:
parent
dbe1ef4fa5
commit
461dbeba80
1 changed files with 3 additions and 3 deletions
|
@ -26,7 +26,7 @@ const defaultRelayURL = "wss://snowflake.bamsoftware.com/"
|
||||||
const defaultSTUNURL = "stun:stun.l.google.com:19302"
|
const defaultSTUNURL = "stun:stun.l.google.com:19302"
|
||||||
|
|
||||||
type snowflakeOptions struct {
|
type snowflakeOptions struct {
|
||||||
capacity int
|
capacity uint
|
||||||
broker string
|
broker string
|
||||||
brokerURL *url.URL
|
brokerURL *url.URL
|
||||||
stun string
|
stun string
|
||||||
|
@ -296,7 +296,7 @@ func runSession(sid string) {
|
||||||
func main() {
|
func main() {
|
||||||
var logFilename string
|
var logFilename string
|
||||||
opt = new(snowflakeOptions)
|
opt = new(snowflakeOptions)
|
||||||
flag.IntVar(&opt.capacity, "capacity", 10, "maximum concurrent clients")
|
flag.UintVar(&opt.capacity, "capacity", 10, "maximum concurrent clients")
|
||||||
flag.StringVar(&opt.broker, "broker", defaultBrokerURL, "broker URL")
|
flag.StringVar(&opt.broker, "broker", defaultBrokerURL, "broker URL")
|
||||||
flag.StringVar(&opt.relay, "relay", defaultRelayURL, "websocket relay URL")
|
flag.StringVar(&opt.relay, "relay", defaultRelayURL, "websocket relay URL")
|
||||||
flag.StringVar(&opt.stun, "stun", defaultSTUNURL, "stun URL")
|
flag.StringVar(&opt.stun, "stun", defaultSTUNURL, "stun URL")
|
||||||
|
@ -329,7 +329,7 @@ func main() {
|
||||||
|
|
||||||
config = webrtc.NewConfiguration(webrtc.OptionIceServer(opt.stun))
|
config = webrtc.NewConfiguration(webrtc.OptionIceServer(opt.stun))
|
||||||
tokens = make(chan bool, opt.capacity)
|
tokens = make(chan bool, opt.capacity)
|
||||||
for i := 0; i < opt.capacity; i++ {
|
for i := uint(0); i < opt.capacity; i++ {
|
||||||
tokens <- true
|
tokens <- true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue