Skip to content

Commit

Permalink
chore: update to ooni/go-libtor v1.1.7 (#1064)
Browse files Browse the repository at this point in the history
While there, improve docs and notice we could upgrade the tor
version we're using on Linux. The code builds locally both for
Android and iOS. We'll test the changes in the 3.17 cycle.
  • Loading branch information
bassosimone authored Jan 27, 2023
1 parent 1035f78 commit bcd56e1
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 23 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/miekg/dns v1.1.50
github.com/mitchellh/go-wordwrap v1.0.1
github.com/montanaflynn/stats v0.7.0
github.com/ooni/go-libtor v1.1.6
github.com/ooni/go-libtor v1.1.7
github.com/ooni/oocrypto v0.4.1
github.com/ooni/oohttp v0.5.1
github.com/ooni/probe-assets v0.14.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,8 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/onsi/gomega v1.24.1 h1:KORJXNNTzJXzu4ScJWssJfJMnJ+2QJqhoQSRwNlze9E=
github.com/ooni/go-libtor v1.1.6 h1:hf4xq2vS5E5bBC5BdG+D8orrPo81FRLXAVTDIpL4rzY=
github.com/ooni/go-libtor v1.1.6/go.mod h1:q1YyLwRD9GeMyeerVvwc0vJ2YgwDLTp2bdVcrh/JXyI=
github.com/ooni/go-libtor v1.1.7 h1:ooVcdEPBqDox5OfeXAfXIeQFCbqMLJVfIpO+Irr7N9A=
github.com/ooni/go-libtor v1.1.7/go.mod h1:q1YyLwRD9GeMyeerVvwc0vJ2YgwDLTp2bdVcrh/JXyI=
github.com/ooni/oocrypto v0.4.1 h1:R30TIYJ1Wct9Js6uv1/icVIZJWS+/TqEgRj7kG+WVKo=
github.com/ooni/oocrypto v0.4.1/go.mod h1:D/yqWldJfw/4LKFJ0+2t0gDQ0cXVsHx2v45ODmna5SY=
github.com/ooni/oohttp v0.5.1 h1:C2VaxI+NQRLCqPHKu6ihAHU1Cn+Q73snIjHrU8oVRbI=
Expand Down
3 changes: 1 addition & 2 deletions internal/cmd/buildtool/android.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func androidSubcommand() *cobra.Command {
})
cmd.AddCommand(&cobra.Command{
Use: "cdeps {zlib|openssl|libevent|tor} [zlib|openssl|libevent|tor...]",
Short: "Builds C dependencies on Linux systems (experimental)",
Short: "Cross compiles C dependencies for Android",
Run: func(cmd *cobra.Command, args []string) {
for _, arg := range args {
androidCdepsBuildMain(arg, &buildDeps{})
Expand Down Expand Up @@ -350,7 +350,6 @@ func androidCdepsBuildMain(name string, deps buildtoolmodel.Dependencies) {
runtime.GOOS == "darwin" || runtime.GOOS == "linux",
"this command requires darwin or linux",
)

androidHome := deps.AndroidSDKCheck()
ndkDir := deps.AndroidNDKCheck(androidHome)
archs := []string{"arm", "arm64", "386", "amd64"}
Expand Down
16 changes: 8 additions & 8 deletions internal/cmd/buildtool/android_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1644,12 +1644,12 @@ func TestAndroidBuildCdepsTor(t *testing.T) {
expect: []buildtooltest.ExecExpectations{{
Env: []string{},
Argv: []string{
"curl", "-fsSLO", "https://www.torproject.org/dist/tor-0.4.7.12.tar.gz",
"curl", "-fsSLO", "https://www.torproject.org/dist/tor-0.4.7.13.tar.gz",
},
}, {
Env: []string{},
Argv: []string{
"tar", "-xf", "tor-0.4.7.12.tar.gz",
"tar", "-xf", "tor-0.4.7.13.tar.gz",
},
}, {
Env: []string{},
Expand Down Expand Up @@ -1715,12 +1715,12 @@ func TestAndroidBuildCdepsTor(t *testing.T) {
}, {
Env: []string{},
Argv: []string{
"curl", "-fsSLO", "https://www.torproject.org/dist/tor-0.4.7.12.tar.gz",
"curl", "-fsSLO", "https://www.torproject.org/dist/tor-0.4.7.13.tar.gz",
},
}, {
Env: []string{},
Argv: []string{
"tar", "-xf", "tor-0.4.7.12.tar.gz",
"tar", "-xf", "tor-0.4.7.13.tar.gz",
},
}, {
Env: []string{},
Expand Down Expand Up @@ -1786,12 +1786,12 @@ func TestAndroidBuildCdepsTor(t *testing.T) {
}, {
Env: []string{},
Argv: []string{
"curl", "-fsSLO", "https://www.torproject.org/dist/tor-0.4.7.12.tar.gz",
"curl", "-fsSLO", "https://www.torproject.org/dist/tor-0.4.7.13.tar.gz",
},
}, {
Env: []string{},
Argv: []string{
"tar", "-xf", "tor-0.4.7.12.tar.gz",
"tar", "-xf", "tor-0.4.7.13.tar.gz",
},
}, {
Env: []string{},
Expand Down Expand Up @@ -1857,12 +1857,12 @@ func TestAndroidBuildCdepsTor(t *testing.T) {
}, {
Env: []string{},
Argv: []string{
"curl", "-fsSLO", "https://www.torproject.org/dist/tor-0.4.7.12.tar.gz",
"curl", "-fsSLO", "https://www.torproject.org/dist/tor-0.4.7.13.tar.gz",
},
}, {
Env: []string{},
Argv: []string{
"tar", "-xf", "tor-0.4.7.12.tar.gz",
"tar", "-xf", "tor-0.4.7.13.tar.gz",
},
}, {
Env: []string{},
Expand Down
10 changes: 5 additions & 5 deletions internal/cmd/buildtool/cdepstor.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ func cdepsTorBuildMain(globalEnv *cBuildEnv, deps buildtoolmodel.Dependencies) {
defer restore()

// See https://github.com/Homebrew/homebrew-core/blob/master/Formula/tor.rb
cdepsMustFetch("https://www.torproject.org/dist/tor-0.4.7.12.tar.gz")
cdepsMustFetch("https://www.torproject.org/dist/tor-0.4.7.13.tar.gz")
deps.VerifySHA256( // must be mockable
"3b5d969712c467851bd028f314343ef15a97ea457191e93ffa97310b05b9e395",
"tor-0.4.7.12.tar.gz",
"2079172cce034556f110048e26083ce9bea751f3154b0ad2809751815b11ea9d",
"tor-0.4.7.13.tar.gz",
)
must.Run(log.Log, "tar", "-xf", "tor-0.4.7.12.tar.gz")
_ = deps.MustChdir("tor-0.4.7.12") // must be mockable
must.Run(log.Log, "tar", "-xf", "tor-0.4.7.13.tar.gz")
_ = deps.MustChdir("tor-0.4.7.13") // must be mockable

mydir := filepath.Join(topdir, "CDEPS", "tor")
for _, patch := range cdepsMustListPatches(mydir) {
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/buildtool/linuxcdeps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,12 @@ func TestLinuxCdepsBuildMain(t *testing.T) {
expect: []buildtooltest.ExecExpectations{{
Env: []string{},
Argv: []string{
"curl", "-fsSLO", "https://www.torproject.org/dist/tor-0.4.7.12.tar.gz",
"curl", "-fsSLO", "https://www.torproject.org/dist/tor-0.4.7.13.tar.gz",
},
}, {
Env: []string{},
Argv: []string{
"tar", "-xf", "tor-0.4.7.12.tar.gz",
"tar", "-xf", "tor-0.4.7.13.tar.gz",
},
}, {
Env: []string{},
Expand Down
6 changes: 5 additions & 1 deletion internal/tunnel/tordesktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

package tunnel

//
// This file implements our strategy for running tor on desktop in most
// configurations except for experimental ones.
// configurations except for the ooni_libtor case, where we build tor and
// its dependencies for Linux. The purpuse of this special case it that
// of testing the otherwise untested code that would run on Android.
//

import (
"strings"
Expand Down
9 changes: 8 additions & 1 deletion internal/tunnel/torembed.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

package tunnel

// This file implements an experimental strategy for running tor.
//
// This file implements the ooni_libtor strategy of embedding tor. We manually
// compile tor and its dependencies and link against it. We currently only adopt
// this technique for Android. We may possibly migrate also iOS in the future,
// provided that this functionality proves to be stable in the 3.17 cycle.
//
// See https://github.com/ooni/probe/issues/2365.
//

import (
"errors"
Expand Down
6 changes: 5 additions & 1 deletion internal/tunnel/tormobile.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

package tunnel

// This file implements our strategy for running tor on mobile.
//
// This file implements our old strategy for running tor on mobile, which
// is based on integrating github.com/ooni/go-libtor. We currently only use
// this stategy on iOS. See https://github.com/ooni/probe/issues/2365.
//

import (
"strings"
Expand Down

0 comments on commit bcd56e1

Please sign in to comment.