make local port selection deterministic and detach from the control port to improve performance

This commit is contained in:
erinn 2018-10-08 20:19:19 -07:00
parent dd2af9f059
commit 5c98fd575b
1 changed files with 3 additions and 2 deletions

View File

@ -29,7 +29,7 @@ func SetupOnion(torControlAddress string, torControlSocketType string, authentic
return c.NewListener(cfg, onionport)
}
func SetupOnionV3(torControlAddress string, torControlSocketType string, authentication string, pk ed25519.PrivateKey, onionport uint16) (net.Listener, error) {
func SetupOnionV3(torControlAddress string, torControlSocketType string, authentication string, pk ed25519.PrivateKey, onionstr string, onionport uint16) (net.Listener, error) {
c, err := bulb.Dial(torControlSocketType, torControlAddress)
if err != nil {
return nil, err
@ -56,7 +56,8 @@ func SetupOnionV3(torControlAddress string, torControlSocketType string, authent
cfg := &bulb.NewOnionConfig{
DiscardPK: true,
PrivateKey: onionPK,
Detach: true,
}
return c.NewListener(cfg, onionport)
return c.RecoverListener(cfg, onionstr, onionport)
}