cli: net reachability command
This commit is contained in:
+26
@@ -24,6 +24,7 @@ var netCmd = &cli.Command{
|
||||
NetId,
|
||||
netFindPeer,
|
||||
netScores,
|
||||
netReachability,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -202,3 +203,28 @@ var netFindPeer = &cli.Command{
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var netReachability = &cli.Command{
|
||||
Name: "reachability",
|
||||
Usage: "Print information about reachability from the internet",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
api, closer, err := GetAPI(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
i, err := api.NetAutoNatStatus(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Println("AutoNAT status: ", i.Reachability.String())
|
||||
if i.PublicAddr != nil {
|
||||
fmt.Println("Public address: ", i.PublicAddr.String())
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user