testlists

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2019 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package testlists queries orchestra's test lists.

Index

Constants

View Source
const (
	// DefaultBaseURL is the default base URL
	DefaultBaseURL = "https://orchestrate.ooni.io"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// BaseURL is the orchestra base URL.
	BaseURL string

	// HTTPClient is the HTTP client to use.
	HTTPClient *http.Client

	// Logger is the logger to use.
	Logger log.Logger

	// UserAgent is the user agent to use.
	UserAgent string

	// EnabledCategories is a list of category codes that are enabled
	EnabledCategories []string
}

Client is a client for the requesting test lists.

func NewClient

func NewClient(sess *session.Session) *Client

NewClient creates a new client in the context of the given session.

func (*Client) Do

func (c *Client) Do(
	ctx context.Context, countryCode string, limit int,
) ([]URLInfo, error)

Do retrieves the test list for the specified country.

func (*Client) SetEnabledCategories

func (c *Client) SetEnabledCategories(categories []string) error

SetEnabledCategories configures the client category codes

type URLInfo

type URLInfo struct {
	// URL is the URL
	URL string `json:"url"`

	// CountryCode is the country code
	CountryCode string `json:"country_code"`

	// CategoryCode is the category code
	CategoryCode string `json:"category_code"`
}

URLInfo contains the URL and the citizenlab category code for that URL

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL