Wire in request context
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
parent
40d9fbd952
commit
66a67b0633
22
cli/net.go
22
cli/net.go
@ -25,9 +25,9 @@ var netCmd = &cli.Command{
|
|||||||
var netPeers = &cli.Command{
|
var netPeers = &cli.Command{
|
||||||
Name: "peers",
|
Name: "peers",
|
||||||
Usage: "Print peers",
|
Usage: "Print peers",
|
||||||
Action: func(ctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
api := getApi(ctx)
|
api := getApi(cctx)
|
||||||
fmt.Println(api.NetPeers(context.Background()))
|
fmt.Println(api.NetPeers(reqContext(cctx)))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
@ -36,9 +36,9 @@ var netPeers = &cli.Command{
|
|||||||
var netListen = &cli.Command{
|
var netListen = &cli.Command{
|
||||||
Name: "listen",
|
Name: "listen",
|
||||||
Usage: "List listen addresses",
|
Usage: "List listen addresses",
|
||||||
Action: func(ctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
api := getApi(ctx)
|
api := getApi(cctx)
|
||||||
fmt.Println(api.NetAddrsListen(context.Background()))
|
fmt.Println(api.NetAddrsListen(reqContext(cctx)))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
@ -47,15 +47,17 @@ var netListen = &cli.Command{
|
|||||||
var netConnect = &cli.Command{
|
var netConnect = &cli.Command{
|
||||||
Name: "connect",
|
Name: "connect",
|
||||||
Usage: "Connect to a peer",
|
Usage: "Connect to a peer",
|
||||||
Action: func(ctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
pis, err := parseAddresses(context.Background(), ctx.Args().Slice())
|
ctx := reqContext(cctx)
|
||||||
|
api := getApi(cctx)
|
||||||
|
|
||||||
|
pis, err := parseAddresses(ctx, cctx.Args().Slice())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
api := getApi(ctx)
|
|
||||||
for _, pi := range pis {
|
for _, pi := range pis {
|
||||||
fmt.Printf("connect %s", pi.ID.Pretty())
|
fmt.Printf("connect %s: ", pi.ID.Pretty())
|
||||||
err := api.NetConnect(context.Background(), pi)
|
err := api.NetConnect(context.Background(), pi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("failure")
|
fmt.Println("failure")
|
||||||
|
Loading…
Reference in New Issue
Block a user