From ea74e1f99c2fa0faa661695fdc9a554474986253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radu=20Lucu=C8=9B?= Date: Fri, 27 Sep 2024 13:18:19 +0300 Subject: [PATCH] update args --- README.md | 2 +- cmd/doggo/cli.go | 6 +++--- cmd/doggo/completions.go | 6 +++--- cmd/doggo/help.go | 6 +++--- docs/src/content/docs/features/output.md | 6 +++--- docs/src/content/docs/guide/examples.md | 4 ++-- docs/src/content/docs/guide/reference.md | 10 +++++----- internal/app/globalping.go | 4 ++-- pkg/models/models.go | 4 ++-- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 96b1768..c2534df 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ doggo example.com --json | jq '.responses[0].answers[].address' doggo --reverse 8.8.8.8 --short # Using Globalping -doggo example.com --from Germany,Japan --limit 2 +doggo example.com --gp-from Germany,Japan --gp-limit 2 ``` ## Features diff --git a/cmd/doggo/cli.go b/cmd/doggo/cli.go index cc18664..146df07 100644 --- a/cmd/doggo/cli.go +++ b/cmd/doggo/cli.go @@ -44,7 +44,7 @@ func main() { logger := utils.InitLogger(cfg.debug) app := initializeApp(logger, cfg) - if app.QueryFlags.From != "" { + if app.QueryFlags.GPFrom != "" { res, err := app.GlobalpingMeasurement() if err != nil { logger.Error("Error fetching globalping measurement", "error", err) @@ -142,8 +142,8 @@ func setupFlags() *flag.FlagSet { f.StringSliceP("nameserver", "n", []string{}, "Address of the nameserver to send packets to") f.BoolP("reverse", "x", false, "Performs a DNS Lookup for an IPv4 or IPv6 address") - f.String("from", "", "Probe locations as a comma-separated list") - f.Int("limit", 1, "Limit the number of probes to use") + f.String("gp-from", "", "Probe locations as a comma-separated list") + f.Int("gp-limit", 1, "Limit the number of probes to use") f.DurationP("timeout", "T", 5*time.Second, "Sets the timeout for a query") f.Bool("search", true, "Use the search list provided in resolv.conf") diff --git a/cmd/doggo/completions.go b/cmd/doggo/completions.go index 3c7c23e..4ba4ff7 100644 --- a/cmd/doggo/completions.go +++ b/cmd/doggo/completions.go @@ -13,7 +13,7 @@ _doggo() { cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" - opts="-v --version -h --help -q --query -t --type -n --nameserver -c --class -r --reverse --strategy --ndots --search --timeout -4 --ipv4 -6 --ipv6 --tls-hostname --skip-hostname-verification -J --json --short --color --debug --time --from --limit" + opts="-v --version -h --help -q --query -t --type -n --nameserver -c --class -r --reverse --strategy --ndots --search --timeout -4 --ipv4 -6 --ipv6 --tls-hostname --skip-hostname-verification -J --json --short --color --debug --time --gp-from --gp-limit" case "${prev}" in -t|--type) @@ -77,8 +77,8 @@ _doggo() { '--color[Colored output]:setting:(true false)' \ '--debug[Enable debug logging]' \ '--time[Shows how long the response took from the server]' \ - '--from[Query using Globalping API from a specific location]' \ - '--limit[Limit the number of probes to use from Globalping]' \ + '--gp-from[Query using Globalping API from a specific location]' \ + '--gp-limit[Limit the number of probes to use from Globalping]' \ '*:hostname:_hosts' \ && ret=0 diff --git a/cmd/doggo/help.go b/cmd/doggo/help.go index 073d96a..dc8dbc8 100644 --- a/cmd/doggo/help.go +++ b/cmd/doggo/help.go @@ -94,7 +94,7 @@ func renderCustomHelp() { {"-q mrkaran.dev -t MX -n 1.1.1.1", "Using named arguments."}, {"mrkaran.dev --aa --ad", "Query with Authoritative Answer and Authenticated Data flags set."}, {"mrkaran.dev --cd --do", "Query with Checking Disabled and DNSSEC OK flags set."}, - {"mrkaran.dev --from Germany", "Query using Globalping API from a specific location."}, + {"mrkaran.dev --gp-from Germany", "Query using Globalping API from a specific location."}, }, "TransportOptions": []TransportOption{ {"@udp://", "eg: @1.1.1.1", "initiates a UDP query to 1.1.1.1:53."}, @@ -141,8 +141,8 @@ func renderCustomHelp() { {"--time", "Shows how long the response took from the server."}, }, "GlobalPingOptions": []Option{ - {"--from=Germany", "Query using Globalping API from a specific location."}, - {"--limit=INT", "Limit the number of probes to use from Globalping."}, + {"--gp-from=Germany", "Query using Globalping API from a specific location."}, + {"--gp-limit=INT", "Limit the number of probes to use from Globalping."}, }, } diff --git a/docs/src/content/docs/features/output.md b/docs/src/content/docs/features/output.md index b4758cd..1a8ecfc 100644 --- a/docs/src/content/docs/features/output.md +++ b/docs/src/content/docs/features/output.md @@ -17,7 +17,7 @@ mrkaran.dev. A IN 300s 172.67.187.239 127.0.0.53:53 ``` ```bash -doggo mrkaran.dev --from Europe,Asia --limit 2 +doggo mrkaran.dev --gp-from Europe,Asia --gp-limit 2 LOCATION NAME TYPE CLASS TTL ADDRESS NAMESERVER Vienna, AT, EU, EDIS GmbH (AS57169) @@ -71,7 +71,7 @@ doggo internetfreedom.in --json | jq ``` ```bash -doggo mrkaran.dev --from Europe,Asia --limit 2 --json | jq +doggo mrkaran.dev --gp-from Europe,Asia --gp-limit 2 --json | jq ``` ```json @@ -124,7 +124,7 @@ doggo mrkaran.dev --short ``` ```bash -doggo mrkaran.dev --from Europe,Asia --limit 2 --short +doggo mrkaran.dev --gp-from Europe,Asia --gp-limit 2 --short Frankfurt, DE, EU, WIBO Baltic UAB (AS59939) 104.21.7.168 172.67.187.239 diff --git a/docs/src/content/docs/guide/examples.md b/docs/src/content/docs/guide/examples.md index 0dc2ea3..b8a3ca5 100644 --- a/docs/src/content/docs/guide/examples.md +++ b/docs/src/content/docs/guide/examples.md @@ -27,7 +27,7 @@ These examples showcase how to combine different features for powerful DNS query 4. Query using Globalping API from a specific location: ```bash - doggo example.com --from Germany + doggo example.com --gp-from Germany ``` ### Using Different Resolvers @@ -58,7 +58,7 @@ These examples showcase how to combine different features for powerful DNS query 8. Using Globalping API ```bash - doggo example.com @1.1.1.1 --from Germany + doggo example.com @1.1.1.1 --gp-from Germany ``` ### Advanced Queries diff --git a/docs/src/content/docs/guide/reference.md b/docs/src/content/docs/guide/reference.md index f1e7123..4abedbe 100644 --- a/docs/src/content/docs/guide/reference.md +++ b/docs/src/content/docs/guide/reference.md @@ -70,10 +70,10 @@ Specify the protocol with a URL-type scheme. UDP is used if no scheme is specifi ## Globalping API Options -| Option | Description | Example | -| --------- | ---------------------------------- | -------------------- | -| `--from` | Specify the location to query from | `--from Europe,Asia` | -| `--limit` | Limit the number of probes to use | `--limit 5` | +| Option | Description | Example | +| ------------ | ---------------------------------- | ----------------------- | +| `--gp-from` | Specify the location to query from | `--gp-from Europe,Asia` | +| `--gp-limit` | Limit the number of probes to use | `--gp-limit 5` | ## Examples @@ -109,7 +109,7 @@ Specify the protocol with a URL-type scheme. UDP is used if no scheme is specifi 6. Query using Globalping API from a specific location: ``` - doggo example.com --from Europe,Asia --limit 5 + doggo example.com --gp-from Europe,Asia --gp-limit 5 ``` For more detailed usage examples, refer to the [Examples](/guide/examples) section. diff --git a/internal/app/globalping.go b/internal/app/globalping.go index 18a023d..5fc8e9f 100644 --- a/internal/app/globalping.go +++ b/internal/app/globalping.go @@ -47,8 +47,8 @@ func (app *App) GlobalpingMeasurement() (*globalping.Measurement, error) { o := &globalping.MeasurementCreate{ Type: "dns", Target: target, - Limit: app.QueryFlags.Limit, - Locations: parseGlobalpingLocations(app.QueryFlags.From), + Limit: app.QueryFlags.GPLimit, + Locations: parseGlobalpingLocations(app.QueryFlags.GPFrom), Options: &globalping.MeasurementOptions{ Protocol: protocol, Port: port, diff --git a/pkg/models/models.go b/pkg/models/models.go index eb0ae96..71de9f0 100644 --- a/pkg/models/models.go +++ b/pkg/models/models.go @@ -47,8 +47,8 @@ type QueryFlags struct { QueryAny bool `koanf:"any" json:"any"` // Globalping flags - From string `koanf:"from" json:"from"` - Limit int `koanf:"limit" json:"limit"` + GPFrom string `koanf:"gp-from" json:"gp-from"` + GPLimit int `koanf:"gp-limit" json:"gp-limit"` } // Nameserver represents the type of Nameserver