feat(miniooni): implement torsf tunnel (#921)

This diff adds to miniooni support for using the torsf tunnel. Such a
tunnel consists of a snowflake pluggable transport in front of a custom
instance of tor and requires tor to be installed.

The usage is like:

```
./miniooni --tunnel=torsf [...]
```

The default snowflake rendezvous method is "domain_fronting". You can
select the AMP cache instead using "amp":

```
./miniooni --snowflake-rendezvous=amp --tunnel=torsf [...]
```

Part of https://github.com/ooni/probe/issues/1955
This commit is contained in:
Simone Basso 2022-10-03 16:52:20 +02:00 committed by GitHub
commit 18a9523496
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 438 additions and 57 deletions

View file

@ -73,7 +73,7 @@ func TestListenerWorksWithFakeDialer(t *testing.T) {
func TestListenerCannotListen(t *testing.T) {
expected := errors.New("mocked error")
lst := &Listener{
overrideListenSocks: func(network, laddr string) (ptxSocksListener, error) {
ListenSocks: func(network, laddr string) (SocksListener, error) {
return nil, expected
},
}
@ -193,7 +193,7 @@ func TestListenerForwardWithNaturalTermination(t *testing.T) {
// mockableSocksListener is a mockable ptxSocksListener.
type mockableSocksListener struct {
// MockAcceptSocks allows to mock AcceptSocks.
MockAcceptSocks func() (ptxSocksConn, error)
MockAcceptSocks func() (SocksConn, error)
// MockAddr allows to mock Addr.
MockAddr func() net.Addr
@ -203,7 +203,7 @@ type mockableSocksListener struct {
}
// AcceptSocks implemements ptxSocksListener.AcceptSocks.
func (m *mockableSocksListener) AcceptSocks() (ptxSocksConn, error) {
func (m *mockableSocksListener) AcceptSocks() (SocksConn, error) {
return m.MockAcceptSocks()
}
@ -220,7 +220,7 @@ func (m *mockableSocksListener) Close() error {
func TestListenerLoopWithTemporaryError(t *testing.T) {
isclosed := &atomicx.Int64{}
sl := &mockableSocksListener{
MockAcceptSocks: func() (ptxSocksConn, error) {
MockAcceptSocks: func() (SocksConn, error) {
if isclosed.Load() > 0 {
return nil, io.EOF
}