Make the geoip lookup output prettier
This commit is contained in:
parent
5b31403061
commit
65b5feef0d
3 changed files with 50 additions and 3 deletions
|
|
@ -1,9 +1,12 @@
|
|||
package geoip
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/alecthomas/kingpin"
|
||||
"github.com/apex/log"
|
||||
"github.com/ooni/probe-cli/internal/cli/root"
|
||||
"github.com/ooni/probe-cli/internal/output"
|
||||
"github.com/ooni/probe-cli/utils"
|
||||
)
|
||||
|
||||
|
|
@ -13,7 +16,7 @@ func init() {
|
|||
shouldUpdate := cmd.Flag("update", "Update the geoip database").Bool()
|
||||
|
||||
cmd.Action(func(_ *kingpin.ParseContext) error {
|
||||
log.Info("geoip")
|
||||
output.SectionTitle("GeoIP lookup")
|
||||
ctx, err := root.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -35,7 +38,8 @@ func init() {
|
|||
}
|
||||
|
||||
log.WithFields(log.Fields{
|
||||
"asn": loc.ASN,
|
||||
"type": "table",
|
||||
"asn": fmt.Sprintf("AS%d", loc.ASN),
|
||||
"network_name": loc.NetworkName,
|
||||
"country_code": loc.CountryCode,
|
||||
"ip": loc.IP,
|
||||
|
|
|
|||
Loading…
Reference in a new issue