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:
parent
5466f30526
commit
18a9523496
10 changed files with 438 additions and 57 deletions
|
|
@ -10,6 +10,7 @@ import (
|
|||
"github.com/cretz/bine/control"
|
||||
"github.com/cretz/bine/tor"
|
||||
"github.com/ooni/probe-cli/v3/internal/model"
|
||||
"github.com/ooni/probe-cli/v3/internal/ptx"
|
||||
"golang.org/x/sys/execabs"
|
||||
)
|
||||
|
||||
|
|
@ -28,6 +29,10 @@ type Config struct {
|
|||
// of obtaining a valid psiphon configuration.
|
||||
Session Session
|
||||
|
||||
// SnowflakeRendezvous is the OPTIONAL rendezvous
|
||||
// method for snowflake
|
||||
SnowflakeRendezvous string
|
||||
|
||||
// TunnelDir is the MANDATORY directory in which the tunnel SHOULD
|
||||
// store its state, if any. If this field is empty, the
|
||||
// Start function fails with ErrEmptyTunnelDir.
|
||||
|
|
@ -56,6 +61,18 @@ type Config struct {
|
|||
// testNetListen allows us to mock net.Listen in testing code.
|
||||
testNetListen func(network string, address string) (net.Listener, error)
|
||||
|
||||
// testSfListenSocks is OPTIONAL and allows to override the
|
||||
// ListenSocks field of a ptx.Listener.
|
||||
testSfListenSocks func(network string, laddr string) (ptx.SocksListener, error)
|
||||
|
||||
// testSfNewPTXListener is OPTIONAL and allows us to wrap the
|
||||
// constructed ptx.Listener for testing purposes.
|
||||
testSfWrapPTXListener func(torsfPTXListener) torsfPTXListener
|
||||
|
||||
// testSfTorStart is OPTIONAL and allows us to override the
|
||||
// call to torStart inside the torsf tunnel.
|
||||
testSfTorStart func(ctx context.Context, config *Config) (Tunnel, DebugInfo, error)
|
||||
|
||||
// testSocks5New allows us to mock socks5.New in testing code.
|
||||
testSocks5New func(conf *socks5.Config) (*socks5.Server, error)
|
||||
|
||||
|
|
@ -74,6 +91,14 @@ type Config struct {
|
|||
testTorGetInfo func(ctrl *control.Conn, keys ...string) ([]*control.KeyVal, error)
|
||||
}
|
||||
|
||||
// snowflakeRendezvousMethod returns the rendezvous method that snowflake should use
|
||||
func (c *Config) snowflakeRendezvousMethod() string {
|
||||
if c.SnowflakeRendezvous != "" {
|
||||
return c.SnowflakeRendezvous
|
||||
}
|
||||
return "domain_fronting"
|
||||
}
|
||||
|
||||
// logger returns the logger to use.
|
||||
func (c *Config) logger() model.Logger {
|
||||
if c.Logger != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue