Merge pull request 'Make regexp global static' (#30) from regexp_static into master
Reviewed-on: #30
This commit is contained in:
commit
b280f7a1fe
|
@ -163,6 +163,9 @@ func (tp *torProvider) GetInfo(onion string) (map[string]string, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
var progRe = regexp.MustCompile("PROGRESS=([0-9]*)")
|
||||
var sumRe = regexp.MustCompile("SUMMARY=\"(.*)\"$")
|
||||
|
||||
// GetBootstrapStatus returns an int 0-100 on the percent the bootstrapping of the underlying network is at and an optional string message
|
||||
// returns -1 on network disconnected
|
||||
// returns -2 on error
|
||||
|
@ -191,8 +194,6 @@ func (tp *torProvider) GetBootstrapStatus() (int, string) {
|
|||
status := ""
|
||||
|
||||
if len(kvs) > 0 {
|
||||
progRe := regexp.MustCompile("PROGRESS=([0-9]*)")
|
||||
sumRe := regexp.MustCompile("SUMMARY=\"(.*)\"$")
|
||||
|
||||
if progMatches := progRe.FindStringSubmatch(kvs[0].Val); len(progMatches) > 1 {
|
||||
progress, _ = strconv.Atoi(progMatches[1])
|
||||
|
|
Loading…
Reference in New Issue