drone use go 1.19.1
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
bbe4198a41
commit
2f3860eb89
|
@ -5,7 +5,7 @@ name: linux-test
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: fetch
|
- name: fetch
|
||||||
image: golang:1.17.5
|
image: golang:1.19.1
|
||||||
volumes:
|
volumes:
|
||||||
- name: deps
|
- name: deps
|
||||||
path: /go
|
path: /go
|
||||||
|
@ -15,14 +15,14 @@ steps:
|
||||||
- chmod a+x tmp/tor
|
- chmod a+x tmp/tor
|
||||||
- go mod download
|
- go mod download
|
||||||
- name: quality
|
- name: quality
|
||||||
image: golang:1.17.5
|
image: golang:1.19.1
|
||||||
volumes:
|
volumes:
|
||||||
- name: deps
|
- name: deps
|
||||||
path: /go
|
path: /go
|
||||||
commands:
|
commands:
|
||||||
- staticcheck ./...
|
- staticcheck ./...
|
||||||
- name: units-tests
|
- name: units-tests
|
||||||
image: golang:1.17.5
|
image: golang:1.19.1
|
||||||
volumes:
|
volumes:
|
||||||
- name: deps
|
- name: deps
|
||||||
path: /go
|
path: /go
|
||||||
|
@ -33,7 +33,7 @@ steps:
|
||||||
- sh testing/tests.sh
|
- sh testing/tests.sh
|
||||||
- pkill -9 tor
|
- pkill -9 tor
|
||||||
- name: integration-tests
|
- name: integration-tests
|
||||||
image: golang:1.17.5
|
image: golang:1.19.1
|
||||||
volumes:
|
volumes:
|
||||||
- name: deps
|
- name: deps
|
||||||
path: /go
|
path: /go
|
||||||
|
|
|
@ -3,7 +3,6 @@ package testing
|
||||||
import (
|
import (
|
||||||
"git.openprivacy.ca/openprivacy/connectivity/tor"
|
"git.openprivacy.ca/openprivacy/connectivity/tor"
|
||||||
"git.openprivacy.ca/openprivacy/log"
|
"git.openprivacy.ca/openprivacy/log"
|
||||||
"io/ioutil"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
path "path/filepath"
|
path "path/filepath"
|
||||||
|
@ -30,7 +29,7 @@ func TestLaunchTor(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
dataDir := ""
|
dataDir := ""
|
||||||
if dataDir, err = ioutil.TempDir(path.Join("..", "testing"), "data-dir-"); err != nil {
|
if dataDir, err = os.MkdirTemp(path.Join("..", "testing"), "data-dir-"); err != nil {
|
||||||
t.Fatalf("could not create data dir")
|
t.Fatalf("could not create data dir")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -335,7 +335,6 @@ func (tp *torProvider) restart() {
|
||||||
}
|
}
|
||||||
tp.lastRestartTime = time.Now()
|
tp.lastRestartTime = time.Now()
|
||||||
tp.isClosed = false
|
tp.isClosed = false
|
||||||
tp.t.Control.TakeOwnership()
|
|
||||||
go tp.monitorRestart()
|
go tp.monitorRestart()
|
||||||
} else {
|
} else {
|
||||||
log.Errorf("Error restarting Tor process: %v", err)
|
log.Errorf("Error restarting Tor process: %v", err)
|
||||||
|
@ -432,7 +431,6 @@ func NewTorACNWithAuth(appDirectory string, bundledTorPath string, dataDir strin
|
||||||
tp, err := startTor(appDirectory, bundledTorPath, dataDir, controlPort, authenticator)
|
tp, err := startTor(appDirectory, bundledTorPath, dataDir, controlPort, authenticator)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
tp.isClosed = false
|
tp.isClosed = false
|
||||||
tp.t.Control.TakeOwnership()
|
|
||||||
go tp.monitorRestart()
|
go tp.monitorRestart()
|
||||||
}
|
}
|
||||||
return tp, err
|
return tp, err
|
||||||
|
@ -488,9 +486,9 @@ func startTor(appDirectory string, bundledTorPath string, dataDir string, contro
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.Debugf("creating tor handler from system tor")
|
log.Debugf("creating tor handler from system tor")
|
||||||
tp.t = createFromExisting(controlport, dataDir)
|
tp.t = createFromExisting(controlport, dataDir)
|
||||||
|
tp.dialer, err = tp.t.Dialer(context.TODO(), &tor.DialConf{Authenticator: tp.authenticator})
|
||||||
|
return tp, err
|
||||||
}
|
}
|
||||||
tp.dialer, err = tp.t.Dialer(context.TODO(), &tor.DialConf{Authenticator: tp.authenticator})
|
|
||||||
return tp, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if the torrc file is present where expected
|
// check if the torrc file is present where expected
|
||||||
|
@ -529,6 +527,7 @@ func startTor(appDirectory string, bundledTorPath string, dataDir string, contro
|
||||||
tp.t.DeleteDataDirOnClose = false // caller is responsible for dealing with cached information...
|
tp.t.DeleteDataDirOnClose = false // caller is responsible for dealing with cached information...
|
||||||
tp.dialer, err = tp.t.Dialer(context.TODO(), &tor.DialConf{Authenticator: tp.authenticator})
|
tp.dialer, err = tp.t.Dialer(context.TODO(), &tor.DialConf{Authenticator: tp.authenticator})
|
||||||
tp.version = version
|
tp.version = version
|
||||||
|
tp.t.Control.TakeOwnership()
|
||||||
return tp, err
|
return tp, err
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("could not connect to running tor: %v", err)
|
return nil, fmt.Errorf("could not connect to running tor: %v", err)
|
||||||
|
|
|
@ -3,7 +3,6 @@ package tor
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.openprivacy.ca/openprivacy/log"
|
"git.openprivacy.ca/openprivacy/log"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
path "path/filepath"
|
path "path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
@ -41,7 +40,7 @@ func TestTorProvider(t *testing.T) {
|
||||||
|
|
||||||
dataDir := ""
|
dataDir := ""
|
||||||
var err error
|
var err error
|
||||||
if dataDir, err = ioutil.TempDir(path.Join("..", "testing"), "data-dir-"); err != nil {
|
if dataDir, err = os.MkdirTemp(path.Join("..", "testing"), "data-dir-"); err != nil {
|
||||||
t.Fatalf("could not create data dir")
|
t.Fatalf("could not create data dir")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ func (tb *TorrcBuilder) WithHashedPassword(password string) *TorrcBuilder {
|
||||||
|
|
||||||
// Build finalizes the torrc contents and write a file
|
// Build finalizes the torrc contents and write a file
|
||||||
func (tb *TorrcBuilder) Build(path string) error {
|
func (tb *TorrcBuilder) Build(path string) error {
|
||||||
return ioutil.WriteFile(path, []byte(strings.Join(tb.lines, "\n")), 0600)
|
return os.WriteFile(path, []byte(strings.Join(tb.lines, "\n")), 0600)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preview provides a string representation of the torrc file without writing it to a file location.
|
// Preview provides a string representation of the torrc file without writing it to a file location.
|
||||||
|
|
Loading…
Reference in New Issue