-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We can ~safely compile our net/http and crypto/tls forks with a later version of Go, because they use public packages in the standard library, which should be covered by the Go 1.x stability guarantee. Whether that is 100% safe, I don't know, but I suppose we should be fine unless there's really something subtle. (We will continue building our packages with the correct version of Go, but I also understand how distribution maintainers have other needs.) The real price to pay for compiling with go1.21 is disabling Psiphon. There isn't much we can do here. It's not possible to have a build configuration with fixed flags that disable GQUIC for Psiphon, so I have two choices (a) either ooniprobe does not build for go1.21 because of Psiphon and I need to tell people to apply a flag; or (b) when you compile with go1.21, everything is WAI but for Psiphon. I chose the latter in this pull request. Note that I originally tried to make oohttp and oocrypto optional. However, it turns out making oohttp optional and using net/http instead cripples ooniprobe entirely. This is why I concluded that maybe compiling go1.20 code using the go1.21 compiler and stdlib is not that bad, considering that our stdlib forks do not (obviously) depend on internals. Part of ooni/probe#2556; closes ooni/probe#2548.
- Loading branch information
1 parent
5a1b93b
commit f8c6189
Showing
9 changed files
with
102 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Runs the whole test suite using go1.21 | ||
name: alltests-go1.21 | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- "release/**" | ||
- "fullbuild" | ||
- "alltestsbuild" | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: magnetikonline/action-golang-cache@v4 | ||
with: | ||
go-version: ~1.21 | ||
cache-key-suffix: "-alltests-go1.21" | ||
|
||
# We cannot run buildtool tests using an unexpected version of Go because the | ||
# tests check whether we're using the expected version of Go 😂😂😂😂. | ||
- run: go test -race -tags shaping $(go list ./...|grep -v 'internal/cmd/buildtool') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Package psiphonfeat implements the psiphon feature. When it is possible | ||
// to enable this feature, we are able to start psiphon tunnels. Otherwise, it's | ||
// not possible to start psiphon tunnels. | ||
package psiphonfeat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//go:build !go1.21 && !ooni_feature_disable_psiphon | ||
|
||
package psiphonfeat | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/Psiphon-Labs/psiphon-tunnel-core/ClientLibrary/clientlib" | ||
) | ||
|
||
// Enabled indicates whether this feature is enabled. | ||
const Enabled = true | ||
|
||
// Start attempts to start the Psiphon tunnel and returns either a Tunnel or an error. | ||
func Start(ctx context.Context, config []byte, workdir string) (Tunnel, error) { | ||
tun, err := clientlib.StartTunnel(ctx, config, "", clientlib.Parameters{ | ||
DataRootDirectory: &workdir}, nil, nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &tunnel{tun}, nil | ||
} | ||
|
||
type tunnel struct { | ||
*clientlib.PsiphonTunnel | ||
} | ||
|
||
// GetSOCKSProxyPort implements Tunnel. | ||
func (t *tunnel) GetSOCKSProxyPort() int { | ||
return t.SOCKSProxyPort | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//go:build go1.21 || ooni_feature_disable_psiphon | ||
|
||
package psiphonfeat | ||
|
||
import "context" | ||
|
||
// Enabled indicates whether this feature is enabled. | ||
const Enabled = false | ||
|
||
// Start attempts to start the Psiphon tunnel and returns either a Tunnel or an error. | ||
func Start(ctx context.Context, config []byte, workdir string) (Tunnel, error) { | ||
return nil, ErrFeatureNotEnabled | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package psiphonfeat | ||
|
||
import "errors" | ||
|
||
// Tunnel is the interface implementing the Psiphon tunnel. | ||
type Tunnel interface { | ||
// Stop stops a running Psiphon tunnel. | ||
Stop() | ||
|
||
// GetSOCKSProxyPort returns the SOCKS5 port used by the tunnel. | ||
GetSOCKSProxyPort() int | ||
} | ||
|
||
// ErrFeatureNotEnabled indicates that the Psiphon feature is not enabled in this build. | ||
var ErrFeatureNotEnabled = errors.New("psiphonfeat: not enabled") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters