net disconnect

This commit is contained in:
zenground0 2022-07-01 12:25:50 -05:00
parent d1e325a3bb
commit ef5bbde160
3 changed files with 58 additions and 0 deletions

View File

@ -34,6 +34,7 @@ var NetCmd = &cli.Command{
NetPeers,
NetPing,
NetConnect,
NetDisconnect,
NetListen,
NetId,
NetFindPeer,
@ -261,6 +262,35 @@ var NetListen = &cli.Command{
},
}
var NetDisconnect = &cli.Command{
Name: "disconnect",
Usage: "Disconnect from a peer",
ArgsUsage: "[peerMultiaddr|minerActorAddress]",
Action: func(cctx *cli.Context) error {
api, closer, err := GetAPI(cctx)
if err != nil {
return err
}
defer closer()
ctx := ReqContext(cctx)
pis, err := AddrInfoFromArg(ctx, cctx)
if err != nil {
return err
}
for _, pi := range pis {
fmt.Printf("disconnect %s: ", pi.ID.Pretty())
err := api.NetDisconnect(ctx, pi.ID)
if err != nil {
fmt.Println("failure")
return err
}
fmt.Println("success")
}
return nil
},
}
var NetConnect = &cli.Command{
Name: "connect",
Usage: "Connect to a peer",

View File

@ -1168,6 +1168,7 @@ COMMANDS:
peers Print peers
ping Ping peers
connect Connect to a peer
disconnect Disconnect from a peer
listen List listen addresses
id Get node identity
find-peer, findpeer Find the addresses of a given peerID
@ -1228,6 +1229,19 @@ OPTIONS:
```
### lotus-miner net disconnect
```
NAME:
lotus-miner net disconnect - Disconnect from a peer
USAGE:
lotus-miner net disconnect [command options] [peerMultiaddr|minerActorAddress]
OPTIONS:
--help, -h show help (default: false)
```
### lotus-miner net listen
```
NAME:

View File

@ -2485,6 +2485,7 @@ COMMANDS:
peers Print peers
ping Ping peers
connect Connect to a peer
disconnect Disconnect from a peer
listen List listen addresses
id Get node identity
find-peer, findpeer Find the addresses of a given peerID
@ -2545,6 +2546,19 @@ OPTIONS:
```
### lotus net disconnect
```
NAME:
lotus net disconnect - Disconnect from a peer
USAGE:
lotus net disconnect [command options] [peerMultiaddr|minerActorAddress]
OPTIONS:
--help, -h show help (default: false)
```
### lotus net listen
```
NAME: