Skip to content

Commit

Permalink
misc: update location output, add custom area printer (#96)
Browse files Browse the repository at this point in the history
* misc: update location output, add custom area printer

* update AreaClear
  • Loading branch information
radulucut committed Mar 19, 2024
1 parent 52b7a42 commit 2c844ae
Show file tree
Hide file tree
Showing 19 changed files with 356 additions and 513 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: ">=1.21.3"
go-version: ">=1.22"
cache: true

- uses: goreleaser/goreleaser-action@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go: ["1.21"]
go: ["1.22"]
os: [ubuntu-latest, macOS-latest, windows-latest]
name: ${{ matrix.os }} Go ${{ matrix.go }} Tests
steps:
Expand Down
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ For example, if you want to run ping from a probe in Seattle that is also part o

```bash
globalping ping google.com from Comcast+Seattle
> NA, US, (WA), Seattle, ASN:7922, Comcast Cable Communications, LLC
> Seattle (WA), US, NA, Comcast Cable Communications, LLC (AS33650)
PING (142.250.217.78) 56(84) bytes of data.
64 bytes from sea09s29-in-f14.1e100.net (142.250.217.78): icmp_seq=1 ttl=58 time=14.0 ms
64 bytes from sea09s29-in-f14.1e100.net (142.250.217.78): icmp_seq=2 ttl=58 time=14.5 ms
Expand All @@ -141,22 +141,22 @@ With the following command, we execute four ping commands at four different loca

```bash
globalping ping google.com from Amazon,Germany,USA,Dallas --limit 4 --latency
> AS, KR, Seoul, ASN:16509, Amazon.com, Inc. (aws-ap-northeast-2)
> Seoul, KR, AS, Amazon.com, Inc. (AS16509) (aws-ap-northeast-2)
Min: 33.163 ms
Max: 33.256 ms
Avg: 33.22 ms

> EU, DE, Frankfurt, ASN:16276, OVH SAS
> Frankfurt, DE, EU, DE, OVH SAS (AS16276)
Min: 1.221 ms
Max: 1.291 ms
Avg: 1.264 ms

> NA, US, (IL), Chicago, ASN:174, Cogent Communications
> Chicago (IL), US, NA, Cogent Communications (AS174)
Min: 112.405 ms
Max: 112.686 ms
Avg: 112.528 ms

> NA, US, (TX), Dallas, ASN:393336, Catalyst Host LLC
> Dallas (TX), US, NA, Catalyst Host LLC (AS393336)
Min: 1.579 ms
Max: 1.588 ms
Avg: 1.584 ms
Expand All @@ -179,7 +179,7 @@ Include a link at the bottom of your results using the `--share` flag to view an
```bash
globalping dns google.com from gcp-asia-south1 --share
> AS, IN, Mumbai, ASN:396982, Google LLC (gcp-asia-south1)
> Mumbai, IN, AS, Google LLC (AS396982) (gcp-asia-south1)
; <<>> DiG 9.16.37-Debian <<>> -t A google.com -p 53 -4 +timeout=3 +tries=2 +nocookie +nsid
;; global options: +cmd
;; Got answer:
Expand Down Expand Up @@ -207,7 +207,7 @@ You can select the same probes used in a previous measurement by passing the mea
```bash
globalping dns google.com from rvasVvKnj48cxNjC
> AS, IN, Mumbai, ASN:396982, Google LLC (gcp-asia-south1)
> Mumbai, IN, AS, Google LLC (AS396982) (gcp-asia-south1)
; <<>> DiG 9.16.42-Debian <<>> -t A google.com -p 53 -4 +timeout=3 +tries=2 +nocookie +nosplit +nsid
;; global options: +cmd
;; Got answer:
Expand All @@ -234,43 +234,43 @@ Use `[@1 | first, @2 ... @-2, @-1 | last | previous]` to select the probes from
```bash
globalping ping google.com from USA --latency
> NA, US, (VA), Ashburn, ASN:213230, Hetzner Online GmbH
> Ashburn (VA), US, NA, Hetzner Online GmbH (AS213230)
Min: 7.314 ms
Max: 7.413 ms
Avg: 7.359 ms
globalping ping google.com from Germany --latency
> EU, DE, Falkenstein, ASN:24940, Hetzner Online GmbH
> Falkenstein, DE, EU, Hetzner Online GmbH (AS24940)
Min: 4.87 ms
Max: 4.936 ms
Avg: 4.911 ms
globalping ping google.com from previous --latency
> EU, DE, Falkenstein, ASN:24940, Hetzner Online GmbH
> Falkenstein, DE, EU, Hetzner Online GmbH (AS24940)
Min: 4.87 ms
Max: 4.936 ms
Avg: 4.911 ms
globalping ping google.com from @-1 --latency
> EU, DE, Falkenstein, ASN:24940, Hetzner Online GmbH
> Falkenstein, DE, EU, Hetzner Online GmbH (AS24940)
Min: 4.87 ms
Max: 4.936 ms
Avg: 4.911 ms
globalping ping google.com from @-2 --latency
> NA, US, (VA), Ashburn, ASN:213230, Hetzner Online GmbH
> Ashburn (VA), US, NA, Hetzner Online GmbH (AS213230)
Min: 7.314 ms
Max: 7.413 ms
Avg: 7.359 ms
globalping ping google.com from first --latency
> NA, US, (VA), Ashburn, ASN:213230, Hetzner Online GmbH
> Ashburn (VA), US, NA, Hetzner Online GmbH (AS213230)
Min: 7.314 ms
Max: 7.413 ms
Avg: 7.359 ms
globalping ping google.com from @1 --latency
> NA, US, (VA), Ashburn, ASN:213230, Hetzner Online GmbH
> Ashburn (VA), US, NA, Hetzner Online GmbH (AS213230)
Min: 7.314 ms
Max: 7.413 ms
Avg: 7.359 ms
Expand All @@ -287,7 +287,7 @@ This means that eventually you will run out of credits and the test will stop.
```bash
globalping ping cdn.jsdelivr.net from Europe --infinite
> EU, GB, London, ASN:40676, Psychz Networks
> London, GB, EU, Psychz Networks (AS40676)
PING cdn.jsdelivr.net (151.101.1.229) 56(84) bytes of data.
64 bytes from 151.101.1.229 (151.101.1.229): icmp_seq=1 ttl=59 time=0.54 ms
64 bytes from 151.101.1.229 (151.101.1.229): icmp_seq=2 ttl=59 time=0.42 ms
Expand All @@ -298,12 +298,12 @@ If you select multiple probes when using `--infinite` the output will change to
```bash
globalping ping cdn.jsdelivr.net from Europe --limit 5 --infinite
Location | Sent | Loss | Last | Min | Avg | Max
EU, GB, London, ASN:16276, OVH SAS | 22 | 0.00% | 3.33 ms | 3.07 ms | 3.20 ms | 3.33 ms
EU, DE, Falkenstein, ASN:24940, Hetzner Online GmbH | 22 | 0.00% | 5.41 ms | 5.30 ms | 5.78 ms | 13.1 ms
EU, AT, Vienna, ASN:57169, EDIS GmbH | 22 | 0.00% | 0.47 ms | 0.46 ms | 0.56 ms | 0.88 ms
EU, SE, Stockholm, ASN:20473, The Constant Company, LLC | 22 | 0.00% | 1.03 ms | 0.83 ms | 1.15 ms | 4.66 ms
EU, ES, Madrid, ASN:47787, EDGOO NETWORKS LLC | 22 | 0.00% | 0.24 ms | 0.13 ms | 0.26 ms | 0.42 ms
Location | Sent | Loss | Last | Min | Avg | Max
London, GB, EU, OVH SAS (AS16276) | 22 | 0.00% | 3.33 ms | 3.07 ms | 3.20 ms | 3.33 ms
Falkenstein, DE, EU, Hetzner Online GmbH (AS24940) | 22 | 0.00% | 5.41 ms | 5.30 ms | 5.78 ms | 13.1 ms
Vienna, AT, EU, EDIS GmbH (AS57169) | 22 | 0.00% | 0.47 ms | 0.46 ms | 0.56 ms | 0.88 ms
Stockholm, SE, EU, The Constant Company, LLC (AS20473) | 22 | 0.00% | 1.03 ms | 0.83 ms | 1.15 ms | 4.66 ms
Madrid, ES, EU, EDGOO NETWORKS LLC (AS47787) | 22 | 0.00% | 0.24 ms | 0.13 ms | 0.26 ms | 0.42 ms
^C
```
Expand Down
32 changes: 7 additions & 25 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,49 +1,31 @@
module github.com/jsdelivr/globalping-cli

go 1.21

toolchain go1.21.3
go 1.22

require (
github.com/andybalholm/brotli v1.1.0
github.com/charmbracelet/lipgloss v0.9.1
github.com/icza/backscanner v0.0.0-20230330133933-bf6beb754c70
github.com/icza/backscanner v0.0.0-20240221180818-f23e3ba0e79f
github.com/mattn/go-runewidth v0.0.15
github.com/pkg/errors v0.9.1
github.com/pterm/pterm v0.12.78
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
go.uber.org/mock v0.4.0
golang.org/x/term v0.18.0
)

require (
atomicgo.dev/cursor v0.2.0 // indirect
atomicgo.dev/keyboard v0.2.9 // indirect
atomicgo.dev/schedule v0.1.0 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/gookit/color v1.5.4 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/lithammer/fuzzysearch v1.1.8 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tklauser/go-sysconf v0.3.13 // indirect
github.com/tklauser/numcpus v0.7.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
golang.org/x/sys v0.18.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 2c844ae

Please sign in to comment.