GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Add line that shows number of functional bridges.

parent 9a274243
...@@ -82,14 +82,23 @@ func NewRouter() *mux.Router { ...@@ -82,14 +82,23 @@ func NewRouter() *mux.Router {
func printPrettyCache() { func printPrettyCache() {
var shortError string var shortError string
var numFunctional int
for bridgeLine, cacheEntry := range cache { for bridgeLine, cacheEntry := range cache {
shortError = cacheEntry.Error shortError = cacheEntry.Error
maxChars := 50 maxChars := 50
if len(cacheEntry.Error) > maxChars { if len(cacheEntry.Error) > maxChars {
shortError = cacheEntry.Error[:maxChars] shortError = cacheEntry.Error[:maxChars]
} }
if cacheEntry.Error == "" {
numFunctional++
}
fmt.Printf("%-22s %-50s %s\n", bridgeLine, shortError, cacheEntry.Time) fmt.Printf("%-22s %-50s %s\n", bridgeLine, shortError, cacheEntry.Time)
} }
if len(cache) > 0 {
log.Printf("Found %d (%.2f%%) out of %d functional.\n", numFunctional,
float64(numFunctional)/float64(len(cache))*100.0, len(cache))
}
} }
func main() { func main() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment