@ -189,6 +189,7 @@ var debugCmd = &ffcli.Command{
fs . BoolVar ( & watchIPNArgs . netmap , "netmap" , true , "include netmap in messages" )
fs . BoolVar ( & watchIPNArgs . netmap , "netmap" , true , "include netmap in messages" )
fs . BoolVar ( & watchIPNArgs . initial , "initial" , false , "include initial status" )
fs . BoolVar ( & watchIPNArgs . initial , "initial" , false , "include initial status" )
fs . BoolVar ( & watchIPNArgs . showPrivateKey , "show-private-key" , false , "include node private key in printed netmap" )
fs . BoolVar ( & watchIPNArgs . showPrivateKey , "show-private-key" , false , "include node private key in printed netmap" )
fs . IntVar ( & watchIPNArgs . count , "count" , 0 , "exit after printing this many statuses, or 0 to keep going forever" )
return fs
return fs
} ) ( ) ,
} ) ( ) ,
} ,
} ,
@ -416,6 +417,7 @@ var watchIPNArgs struct {
netmap bool
netmap bool
initial bool
initial bool
showPrivateKey bool
showPrivateKey bool
count int
}
}
func runWatchIPN ( ctx context . Context , args [ ] string ) error {
func runWatchIPN ( ctx context . Context , args [ ] string ) error {
@ -431,8 +433,8 @@ func runWatchIPN(ctx context.Context, args []string) error {
return err
return err
}
}
defer watcher . Close ( )
defer watcher . Close ( )
printf( "Connected.\n" )
fmt . F printf( os . Stderr , "Connected.\n" )
for {
for seen := 0 ; watchIPNArgs . count == 0 || seen < watchIPNArgs . count ; seen ++ {
n , err := watcher . Next ( )
n , err := watcher . Next ( )
if err != nil {
if err != nil {
return err
return err
@ -441,8 +443,9 @@ func runWatchIPN(ctx context.Context, args []string) error {
n . NetMap = nil
n . NetMap = nil
}
}
j , _ := json . MarshalIndent ( n , "" , "\t" )
j , _ := json . MarshalIndent ( n , "" , "\t" )
p rintf( "%s\n" , j )
fmt . P rintf( "%s\n" , j )
}
}
return nil
}
}
func runDERPMap ( ctx context . Context , args [ ] string ) error {
func runDERPMap ( ctx context . Context , args [ ] string ) error {