diff --git a/README.md b/README.md index 3f0d976..90b773f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Features: * Full support for the Tor controller API * Support for `net.Conn` and `net.Listen` style APIs * Supports statically compiled Tor to embed Tor into the binary -* Supports both V2 and V3 onion services +* Supports both v2 and v3 onion services * Support for embedded control socket in Tor >= 0.3.5 (non-Windows) See info below, the [API docs](http://godoc.org/github.com/cretz/bine), and the [examples](examples). The project is @@ -44,8 +44,8 @@ func main() { // Wait at most a few minutes to publish the service listenCtx, listenCancel := context.WithTimeout(context.Background(), 3*time.Minute) defer listenCancel() - // Create an onion service to listen on any port but show as 80 - onion, err := t.Listen(listenCtx, &tor.ListenConf{RemotePorts: []int{80}}) + // Create a v3 onion service to listen on any port but show as 80 + onion, err := t.Listen(listenCtx, &tor.ListenConf{Version3: true, RemotePorts: []int{80}}) if err != nil { log.Panicf("Unable to create onion service: %v", err) } @@ -75,6 +75,10 @@ which will require [building Tor statically](https://github.com/cretz/tor-static t, err := tor.Start(nil, &tor.StartConf{ProcessCreator: embedded.NewCreator()}) ``` +This defaults to Tor 0.3.5.x versions but others can be used from different packages. In non-Windows environments, the +`UseEmbeddedControlConn` field in `StartConf` can be set to `true` to use an embedded socket that does not open a +control port. + Tested on Windows, the original exe file is ~7MB. With Tor statically linked it comes to ~24MB, but Tor does not have to be distributed separately. Of course take notice of all licenses in accompanying projects. diff --git a/doc.go b/doc.go index a9aeec1..31ee100 100644 --- a/doc.go +++ b/doc.go @@ -6,7 +6,7 @@ // // * Supports statically compiled Tor to embed Tor into the binary // -// * Supports both V2 and V3 onion services +// * Supports both v2 and v3 onion services // // * Support for embedded control socket in Tor >= 0.3.5 (non-Windows) // diff --git a/process/embedded/process.go b/process/embedded/process.go index 99ef8d9..2f05a7a 100644 --- a/process/embedded/process.go +++ b/process/embedded/process.go @@ -13,20 +13,20 @@ // installed with gcc.exe on the PATH (i.e. the same gcc that was used to build // the static Tor lib). // -// The default in here is currently for Tor 0.3.3.x which uses the tor-0.3.3 +// The default in here is currently for Tor 0.3.5.x which uses the tor-0.3.5 // subdirectory. A different subdirectory can be used for a different version. -// Note that the current version doesn't support -// process.Process.EmbeddedControlConn(). +// Note that the current version does support +// process.Process.EmbeddedControlConn() on non-Windows. package embedded import ( "github.com/cretz/bine/process" - tor033 "github.com/cretz/bine/process/embedded/tor-0.3.3" + tor035 "github.com/cretz/bine/process/embedded/tor-0.3.5" ) // NewCreator creates a process.Creator for statically-linked Tor embedded in // the binary. func NewCreator() process.Creator { - return tor033.NewCreator() + return tor035.NewCreator() }