Documentation ¶
Overview ¶
Package mlablocate contains a locate.measurementlab.net client implementing v1 of the locate API. This version of the API isn't suitable for requesting servers for ndt7. You should use the mlablocatev2 package for that.
Example (Usage) ¶
package main import ( "context" "fmt" "net/http" "github.com/apex/log" "github.com/ooni/probe-cli/v3/internal/mlablocate" ) func main() { clnt := mlablocate.NewClient(http.DefaultClient, log.Log, "miniooni/0.1.0-dev") result, err := clnt.Query(context.Background(), "neubot/dash") if err != nil { log.WithError(err).Fatal("clnt.Query failed") } fmt.Printf("%s\n", result.FQDN) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // HTTPClient is the MANDATORY http client to use. HTTPClient model.HTTPClient // Hostname is the MANDATORY hostname of the mlablocate API. Hostname string // Logger is the MANDATORY logger to use. Logger model.DebugLogger // Scheme is the MANDATORY scheme to use (http or https). Scheme string // UserAgent is the MANDATORY user-agent to use. UserAgent string }
Client is a locate.measurementlab.net client. Please use the NewClient factory to construct a new instance of client, otherwise you MUST fill all the fields marked as MANDATORY.
func NewClient ¶
func NewClient(httpClient model.HTTPClient, logger model.DebugLogger, userAgent string) *Client
NewClient creates a new locate.measurementlab.net client.
Click to show internal directories.
Click to hide internal directories.