cliutil

package
v1.22.0-rc1-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2023 License: Apache-2.0, MIT Imports: 33 Imported by: 60

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FlagVeryVerbose = &cli.BoolFlag{
	Name:        "vv",
	Usage:       "enables very verbose mode, useful for debugging the CLI",
	Destination: &IsVeryVerbose,
}

FlagVeryVerbose enables very verbose mode, which is useful when debugging the CLI itself. It should be included as a flag on the top-level command (e.g. lotus -vv, lotus-miner -vv).

View Source
var IsVeryVerbose bool

IsVeryVerbose is a global var signalling if the CLI is running in very verbose mode or not (default: false).

Functions

func ApiAddrToUrl added in v1.19.0

func ApiAddrToUrl(apiAddr string) (*url.URL, error)

func ClientExportStream added in v1.19.0

func ClientExportStream(apiAddr string, apiAuth http.Header, eref api.ExportRef, car bool) (io.ReadCloser, error)

func DaemonContext added in v1.5.1

func DaemonContext(cctx *cli.Context) context.Context

func EpochTime added in v1.19.0

func EpochTime(curr, e abi.ChainEpoch) string

func EpochTimeTs added in v1.19.0

func EpochTimeTs(curr, e abi.ChainEpoch, ts *types.TipSet) string

EpochTimeTs is like EpochTime, but also outputs absolute time. `ts` is only used to provide a timestamp at some epoch to calculate time from. It can be a genesis tipset.

Example output: `1944975 (01 Jul 22 08:07 CEST, 10 hours 29 minutes ago)`

func FullNodeProxy added in v1.19.0

func FullNodeProxy[T api.FullNode](ins []T, outstr *api.FullNodeStruct)

func GetCommonAPI added in v1.11.1

func GetCommonAPI(ctx *cli.Context) (api.CommonNet, jsonrpc.ClientCloser, error)

func GetFullNodeAPI added in v1.5.1

func GetFullNodeAPI(ctx *cli.Context) (v0api.FullNode, jsonrpc.ClientCloser, error)

func GetFullNodeAPIV1 added in v1.9.0

func GetFullNodeAPIV1(ctx *cli.Context, opts ...GetFullNodeOption) (v1api.FullNode, jsonrpc.ClientCloser, error)

func GetFullNodeAPIV1Single added in v1.19.0

func GetFullNodeAPIV1Single(ctx *cli.Context) (v1api.FullNode, jsonrpc.ClientCloser, error)

func GetGatewayAPI added in v1.5.1

func GetGatewayAPI(ctx *cli.Context) (api.Gateway, jsonrpc.ClientCloser, error)

func GetGatewayAPIV0 added in v1.9.0

func GetGatewayAPIV0(ctx *cli.Context) (v0api.Gateway, jsonrpc.ClientCloser, error)

func GetMarketsAPI added in v1.11.1

func GetMarketsAPI(ctx *cli.Context) (api.StorageMiner, jsonrpc.ClientCloser, error)

func GetRawAPI added in v1.5.1

func GetRawAPI(ctx *cli.Context, t repo.RepoType, version string) (string, http.Header, error)

func GetStorageMinerAPI added in v1.5.1

func GetStorageMinerAPI(ctx *cli.Context, opts ...GetStorageMinerOption) (api.StorageMiner, jsonrpc.ClientCloser, error)

func GetWorkerAPI added in v1.5.1

func GetWorkerAPI(ctx *cli.Context) (api.Worker, jsonrpc.ClientCloser, error)

func OnSingleNode added in v1.19.0

func OnSingleNode(ctx context.Context) context.Context

Not thread safe

func ReqContext added in v1.5.1

func ReqContext(cctx *cli.Context) context.Context

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 StorageMinerUseHttp added in v1.5.1

func StorageMinerUseHttp(opts *GetStorageMinerOptions)

Types

type APIInfo

type APIInfo struct {
	Addr  string
	Token []byte
}

func GetAPIInfo added in v1.5.1

func GetAPIInfo(ctx *cli.Context, t repo.RepoType) (APIInfo, error)

func GetAPIInfoMulti added in v1.19.0

func GetAPIInfoMulti(ctx *cli.Context, t repo.RepoType) ([]APIInfo, error)

GetAPIInfo returns the API endpoint to use for the specified kind of repo.

The order of precedence is as follows:

  1. *-api-url command line flags.
  2. *_API_INFO environment variables
  3. deprecated *_API_INFO environment variables
  4. *-repo command line flags.

func ParseApiInfo

func ParseApiInfo(s string) APIInfo

func ParseApiInfoMulti added in v1.19.0

func ParseApiInfoMulti(s string) []APIInfo

func (APIInfo) AuthHeader

func (a APIInfo) AuthHeader() http.Header

func (APIInfo) DialArgs

func (a APIInfo) DialArgs(version string) (string, error)

func (APIInfo) Host

func (a APIInfo) Host() (string, error)

type GetFullNodeOption added in v1.20.0

type GetFullNodeOption func(*GetFullNodeOptions)

func FullNodeWithEthSubscribtionHandler added in v1.20.0

func FullNodeWithEthSubscribtionHandler(sh api.EthSubscriber) GetFullNodeOption

type GetFullNodeOptions added in v1.20.0

type GetFullNodeOptions struct {
	// contains filtered or unexported fields
}

type GetStorageMinerOption added in v1.5.1

type GetStorageMinerOption func(*GetStorageMinerOptions)

type GetStorageMinerOptions added in v1.5.1

type GetStorageMinerOptions struct {
	PreferHttp bool
}

type HttpHead added in v1.19.0

type HttpHead struct {
	// contains filtered or unexported fields
}

func GetRawAPIMulti added in v1.19.0

func GetRawAPIMulti(ctx *cli.Context, t repo.RepoType, version string) ([]HttpHead, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL