gonion

Gonion

GoDoc Go Report Card

Lightweight Golang wrapper for querying Tor network data using the Onionoo service.

How to use

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
}

Support

The following endpoints are supported (tested through unit and integration tests):