Exposing Restart #72

Closed
sarah wants to merge 2 commits from restart into master
3 changed files with 14 additions and 1 deletions
Showing only changes of commit 94389db18e - Show all commits

View File

@ -28,6 +28,9 @@ type ACN interface {
// Sets the calback function to be called when ACN status changes
SetStatusCallback(callback func(int, string))
// Restarts the underlying connection
Reboot()
// Open takes a hostname and returns a net.conn to the derived endpoint
// Open allows a client to resolve various hostnames to connections
// The supported types are onions address are:

View File

@ -121,7 +121,7 @@ func (tp *torProvider) Listen(identity PrivateKey, port int) (ListenService, err
case ed25519.PrivateKey:
privkey = pk
gpubk := pk.Public()
switch pubk := gpubk.(type) {
switch pubk := gpubk.(type) {git
case ed25519.PublicKey:
onion = utils.GetTorV3Hostname(pubk)
}
@ -155,6 +155,10 @@ func (tp *torProvider) Listen(identity PrivateKey, port int) (ListenService, err
return ols, nil
}
func (tp *torProvider) Reboot() {
tp.restart()
}
func (tp *torProvider) Open(hostname string) (net.Conn, string, error) {
tp.lock.Lock()
@ -285,6 +289,9 @@ func (tp *torProvider) monitorRestart() {
}
}
lastBootstrapProgress = prog
tp.
case <-tp.breakChan:
return
}
@ -324,6 +331,7 @@ func createFromExisting(controlport *control.Conn, datadir string) *tor.Tor {
StopProcessOnClose: false,
GeoIPCreatedFile: "",
GeoIPv6CreatedFile: "",
}
t.Control.DebugWriter = t.DebugWriter

2
go.mod
View File

@ -9,3 +9,5 @@ require (
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3 // indirect
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect
)
go 1.13