fix(client): rebase with master

This commit is contained in:
Alexader 2020-12-21 15:36:06 +08:00
parent 615ad396f6
commit 15d1a16f66
3 changed files with 2 additions and 44 deletions

View File

@ -22,7 +22,7 @@ func getValidators(ctx *cli.Context) error {
return err
}
data, err := httpGet(url)
data, err := httpGet(ctx, url)
if err != nil {
return fmt.Errorf("http get: %w", err)
}
@ -69,7 +69,7 @@ func delVPNode(ctx *cli.Context) error {
p := pb.DelVPNodeRequest{Pid: pid}
reqData, err := json.Marshal(p)
data, err := httpPost(url, reqData)
data, err := httpPost(ctx, url, reqData)
if err != nil {
return err
}

View File

@ -1,41 +0,0 @@
package client
import (
"fmt"
"github.com/urfave/cli"
)
func validatorsCMD() cli.Command {
return cli.Command{
Name: "validators",
Usage: "Query validator address",
Action: getValidators,
}
}
func getValidators(ctx *cli.Context) error {
url, err := getURL(ctx, "info?type=2")
if err != nil {
return err
}
data, err := httpGet(ctx, url)
if err != nil {
return fmt.Errorf("http get: %w", err)
}
ret, err := parseResponse(data)
if err != nil {
return err
}
retJson, err := prettyJson(ret)
if err != nil {
return fmt.Errorf("wrong response: %w", err)
}
fmt.Println(retJson)
return nil
}

View File

@ -1 +0,0 @@
http://localhost:9091/v1/