mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 11:11:30 -04:00
Add Proxy Event Logger
This commit is contained in:
parent
9208364475
commit
1116bc81c8
2 changed files with 59 additions and 0 deletions
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"flag"
|
||||
"git.torproject.org/pluggable-transports/snowflake.git/v2/common/event"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
|
@ -21,9 +22,17 @@ func main() {
|
|||
relayURL := flag.String("relay", sf.DefaultRelayURL, "websocket relay URL")
|
||||
NATTypeMeasurementInterval := flag.Duration("nat-retest-interval", time.Hour*24,
|
||||
"the time interval in second before NAT type is retested, 0s disables retest. Valid time units are \"s\", \"m\", \"h\". ")
|
||||
SummaryInterval := flag.Duration("summary-interval", time.Hour,
|
||||
"the time interval to output summary, 0s disables retest. Valid time units are \"s\", \"m\", \"h\". ")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
periodicEventLogger := sf.NewProxyEventLogger(*SummaryInterval)
|
||||
|
||||
eventLogger := event.NewSnowflakeEventDispatcher()
|
||||
|
||||
eventLogger.AddSnowflakeEventListener(periodicEventLogger)
|
||||
|
||||
proxy := sf.SnowflakeProxy{
|
||||
Capacity: uint(*capacity),
|
||||
STUNURL: *stunURL,
|
||||
|
@ -32,6 +41,7 @@ func main() {
|
|||
RelayURL: *relayURL,
|
||||
|
||||
NATTypeMeasurementInterval: *NATTypeMeasurementInterval,
|
||||
EventDispatcher: eventLogger,
|
||||
}
|
||||
|
||||
var logOutput io.Writer = os.Stderr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue