Make Tor 0.3.5.x the default embedded version, fixes #24
This commit is contained in:
parent
452e22de4f
commit
f5c65d3eb0
10
README.md
10
README.md
|
@ -9,7 +9,7 @@ Features:
|
||||||
* Full support for the Tor controller API
|
* Full support for the Tor controller API
|
||||||
* Support for `net.Conn` and `net.Listen` style APIs
|
* Support for `net.Conn` and `net.Listen` style APIs
|
||||||
* Supports statically compiled Tor to embed Tor into the binary
|
* 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)
|
* 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
|
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
|
// Wait at most a few minutes to publish the service
|
||||||
listenCtx, listenCancel := context.WithTimeout(context.Background(), 3*time.Minute)
|
listenCtx, listenCancel := context.WithTimeout(context.Background(), 3*time.Minute)
|
||||||
defer listenCancel()
|
defer listenCancel()
|
||||||
// Create an onion service to listen on any port but show as 80
|
// Create a v3 onion service to listen on any port but show as 80
|
||||||
onion, err := t.Listen(listenCtx, &tor.ListenConf{RemotePorts: []int{80}})
|
onion, err := t.Listen(listenCtx, &tor.ListenConf{Version3: true, RemotePorts: []int{80}})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panicf("Unable to create onion service: %v", err)
|
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()})
|
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
|
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.
|
be distributed separately. Of course take notice of all licenses in accompanying projects.
|
||||||
|
|
||||||
|
|
2
doc.go
2
doc.go
|
@ -6,7 +6,7 @@
|
||||||
//
|
//
|
||||||
// * Supports statically compiled Tor to embed Tor into the binary
|
// * 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)
|
// * Support for embedded control socket in Tor >= 0.3.5 (non-Windows)
|
||||||
//
|
//
|
||||||
|
|
|
@ -13,20 +13,20 @@
|
||||||
// installed with gcc.exe on the PATH (i.e. the same gcc that was used to build
|
// installed with gcc.exe on the PATH (i.e. the same gcc that was used to build
|
||||||
// the static Tor lib).
|
// 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.
|
// subdirectory. A different subdirectory can be used for a different version.
|
||||||
// Note that the current version doesn't support
|
// Note that the current version does support
|
||||||
// process.Process.EmbeddedControlConn().
|
// process.Process.EmbeddedControlConn() on non-Windows.
|
||||||
package embedded
|
package embedded
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/cretz/bine/process"
|
"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
|
// NewCreator creates a process.Creator for statically-linked Tor embedded in
|
||||||
// the binary.
|
// the binary.
|
||||||
func NewCreator() process.Creator {
|
func NewCreator() process.Creator {
|
||||||
return tor033.NewCreator()
|
return tor035.NewCreator()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue