diff --git a/tor/torProvider.go b/tor/torProvider.go index 4792219..35dbc24 100644 --- a/tor/torProvider.go +++ b/tor/torProvider.go @@ -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])