Skip to content

Commit

Permalink
update args
Browse files Browse the repository at this point in the history
  • Loading branch information
radulucut authored and mr-karan committed Sep 30, 2024
1 parent 5aee2d2 commit ea74e1f
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions cmd/doggo/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions cmd/doggo/completions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions cmd/doggo/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -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."},
Expand Down Expand Up @@ -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."},
},
}

Expand Down
6 changes: 3 additions & 3 deletions docs/src/content/docs/features/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/guide/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions docs/src/content/docs/guide/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
4 changes: 2 additions & 2 deletions internal/app/globalping.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions pkg/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ea74e1f

Please sign in to comment.