mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 11:11:30 -04:00
Represent NATTypeMeasurementInterval in time.Duration
Adopted the change in according to the recommendation from https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/62#note_2761566
This commit is contained in:
parent
c49f72eb0c
commit
0c62d806a4
2 changed files with 6 additions and 6 deletions
|
@ -112,9 +112,9 @@ type SnowflakeProxy struct {
|
|||
RelayURL string
|
||||
// NATProbeURL is the URL of the probe service we use for NAT checks
|
||||
NATProbeURL string
|
||||
// NATTypeMeasurementIntervalSecond is time in second before NAT type is retested
|
||||
NATTypeMeasurementIntervalSecond uint
|
||||
shutdown chan struct{}
|
||||
// NATTypeMeasurementInterval is time before NAT type is retested
|
||||
NATTypeMeasurementInterval time.Duration
|
||||
shutdown chan struct{}
|
||||
}
|
||||
|
||||
// Checks whether an IP address is a remote address for the client
|
||||
|
@ -550,14 +550,14 @@ func (sf *SnowflakeProxy) Start() error {
|
|||
log.Printf("NAT type: %s", currentNATTypeLoaded)
|
||||
|
||||
NatRetestTask := task.Periodic{
|
||||
Interval: time.Second * time.Duration(sf.NATTypeMeasurementIntervalSecond),
|
||||
Interval: sf.NATTypeMeasurementInterval,
|
||||
Execute: func() error {
|
||||
sf.checkNATType(config, sf.NATProbeURL)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
if sf.NATTypeMeasurementIntervalSecond != 0 {
|
||||
if sf.NATTypeMeasurementInterval != 0 {
|
||||
NatRetestTask.Start()
|
||||
defer NatRetestTask.Close()
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ func main() {
|
|||
KeepLocalAddresses: *keepLocalAddresses,
|
||||
RelayURL: *relayURL,
|
||||
|
||||
NATTypeMeasurementIntervalSecond: uint(NATTypeMeasurementInterval.Seconds()),
|
||||
NATTypeMeasurementInterval: *NATTypeMeasurementInterval,
|
||||
}
|
||||
|
||||
var logOutput io.Writer = os.Stderr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue