Lightweight Golang wrapper for querying Tor network data using the Onionoo service.
package main
import (
"fmt"
"log"
"net/http"
"github.com/R4yGM/gonion"
)
func main() {
// Build the HTTP client to use.
client := &http.Client{}
// Build parameters.
params := gonion.Params{
Search: str("R4y"),
Running: b(true),
RecommendedVersion: b(true),
}
// Issue the request.
res, err := gonion.GetDetails(client, params)
if err != nil {
log.Fatal(err)
}
// Use the results.
for _, relay := range res.Relays {
fmt.Println(relay.Nickname)
}
}
func str(str string) *string {
return &str
}
func b(b bool) *bool {
return &b
}
The following endpoints are supported (tested through unit and integration tests):
- bandwidth
- clients
- details
- summary
- uptime
- weights