Skip to content

Commit

Permalink
chore: start upgrading to go1.21.9
Browse files Browse the repository at this point in the history
Part of ooni/probe#2702.

Note that we still need to upgrade Psiphon and ideally this should
happen as part of this pull request.
  • Loading branch information
bassosimone committed Apr 12, 2024
1 parent d08ce02 commit 526de36
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 52 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/go1.21.yml

This file was deleted.

2 changes: 1 addition & 1 deletion GOVERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.20.14
1.21.9
16 changes: 9 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/ooni/probe-cli/v3

go 1.20
go 1.21

toolchain go1.21.9

require (
filippo.io/age v1.1.1
Expand All @@ -25,8 +27,8 @@ require (
github.com/mitchellh/go-wordwrap v1.0.1
github.com/montanaflynn/stats v0.7.1
github.com/ooni/netem v0.0.0-20240208095707-608dcbcd82b8
github.com/ooni/oocrypto v0.5.8
github.com/ooni/oohttp v0.6.8
github.com/ooni/oocrypto v0.6.0
github.com/ooni/oohttp v0.7.1
github.com/ooni/probe-assets v0.22.0
github.com/pborman/getopt/v2 v2.1.0
github.com/pion/stun v0.6.1
Expand All @@ -40,9 +42,9 @@ require (
gitlab.com/yawning/utls.git v0.0.12-1
gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib v1.5.0
gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2 v2.6.1
golang.org/x/crypto v0.21.0
golang.org/x/net v0.22.0
golang.org/x/sys v0.18.0
golang.org/x/crypto v0.22.0
golang.org/x/net v0.24.0
golang.org/x/sys v0.19.0
)

require (
Expand Down Expand Up @@ -153,7 +155,7 @@ require (
github.com/xtaci/smux v1.5.24 // indirect
gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.17.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
Expand Down
9 changes: 9 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,12 @@ github.com/ooni/netem v0.0.0-20240208095707-608dcbcd82b8 h1:kJ2wn19lIP/y9ng85BbF
github.com/ooni/netem v0.0.0-20240208095707-608dcbcd82b8/go.mod h1:b/wAvTR5n92Vk2b0SBmuMU0xO4ZGVrsXtU7zjTby7vw=
github.com/ooni/oocrypto v0.5.8 h1:eoixlF81pQFGAD6LR5IWz5aIwgnolyYnkPti7eQh5n8=
github.com/ooni/oocrypto v0.5.8/go.mod h1:3CMXIpx7vpoZp73fzUuLvuZApfFlKmdrkKJu3QC4hhs=
github.com/ooni/oocrypto v0.6.0 h1:qzBxmJcqqoCsvGWgurTDev4gGtCOe0FSIuDugBdY/kE=
github.com/ooni/oocrypto v0.6.0/go.mod h1:mGlPZeI3jV1gnVQ3xs5WYNo8IoYlyB/p/x79P58hhog=
github.com/ooni/oohttp v0.6.8 h1:yqLXhYO0VXSo56impKOSlVVY+r7TbirJNiash3kkeeg=
github.com/ooni/oohttp v0.6.8/go.mod h1:2IGLODw3KeJozKrwhGLVHWC7Ocihi8l5+HbhqLmxt6I=
github.com/ooni/oohttp v0.7.1 h1:8+UJHdKvbGoqUbzeAOkz6/sI75g6k2I3I5/+HtaehX8=
github.com/ooni/oohttp v0.7.1/go.mod h1:6mjMEE8uA2wODu93EABmtmbjy0/YuORNNcRY9Dw2ncw=
github.com/ooni/probe-assets v0.22.0 h1:Nxl7X+HdTamGKKzA4g0OKZY7zOPTY8IcHe/G9A/zrcc=
github.com/ooni/probe-assets v0.22.0/go.mod h1:m0k2FFzcLfFm7dhgyYkLCUR3R0CoRPr0jcjctDS2+gU=
github.com/oschwald/geoip2-golang v1.9.0 h1:uvD3O6fXAXs+usU+UGExshpdP13GAqp4GBrzN7IgKZc=
Expand Down Expand Up @@ -609,6 +613,7 @@ golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98y
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/exp v0.0.0-20181106170214-d68db9428509/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb h1:c0vyKkb6yr3KR7jEfJaOSv4lG7xPkbN6r52aJz1d8a8=
Expand Down Expand Up @@ -656,6 +661,8 @@ golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down Expand Up @@ -710,6 +717,7 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand All @@ -724,6 +732,7 @@ golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
Expand Down
13 changes: 2 additions & 11 deletions internal/enginenetx/bridgespolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package enginenetx
import (
"context"
"math/rand"
"slices"
"time"
)

Expand Down Expand Up @@ -64,16 +65,6 @@ var bridgesPolicyTestHelpersDomains = []string{
"d33d1gs9kpq1c5.cloudfront.net",
}

// TODO(bassosimone): this would be slices.Contains when we'll use go1.21
func bridgesPolicySlicesContains(slice []string, value string) bool {
for _, entry := range slice {
if value == entry {
return true
}
}
return false
}

func (p *bridgesPolicy) maybeRewriteTestHelpersTactics(input <-chan *httpsDialerTactic) <-chan *httpsDialerTactic {
out := make(chan *httpsDialerTactic)

Expand All @@ -82,7 +73,7 @@ func (p *bridgesPolicy) maybeRewriteTestHelpersTactics(input <-chan *httpsDialer

for tactic := range input {
// When we're not connecting to a TH, pass the policy down the chain unmodified
if !bridgesPolicySlicesContains(bridgesPolicyTestHelpersDomains, tactic.VerifyHostname) {
if !slices.Contains(bridgesPolicyTestHelpersDomains, tactic.VerifyHostname) {
out <- tactic
continue
}
Expand Down
10 changes: 1 addition & 9 deletions internal/x/dslx/fxasync.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,6 @@ type matrixPoint[A, B any] struct {
in A
}

// matrixMin can be replaced with the built-in min when we switch to go1.21.
func matrixMin(a, b Parallelism) Parallelism {
if a < b {
return a
}
return b
}

// Matrix invokes each function on each input using N goroutines and streams the results to a channel.
func Matrix[A, B any](ctx context.Context, N Parallelism, inputs []A, functions []Func[A, B]) <-chan *Maybe[B] {
// make output
Expand All @@ -172,7 +164,7 @@ func Matrix[A, B any](ctx context.Context, N Parallelism, inputs []A, functions

// spawn goroutines
wg := &sync.WaitGroup{}
N = matrixMin(1, N)
N = min(1, N)
for i := Parallelism(0); i < N; i++ {
wg.Add(1)
go func() {
Expand Down

0 comments on commit 526de36

Please sign in to comment.