Skip to content

Commit 5fca7ea

Browse files
committed
Back to VividCortex/ewma
1 parent 77dc3b1 commit 5fca7ea

14 files changed

Lines changed: 300 additions & 97 deletions

File tree

dnscrypt-proxy/estimators.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,19 @@ package main
33
import (
44
"sync"
55

6-
"github.com/lifenjoiner/ewma"
7-
)
8-
9-
const (
10-
SizeEstimatorEwmaDecay = 100.0
6+
"github.com/VividCortex/ewma"
117
)
128

139
type QuestionSizeEstimator struct {
1410
sync.RWMutex
1511
minQuestionSize int
16-
ewma *ewma.EWMA
12+
ewma ewma.MovingAverage
1713
}
1814

1915
func NewQuestionSizeEstimator() QuestionSizeEstimator {
2016
return QuestionSizeEstimator{
2117
minQuestionSize: InitialMinQuestionSize,
22-
ewma: ewma.NewMovingAverage(SizeEstimatorEwmaDecay),
18+
ewma: &ewma.SimpleEWMA{},
2319
}
2420
}
2521

dnscrypt-proxy/serversInfo.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import (
1515
"sync"
1616
"time"
1717

18+
"github.com/VividCortex/ewma"
1819
"github.com/jedisct1/dlog"
1920
clocksmith "github.com/jedisct1/go-clocksmith"
2021
stamps "github.com/jedisct1/go-dnsstamps"
21-
"github.com/lifenjoiner/ewma"
2222
"github.com/miekg/dns"
2323
"golang.org/x/crypto/ed25519"
2424
)
@@ -46,7 +46,7 @@ type DOHClientCreds struct {
4646
type ServerInfo struct {
4747
DOHClientCreds DOHClientCreds
4848
lastActionTS time.Time
49-
rtt *ewma.EWMA
49+
rtt ewma.MovingAverage
5050
Name string
5151
HostName string
5252
UDPAddr *net.UDPAddr

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.18
44

55
require (
66
github.com/BurntSushi/toml v1.0.0
7+
github.com/VividCortex/ewma v1.2.0
78
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
89
github.com/dchest/safefile v0.0.0-20151022103144-855e8d98f185
910
github.com/hashicorp/go-immutable-radix v1.3.1
@@ -17,7 +18,6 @@ require (
1718
github.com/jedisct1/xsecretbox v0.0.0-20210927135450-ebe41aef7bef
1819
github.com/k-sone/critbitgo v1.4.0
1920
github.com/kardianos/service v1.2.1
20-
github.com/lifenjoiner/ewma v0.0.0-20210320054258-4f227d7eb8a2
2121
github.com/miekg/dns v1.1.48
2222
github.com/powerman/check v1.6.0
2323
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE
5252
github.com/OpenPeeDeeP/depguard v1.0.1 h1:VlW4R6jmBIv3/u1JNlawEvJMM4J+dPORPaZasQee8Us=
5353
github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM=
5454
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
55+
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
56+
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
5557
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
5658
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
5759
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
@@ -421,8 +423,6 @@ github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJ
421423
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
422424
github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
423425
github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
424-
github.com/lifenjoiner/ewma v0.0.0-20210320054258-4f227d7eb8a2 h1:eD3+F7WMC7wryFGBrLSyzoRqK+kR7nCT/9VT2E3XJzc=
425-
github.com/lifenjoiner/ewma v0.0.0-20210320054258-4f227d7eb8a2/go.mod h1:SJvYtJnDKXqTrIvyRocCJmuNuM3bUb4krn9UbZXj+tw=
426426
github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
427427
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
428428
github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=

vendor/github.com/VividCortex/ewma/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/VividCortex/ewma/.whitesource

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/lifenjoiner/ewma/LICENSE renamed to vendor/github.com/VividCortex/ewma/LICENSE

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/VividCortex/ewma/README.md

Lines changed: 145 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/VividCortex/ewma/codecov.yml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/VividCortex/ewma/ewma.go

Lines changed: 126 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)