Allow Custom Tor Config in TorRCBuilder + ProxyACN and ErrorACN #25

Merged
erinn merged 10 commits from custom_tor_config into master 2022-01-12 20:16:42 +00:00
3 changed files with 7 additions and 2 deletions
Showing only changes of commit 5d4cf85d26 - Show all commits

View File

@ -14,7 +14,6 @@ pipeline:
- wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor -P tmp/ - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor -P tmp/
- chmod a+x tmp/tor - chmod a+x tmp/tor
- go mod download - go mod download
- go get -u
quality: quality:
when: when:
repo: openprivacy/connectivity repo: openprivacy/connectivity

1
.gitignore vendored
View File

@ -4,5 +4,4 @@ tor/tor/
vendor/ vendor/
*.cover.out *.cover.out
tmp/ tmp/
testing/tor/torrc
testing/tor/* testing/tor/*
erinn marked this conversation as resolved
Review

redundant

redundant

View File

@ -2,6 +2,7 @@ package connectivity
import ( import (
"net" "net"
"sync"
) )
// ProxyACN because there is rarely a problem that can't be solved by another layer of indirection. // ProxyACN because there is rarely a problem that can't be solved by another layer of indirection.
@ -11,6 +12,10 @@ import (
// ProxyACN - a wrapper around an ACN that allows safe replacement of a running ACN that is transparent to callers. // ProxyACN - a wrapper around an ACN that allows safe replacement of a running ACN that is transparent to callers.
type ProxyACN struct { type ProxyACN struct {
acn ACN acn ACN
// All operations on the underlying acn are assumed to be thread safe, however changing the actual
// acn in ReplaceACN will lock to force an ordering of Close and Callback
lock sync.Mutex
} }
func NewProxyACN(acn ACN) ProxyACN { func NewProxyACN(acn ACN) ProxyACN {
@ -21,6 +26,8 @@ func NewProxyACN(acn ACN) ProxyACN {
erinn marked this conversation as resolved
Review

threads?

threads?
// ReplaceACN closes down the current ACN and replaces it with a new ACN. // ReplaceACN closes down the current ACN and replaces it with a new ACN.
func (p *ProxyACN) ReplaceACN(acn ACN) { func (p *ProxyACN) ReplaceACN(acn ACN) {
p.lock.Lock()
defer p.lock.Unlock()
p.acn.Close() p.acn.Close()
acn.SetStatusCallback(p.acn.Callback()) acn.SetStatusCallback(p.acn.Callback())
p.acn = acn p.acn = acn