diff --git a/dnscrypt-proxy/estimators.go b/dnscrypt-proxy/estimators.go index e003e9fe..dd8b996c 100644 --- a/dnscrypt-proxy/estimators.go +++ b/dnscrypt-proxy/estimators.go @@ -3,7 +3,7 @@ package main import ( "sync" - "github.com/lifenjoiner/ewma" + "github.com/jedisct1/ewma" ) const ( @@ -13,7 +13,7 @@ const ( type QuestionSizeEstimator struct { sync.RWMutex minQuestionSize int - ewma *ewma.EWMA + ewma ewma.MovingAverage } func NewQuestionSizeEstimator() QuestionSizeEstimator { diff --git a/dnscrypt-proxy/serversInfo.go b/dnscrypt-proxy/serversInfo.go index fcf35e3a..a7131fc1 100644 --- a/dnscrypt-proxy/serversInfo.go +++ b/dnscrypt-proxy/serversInfo.go @@ -16,9 +16,9 @@ import ( "time" "github.com/jedisct1/dlog" + "github.com/jedisct1/ewma" clocksmith "github.com/jedisct1/go-clocksmith" stamps "github.com/jedisct1/go-dnsstamps" - "github.com/lifenjoiner/ewma" "github.com/miekg/dns" "golang.org/x/crypto/ed25519" ) @@ -46,7 +46,7 @@ type DOHClientCreds struct { type ServerInfo struct { DOHClientCreds DOHClientCreds lastActionTS time.Time - rtt *ewma.EWMA + rtt ewma.MovingAverage Name string HostName string UDPAddr *net.UDPAddr @@ -199,6 +199,7 @@ func (serversInfo *ServersInfo) refreshServer(proxy *Proxy, name string, stamp s dlog.Fatalf("[%s] != [%s]", name, newServer.Name) } newServer.rtt = ewma.NewMovingAverage(RTTEwmaDecay) + newServer.rtt.SetWarmupSamples(1) newServer.rtt.Set(float64(newServer.initialRtt)) isNew = true serversInfo.Lock() diff --git a/go.mod b/go.mod index 5547468d..3513d4dd 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/hashicorp/golang-lru v0.5.4 github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 github.com/jedisct1/dlog v0.0.0-20210927135244-3381aa132e7f + github.com/jedisct1/ewma v1.2.1-0.20220220223311-a30af446ecb9 github.com/jedisct1/go-clocksmith v0.0.0-20210101121932-da382b963868 github.com/jedisct1/go-dnsstamps v0.0.0-20220328103132-6fb2da762370 github.com/jedisct1/go-hpke-compact v0.0.0-20210930135406-0763750339f0 @@ -17,7 +18,6 @@ require ( github.com/jedisct1/xsecretbox v0.0.0-20210927135450-ebe41aef7bef github.com/k-sone/critbitgo v1.4.0 github.com/kardianos/service v1.2.1 - github.com/lifenjoiner/ewma v0.0.0-20210320054258-4f227d7eb8a2 github.com/miekg/dns v1.1.47 github.com/powerman/check v1.6.0 golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064 diff --git a/go.sum b/go.sum index b3a0b662..d0840f55 100644 --- a/go.sum +++ b/go.sum @@ -350,6 +350,8 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jedisct1/dlog v0.0.0-20210927135244-3381aa132e7f h1:XICcphytniQKdtd4FGrK0b1ERzS7FBvFtVUCReSppmU= github.com/jedisct1/dlog v0.0.0-20210927135244-3381aa132e7f/go.mod h1:35aII3PkLMvmc8daWy0vcZXDU+a40lJczHHTFRJmnvw= +github.com/jedisct1/ewma v1.2.1-0.20220220223311-a30af446ecb9 h1:U5QPCoM1KkMJ9RfEfP0joKNwwwIHG1oP9RzjvQTuh98= +github.com/jedisct1/ewma v1.2.1-0.20220220223311-a30af446ecb9/go.mod h1:qCWdft6DX9wxyNsUS+sxS44UkxE7eQnNtBttTWoW0cU= github.com/jedisct1/go-clocksmith v0.0.0-20210101121932-da382b963868 h1:QZ79mRbNwYYYmiVjyv+X0NKgYE6nyN1yo3gtEFdzpiE= github.com/jedisct1/go-clocksmith v0.0.0-20210101121932-da382b963868/go.mod h1:SAINchklztk2jcLWJ4bpNF4KnwDUSUTX+cJbspWC2Rw= github.com/jedisct1/go-dnsstamps v0.0.0-20220328103132-6fb2da762370 h1:VQyy4FYgkGVvMnfMauP3phjlwmQQu+DxnE5jBBH4It8= @@ -421,8 +423,6 @@ github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJ github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lifenjoiner/ewma v0.0.0-20210320054258-4f227d7eb8a2 h1:eD3+F7WMC7wryFGBrLSyzoRqK+kR7nCT/9VT2E3XJzc= -github.com/lifenjoiner/ewma v0.0.0-20210320054258-4f227d7eb8a2/go.mod h1:SJvYtJnDKXqTrIvyRocCJmuNuM3bUb4krn9UbZXj+tw= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= diff --git a/vendor/modules.txt b/vendor/modules.txt index 0d0c676a..388c03f2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -248,6 +248,9 @@ github.com/inconshreveable/mousetrap # github.com/jedisct1/dlog v0.0.0-20210927135244-3381aa132e7f ## explicit; go 1.17 github.com/jedisct1/dlog +# github.com/jedisct1/ewma v1.2.1-0.20220220223311-a30af446ecb9 +## explicit; go 1.12 +github.com/jedisct1/ewma # github.com/jedisct1/go-clocksmith v0.0.0-20210101121932-da382b963868 ## explicit github.com/jedisct1/go-clocksmith @@ -303,9 +306,6 @@ github.com/ldez/gomoddirectives # github.com/ldez/tagliatelle v0.2.0 ## explicit; go 1.16 github.com/ldez/tagliatelle -# github.com/lifenjoiner/ewma v0.0.0-20210320054258-4f227d7eb8a2 -## explicit; go 1.16 -github.com/lifenjoiner/ewma # github.com/magiconair/properties v1.8.1 ## explicit github.com/magiconair/properties