add GetVersion to acn and torProvider
the build was successful
Details
the build was successful
Details
This commit is contained in:
parent
f13387fcae
commit
540183a881
3
acn.go
3
acn.go
|
@ -55,5 +55,8 @@ type ACN interface {
|
||||||
// Get PID
|
// Get PID
|
||||||
GetPID() (int, error)
|
GetPID() (int, error)
|
||||||
|
|
||||||
|
// GetVersion returns a string of what the ACN returns when asked for a version
|
||||||
|
GetVersion() string
|
||||||
|
|
||||||
Close()
|
Close()
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,10 @@ func (lp *localProvider) GetPID() (int, error) {
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (lp *localProvider) GetVersion() string {
|
||||||
|
return "0.1"
|
||||||
|
}
|
||||||
|
|
||||||
// WaitTillBootstrapped Blocks until underlying network is bootstrapped
|
// WaitTillBootstrapped Blocks until underlying network is bootstrapped
|
||||||
func (lp *localProvider) WaitTillBootstrapped() {
|
func (lp *localProvider) WaitTillBootstrapped() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,6 +137,22 @@ func (tp *torProvider) GetBootstrapStatus() (int, string) {
|
||||||
return progress, status
|
return progress, status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (tp *torProvider) GetVersion() string {
|
||||||
|
tp.lock.Lock()
|
||||||
|
defer tp.lock.Unlock()
|
||||||
|
|
||||||
|
if tp.t == nil {
|
||||||
|
return "No Tor"
|
||||||
|
}
|
||||||
|
|
||||||
|
pinfo, err := tp.t.Control.ProtocolInfo()
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
return pinfo.TorVersion
|
||||||
|
}
|
||||||
|
return "No Tor"
|
||||||
|
}
|
||||||
|
|
||||||
// WaitTillBootstrapped Blocks until underlying network is bootstrapped
|
// WaitTillBootstrapped Blocks until underlying network is bootstrapped
|
||||||
func (tp *torProvider) WaitTillBootstrapped() {
|
func (tp *torProvider) WaitTillBootstrapped() {
|
||||||
for true {
|
for true {
|
||||||
|
@ -290,9 +306,12 @@ func (tp *torProvider) checkVersion() error {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.Debugln("connected to control port")
|
log.Debugln("connected to control port")
|
||||||
pinfo, err := controlport.ProtocolInfo()
|
pinfo, err := controlport.ProtocolInfo()
|
||||||
if err == nil && minTorVersionReqs(pinfo.TorVersion) {
|
if err == nil {
|
||||||
log.Debugln("OK version " + pinfo.TorVersion)
|
if minTorVersionReqs(pinfo.TorVersion) {
|
||||||
return nil
|
log.Debugln("OK version " + pinfo.TorVersion)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return fmt.Errorf("Tor version not supported: %v", pinfo.TorVersion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue