Documentation ¶
Index ¶
- Constants
- Variables
- func ComputeStateHTMLTempl(w io.Writer, ts *types.TipSet, o *api.ComputeStateOutput, ...) error
- func DaemonContext(cctx *cli.Context) context.Context
- func EncodedString(sv *paych.SignedVoucher) (string, error)
- func GetAPI(ctx *cli.Context) (api.Common, jsonrpc.ClientCloser, error)
- func GetCidEncoder(cctx *cli.Context) (cidenc.Encoder, error)
- func GetFullNodeAPI(ctx *cli.Context) (api.FullNode, jsonrpc.ClientCloser, error)
- func GetMultisigPending(ctx context.Context, lapi api.FullNode, hroot cid.Cid) (map[int64]*samsig.Transaction, error)
- func GetRawAPI(ctx *cli.Context, t repo.RepoType) (string, http.Header, error)
- func GetStorageMinerAPI(ctx *cli.Context, opts ...jsonrpc.Option) (api.StorageMiner, jsonrpc.ClientCloser, error)
- func GetWorkerAPI(ctx *cli.Context) (api.WorkerAPI, jsonrpc.ClientCloser, error)
- func LoadTipSet(ctx context.Context, cctx *cli.Context, api api.FullNode) (*types.TipSet, error)
- func NewCliError(s string) error
- func OutputDataTransferChannels(out io.Writer, channels []lapi.DataTransferChannel, completed bool, color bool)
- func ParseTipSetRef(ctx context.Context, api api.FullNode, tss string) (*types.TipSet, error)
- func ReqContext(cctx *cli.Context) context.Context
- func RunApp(app *cli.App)
- func ShowHelp(cctx *cli.Context, err error) error
- func SyncWait(ctx context.Context, napi api.FullNode) error
- func WithCategory(cat string, cmd *cli.Command) *cli.Command
- type APIInfo
- type ApiConnector
- type ErrCmdFailed
- type PrintHelpErr
Constants ¶
View Source
const DefaultMaxRetrievePrice = 1
Variables ¶
View Source
var CidBaseFlag = cli.StringFlag{ Name: "cid-base", Hidden: true, Value: "base32", Usage: "Multibase encoding used for version 1 CIDs in output.", DefaultText: "base32", }
View Source
var Commands = []*cli.Command{ WithCategory("basic", sendCmd), WithCategory("basic", walletCmd), WithCategory("basic", clientCmd), WithCategory("basic", multisigCmd), WithCategory("basic", paychCmd), WithCategory("developer", authCmd), WithCategory("developer", mpoolCmd), WithCategory("developer", stateCmd), WithCategory("developer", chainCmd), WithCategory("developer", logCmd), WithCategory("developer", waitApiCmd), WithCategory("developer", fetchParamCmd), WithCategory("network", netCmd), WithCategory("network", syncCmd), pprofCmd, VersionCmd, }
View Source
var CommonCommands = []*cli.Command{ netCmd, authCmd, logCmd, waitApiCmd, fetchParamCmd, pprofCmd, VersionCmd, }
View Source
var NetBandwidthCmd = &cli.Command{ Name: "bandwidth", Usage: "Print bandwidth usage information", Flags: []cli.Flag{ &cli.BoolFlag{ Name: "by-peer", Usage: "list bandwidth usage by peer", }, &cli.BoolFlag{ Name: "by-protocol", Usage: "list bandwidth usage by protocol", }, }, Action: func(cctx *cli.Context) error { api, closer, err := GetAPI(cctx) if err != nil { return err } defer closer() ctx := ReqContext(cctx) bypeer := cctx.Bool("by-peer") byproto := cctx.Bool("by-protocol") tw := tabwriter.NewWriter(os.Stdout, 4, 4, 2, ' ', 0) fmt.Fprintf(tw, "Segment\tTotalIn\tTotalOut\tRateIn\tRateOut\n") if bypeer { bw, err := api.NetBandwidthStatsByPeer(ctx) if err != nil { return err } var peers []string for p := range bw { peers = append(peers, p) } sort.Slice(peers, func(i, j int) bool { return peers[i] < peers[j] }) for _, p := range peers { s := bw[p] fmt.Fprintf(tw, "%s\t%s\t%s\t%s/s\t%s/s\n", p, humanize.Bytes(uint64(s.TotalIn)), humanize.Bytes(uint64(s.TotalOut)), humanize.Bytes(uint64(s.RateIn)), humanize.Bytes(uint64(s.RateOut))) } } else if byproto { bw, err := api.NetBandwidthStatsByProtocol(ctx) if err != nil { return err } var protos []protocol.ID for p := range bw { protos = append(protos, p) } sort.Slice(protos, func(i, j int) bool { return protos[i] < protos[j] }) for _, p := range protos { s := bw[p] if p == "" { p = "<unknown>" } fmt.Fprintf(tw, "%s\t%s\t%s\t%s/s\t%s/s\n", p, humanize.Bytes(uint64(s.TotalIn)), humanize.Bytes(uint64(s.TotalOut)), humanize.Bytes(uint64(s.RateIn)), humanize.Bytes(uint64(s.RateOut))) } } else { s, err := api.NetBandwidthStats(ctx) if err != nil { return err } fmt.Fprintf(tw, "Total\t%s\t%s\t%s/s\t%s/s\n", humanize.Bytes(uint64(s.TotalIn)), humanize.Bytes(uint64(s.TotalOut)), humanize.Bytes(uint64(s.RateIn)), humanize.Bytes(uint64(s.RateOut))) } return tw.Flush() }, }
View Source
var NetId = &cli.Command{ Name: "id", Usage: "Get node identity", Action: func(cctx *cli.Context) error { api, closer, err := GetAPI(cctx) if err != nil { return err } defer closer() ctx := ReqContext(cctx) pid, err := api.ID(ctx) if err != nil { return err } fmt.Println(pid) return nil }, }
View Source
var NetListen = &cli.Command{ Name: "listen", Usage: "List listen addresses", Action: func(cctx *cli.Context) error { api, closer, err := GetAPI(cctx) if err != nil { return err } defer closer() ctx := ReqContext(cctx) addrs, err := api.NetAddrsListen(ctx) if err != nil { return err } for _, peer := range addrs.Addrs { fmt.Printf("%s/p2p/%s\n", peer, addrs.ID) } return nil }, }
View Source
var NetPeers = &cli.Command{ Name: "peers", Usage: "Print peers", Flags: []cli.Flag{ &cli.BoolFlag{ Name: "agent", Aliases: []string{"a"}, Usage: "Print agent name", }, }, Action: func(cctx *cli.Context) error { api, closer, err := GetAPI(cctx) if err != nil { return err } defer closer() ctx := ReqContext(cctx) peers, err := api.NetPeers(ctx) if err != nil { return err } sort.Slice(peers, func(i, j int) bool { return strings.Compare(string(peers[i].ID), string(peers[j].ID)) > 0 }) for _, peer := range peers { var agent string if cctx.Bool("agent") { agent, err = api.NetAgentVersion(ctx, peer.ID) if err != nil { log.Warnf("getting agent version: %s", err) } else { agent = ", " + agent } } fmt.Printf("%s, %s%s\n", peer.ID, peer.Addrs, agent) } return nil }, }
View Source
var NetReachability = &cli.Command{ Name: "reachability", Usage: "Print information about reachability from the internet", Action: func(cctx *cli.Context) error { api, closer, err := GetAPI(cctx) if err != nil { return err } defer closer() ctx := ReqContext(cctx) i, err := api.NetAutoNatStatus(ctx) if err != nil { return err } fmt.Println("AutoNAT status: ", i.Reachability.String()) if i.PublicAddr != "" { fmt.Println("Public address: ", i.PublicAddr) } return nil }, }
View Source
var PprofGoroutines = &cli.Command{ Name: "goroutines", Usage: "Get goroutine stacks", Action: func(cctx *cli.Context) error { ti, ok := cctx.App.Metadata["repoType"] if !ok { log.Errorf("unknown repo type, are you sure you want to use GetAPI?") ti = repo.FullNode } t, ok := ti.(repo.RepoType) if !ok { log.Errorf("repoType type does not match the type of repo.RepoType") } ainfo, err := GetAPIInfo(cctx, t) if err != nil { return xerrors.Errorf("could not get API info: %w", err) } _, addr, err := manet.DialArgs(ainfo.Addr) if err != nil { return err } addr = "http://" + addr + "/debug/pprof/goroutine?debug=2" r, err := http.Get(addr) if err != nil { return err } if _, err := io.Copy(os.Stdout, r.Body); err != nil { return err } return r.Body.Close() }, }
View Source
var VersionCmd = &cli.Command{ Name: "version", Usage: "Print version", Action: func(cctx *cli.Context) error { api, closer, err := GetAPI(cctx) if err != nil { return err } defer closer() ctx := ReqContext(cctx) v, err := api.Version(ctx) if err != nil { return err } fmt.Println("Daemon: ", v) fmt.Print("Local: ") cli.VersionPrinter(cctx) return nil }, }
Functions ¶
func ComputeStateHTMLTempl ¶ added in v0.5.0
func DaemonContext ¶
func EncodedString ¶ added in v0.3.0
func EncodedString(sv *paych.SignedVoucher) (string, error)
func GetCidEncoder ¶ added in v0.4.0
GetCidEncoder returns an encoder using the `cid-base` flag if provided, or the default (Base32) encoder if not.
func GetFullNodeAPI ¶
func GetMultisigPending ¶ added in v0.3.0
func GetStorageMinerAPI ¶
func GetStorageMinerAPI(ctx *cli.Context, opts ...jsonrpc.Option) (api.StorageMiner, jsonrpc.ClientCloser, error)
func GetWorkerAPI ¶ added in v0.5.7
func LoadTipSet ¶ added in v0.3.0
func NewCliError ¶ added in v0.2.10
func OutputDataTransferChannels ¶ added in v0.5.0
func OutputDataTransferChannels(out io.Writer, channels []lapi.DataTransferChannel, completed bool, color bool)
OutputDataTransferChannels generates table output for a list of channels
func ParseTipSetRef ¶ added in v0.5.0
func ReqContext ¶
ReqContext returns context for cli execution. Calling it for the first time installs SIGTERM handler that will close returned context. Not safe for concurrent execution.
func WithCategory ¶ added in v0.5.0
func WithCategory(cat string, cmd *cli.Command) *cli.Command
Types ¶
type APIInfo ¶
type APIInfo struct { Addr multiaddr.Multiaddr Token []byte }
func (APIInfo) AuthHeader ¶
type ErrCmdFailed ¶ added in v0.2.10
type ErrCmdFailed struct {
// contains filtered or unexported fields
}
func (*ErrCmdFailed) Error ¶ added in v0.2.10
func (e *ErrCmdFailed) Error() string
type PrintHelpErr ¶ added in v0.5.0
type PrintHelpErr struct { Err error Ctx *cli.Context }
func (*PrintHelpErr) Error ¶ added in v0.5.0
func (e *PrintHelpErr) Error() string
func (*PrintHelpErr) Is ¶ added in v0.5.0
func (e *PrintHelpErr) Is(o error) bool
func (*PrintHelpErr) Unwrap ¶ added in v0.5.0
func (e *PrintHelpErr) Unwrap() error
Click to show internal directories.
Click to hide internal directories.