mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
feat: expose pollInterval
in CLI
Closes https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40373
This commit is contained in:
parent
8f429666a8
commit
f4db64612c
4 changed files with 27 additions and 12 deletions
|
@ -17,7 +17,11 @@ import (
|
|||
sf "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/proxy/lib"
|
||||
)
|
||||
|
||||
const minPollInterval = 2 * time.Second
|
||||
|
||||
func main() {
|
||||
pollInterval := flag.Duration("poll-interval", sf.DefaultPollInterval,
|
||||
fmt.Sprint("how often to ask the broker for a new client. Keep in mind that asking for a client will not always result in getting one. Minumum value is ", minPollInterval, ". Valid time units are \"ms\", \"s\", \"m\", \"h\"."))
|
||||
capacity := flag.Uint("capacity", 0, "maximum concurrent clients (default is to accept an unlimited number of clients)")
|
||||
stunURL := flag.String("stun", sf.DefaultSTUNURL, "STUN URL")
|
||||
logFilename := flag.String("log", "", "log filename")
|
||||
|
@ -50,6 +54,10 @@ func main() {
|
|||
os.Exit(0)
|
||||
}
|
||||
|
||||
if *pollInterval < minPollInterval {
|
||||
log.Fatalf("poll-interval must be >= %v", minPollInterval)
|
||||
}
|
||||
|
||||
if *outboundAddress != "" && *keepLocalAddresses {
|
||||
log.Fatal("Cannot keep local address candidates when outbound address is specified")
|
||||
}
|
||||
|
@ -83,6 +91,7 @@ func main() {
|
|||
}
|
||||
|
||||
proxy := sf.SnowflakeProxy{
|
||||
PollInterval: *pollInterval,
|
||||
Capacity: uint(*capacity),
|
||||
STUNURL: *stunURL,
|
||||
BrokerURL: *rawBrokerURL,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue