Merge pull request #8955 from filecoin-project/feat/disconnect-cmd
chore:networking:disconnect cmd
This commit is contained in:
commit
2daefe57bf
32
cli/net.go
32
cli/net.go
@ -34,6 +34,7 @@ var NetCmd = &cli.Command{
|
|||||||
NetPeers,
|
NetPeers,
|
||||||
NetPing,
|
NetPing,
|
||||||
NetConnect,
|
NetConnect,
|
||||||
|
NetDisconnect,
|
||||||
NetListen,
|
NetListen,
|
||||||
NetId,
|
NetId,
|
||||||
NetFindPeer,
|
NetFindPeer,
|
||||||
@ -261,6 +262,37 @@ var NetListen = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var NetDisconnect = &cli.Command{
|
||||||
|
Name: "disconnect",
|
||||||
|
Usage: "Disconnect from a peer",
|
||||||
|
ArgsUsage: "[peerID]",
|
||||||
|
Action: func(cctx *cli.Context) error {
|
||||||
|
api, closer, err := GetAPI(cctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer closer()
|
||||||
|
ctx := ReqContext(cctx)
|
||||||
|
|
||||||
|
ids := cctx.Args().Slice()
|
||||||
|
for _, id := range ids {
|
||||||
|
pid, err := peer.Decode(id)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("failure")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Printf("disconnect %s: ", pid.Pretty())
|
||||||
|
err = api.NetDisconnect(ctx, pid)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("failure")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Println("success")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
var NetConnect = &cli.Command{
|
var NetConnect = &cli.Command{
|
||||||
Name: "connect",
|
Name: "connect",
|
||||||
Usage: "Connect to a peer",
|
Usage: "Connect to a peer",
|
||||||
|
@ -1168,6 +1168,7 @@ COMMANDS:
|
|||||||
peers Print peers
|
peers Print peers
|
||||||
ping Ping peers
|
ping Ping peers
|
||||||
connect Connect to a peer
|
connect Connect to a peer
|
||||||
|
disconnect Disconnect from a peer
|
||||||
listen List listen addresses
|
listen List listen addresses
|
||||||
id Get node identity
|
id Get node identity
|
||||||
find-peer, findpeer Find the addresses of a given peerID
|
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] [peerID]
|
||||||
|
|
||||||
|
OPTIONS:
|
||||||
|
--help, -h show help (default: false)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
### lotus-miner net listen
|
### lotus-miner net listen
|
||||||
```
|
```
|
||||||
NAME:
|
NAME:
|
||||||
|
@ -2485,6 +2485,7 @@ COMMANDS:
|
|||||||
peers Print peers
|
peers Print peers
|
||||||
ping Ping peers
|
ping Ping peers
|
||||||
connect Connect to a peer
|
connect Connect to a peer
|
||||||
|
disconnect Disconnect from a peer
|
||||||
listen List listen addresses
|
listen List listen addresses
|
||||||
id Get node identity
|
id Get node identity
|
||||||
find-peer, findpeer Find the addresses of a given peerID
|
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] [peerID]
|
||||||
|
|
||||||
|
OPTIONS:
|
||||||
|
--help, -h show help (default: false)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
### lotus net listen
|
### lotus net listen
|
||||||
```
|
```
|
||||||
NAME:
|
NAME:
|
||||||
|
Loading…
Reference in New Issue
Block a user