[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [snowflake/main] Add NAT Type test periodic task
commit a6a53ff8ceb3ac48ac1fc1165255df8ebc9c685b
Author: Shelikhoo <xiaokangwang@xxxxxxxxxxx>
Date: Thu Nov 4 20:34:32 2021 +0000
Add NAT Type test periodic task
---
proxy/lib/snowflake.go | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/proxy/lib/snowflake.go b/proxy/lib/snowflake.go
index f979ed0..b133c67 100644
--- a/proxy/lib/snowflake.go
+++ b/proxy/lib/snowflake.go
@@ -41,6 +41,7 @@ import (
"time"
"git.torproject.org/pluggable-transports/snowflake.git/v2/common/messages"
+ "git.torproject.org/pluggable-transports/snowflake.git/v2/common/task"
"git.torproject.org/pluggable-transports/snowflake.git/v2/common/util"
"git.torproject.org/pluggable-transports/snowflake.git/v2/common/websocketconn"
"github.com/gorilla/websocket"
@@ -546,6 +547,19 @@ func (sf *SnowflakeProxy) Start() error {
log.Printf("NAT type: %s", currentNATTypeLoaded)
+ NatRetestTask := task.Periodic{
+ Interval: time.Second * time.Duration(sf.NATTypeMeasurementIntervalSecond),
+ Execute: func() error {
+ sf.checkNATType(config, sf.NATProbeURL)
+ return nil
+ },
+ }
+
+ if sf.NATTypeMeasurementIntervalSecond != 0 {
+ NatRetestTask.Start()
+ defer NatRetestTask.Close()
+ }
+
ticker := time.NewTicker(pollInterval)
defer ticker.Stop()
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits