refactor(mlablocate*): move from i/e/internal to internal (#385)
We've been flattening the package structure for some time now. While there, add very basic examples.
This commit is contained in:
parent
d84cf5b69f
commit
85b16c8bd2
|
@ -4,8 +4,8 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/ooni/probe-cli/v3/internal/engine/internal/mlablocate"
|
|
||||||
"github.com/ooni/probe-cli/v3/internal/engine/model"
|
"github.com/ooni/probe-cli/v3/internal/engine/model"
|
||||||
|
"github.com/ooni/probe-cli/v3/internal/mlablocate"
|
||||||
)
|
)
|
||||||
|
|
||||||
type locateDeps interface {
|
type locateDeps interface {
|
||||||
|
|
|
@ -11,10 +11,10 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ooni/probe-cli/v3/internal/engine/internal/mlablocatev2"
|
|
||||||
"github.com/ooni/probe-cli/v3/internal/engine/model"
|
"github.com/ooni/probe-cli/v3/internal/engine/model"
|
||||||
"github.com/ooni/probe-cli/v3/internal/engine/netx"
|
"github.com/ooni/probe-cli/v3/internal/engine/netx"
|
||||||
"github.com/ooni/probe-cli/v3/internal/humanize"
|
"github.com/ooni/probe-cli/v3/internal/humanize"
|
||||||
|
"github.com/ooni/probe-cli/v3/internal/mlablocatev2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
19
internal/mlablocate/example_test.go
Normal file
19
internal/mlablocate/example_test.go
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package mlablocate_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/apex/log"
|
||||||
|
"github.com/ooni/probe-cli/v3/internal/mlablocate"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Example_usage() {
|
||||||
|
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)
|
||||||
|
}
|
19
internal/mlablocatev2/example_test.go
Normal file
19
internal/mlablocatev2/example_test.go
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package mlablocatev2_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/apex/log"
|
||||||
|
"github.com/ooni/probe-cli/v3/internal/mlablocatev2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Example_usage() {
|
||||||
|
clnt := mlablocatev2.NewClient(http.DefaultClient, log.Log, "miniooni/0.1.0-dev")
|
||||||
|
results, err := clnt.QueryNDT7(context.Background())
|
||||||
|
if err != nil {
|
||||||
|
log.WithError(err).Fatal("clnt.QueryNDT7 failed")
|
||||||
|
}
|
||||||
|
fmt.Printf("%+v\n", results)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user