From e28378012076c5960185471710b9c3a48a222b09 Mon Sep 17 00:00:00 2001 From: Chengcheng Zhang <943420582@qq.com> Date: Sat, 13 Jul 2019 14:43:57 +0800 Subject: [PATCH] rename vapord (#277) --- cmd/vaporcli/commands/transaction.go | 2 +- cmd/vaporcli/commands/{bytomcli.go => vaporcli.go} | 156 ++++++++++----------- cmd/vaporcli/commands/version.go | 4 +- cmd/vapord/commands/root.go | 2 +- cmd/vapord/commands/run_node.go | 4 +- docs/Running-in-Docker.md | 4 +- netsync/sync_manager.go | 2 +- node/node.go | 2 +- p2p/discover/mdns/mdns.go | 2 +- p2p/listener.go | 6 +- p2p/node_info_test.go | 2 +- util/util.go | 8 +- version/version.go | 2 +- 13 files changed, 98 insertions(+), 98 deletions(-) rename cmd/vaporcli/commands/{bytomcli.go => vaporcli.go} (56%) diff --git a/cmd/vaporcli/commands/transaction.go b/cmd/vaporcli/commands/transaction.go index 2b570d48..308ab944 100644 --- a/cmd/vaporcli/commands/transaction.go +++ b/cmd/vaporcli/commands/transaction.go @@ -153,7 +153,7 @@ var buildTransactionCmd = &cobra.Command{ buildReqStr = fmt.Sprintf(buildControlAddressReqFmt, btmGas, accountInfo, assetInfo, amount, accountInfo, assetInfo, amount, address) case "unlock": var err error - usage := "Usage:\n bytomcli build-transaction -c " + usage := "Usage:\n vaporcli build-transaction -c " baseCount := 4 if len(args) < baseCount { jww.ERROR.Printf("%s ... [flags]\n\n", usage) diff --git a/cmd/vaporcli/commands/bytomcli.go b/cmd/vaporcli/commands/vaporcli.go similarity index 56% rename from cmd/vaporcli/commands/bytomcli.go rename to cmd/vaporcli/commands/vaporcli.go index 7beffd16..d90427a1 100644 --- a/cmd/vaporcli/commands/bytomcli.go +++ b/cmd/vaporcli/commands/vaporcli.go @@ -10,7 +10,7 @@ import ( "github.com/vapor/util" ) -// bytomcli usage template +// vaporcli usage template var usageTemplate = `Usage:{{if .Runnable}} {{.UseLine}}{{end}}{{if .HasAvailableSubCommands}} {{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}} @@ -80,11 +80,11 @@ func isUserError(err error) bool { return userErrorRegexp.MatchString(err.Error()) } -// BytomcliCmd is Bytomcli's root command. -// Every other command attached to BytomcliCmd is a child command to it. -var BytomcliCmd = &cobra.Command{ - Use: "bytomcli", - Short: "Bytomcli is a commond line client for bytom core (a.k.a. bytomd)", +// VaporCmd is Vaporcli's root command. +// Every other command attached to VaporcliCmd is a child command to it. +var VaporcliCmd = &cobra.Command{ + Use: "vaporcli", + Short: "Vaporcli is a commond line client for vapor (a.k.a. vapord)", Run: func(cmd *cobra.Command, args []string) { if len(args) < 1 { cmd.SetUsageTemplate(usageTemplate) @@ -93,90 +93,90 @@ var BytomcliCmd = &cobra.Command{ }, } -// Execute adds all child commands to the root command BytomcliCmd and sets flags appropriately. +// Execute adds all child commands to the root command VaporcliCmd and sets flags appropriately. func Execute() { AddCommands() AddTemplateFunc() - if _, err := BytomcliCmd.ExecuteC(); err != nil { + if _, err := VaporcliCmd.ExecuteC(); err != nil { os.Exit(util.ErrLocalExe) } } -// AddCommands adds child commands to the root command BytomcliCmd. +// AddCommands adds child commands to the root command VaporcliCmd. func AddCommands() { - BytomcliCmd.AddCommand(createAccessTokenCmd) - BytomcliCmd.AddCommand(listAccessTokenCmd) - BytomcliCmd.AddCommand(deleteAccessTokenCmd) - BytomcliCmd.AddCommand(checkAccessTokenCmd) - - BytomcliCmd.AddCommand(createAccountCmd) - BytomcliCmd.AddCommand(deleteAccountCmd) - BytomcliCmd.AddCommand(listAccountsCmd) - BytomcliCmd.AddCommand(updateAccountAliasCmd) - BytomcliCmd.AddCommand(createAccountReceiverCmd) - BytomcliCmd.AddCommand(listAddressesCmd) - BytomcliCmd.AddCommand(validateAddressCmd) - BytomcliCmd.AddCommand(listPubKeysCmd) - - BytomcliCmd.AddCommand(createAssetCmd) - BytomcliCmd.AddCommand(getAssetCmd) - BytomcliCmd.AddCommand(listAssetsCmd) - BytomcliCmd.AddCommand(updateAssetAliasCmd) - - BytomcliCmd.AddCommand(getTransactionCmd) - BytomcliCmd.AddCommand(listTransactionsCmd) - - BytomcliCmd.AddCommand(getUnconfirmedTransactionCmd) - BytomcliCmd.AddCommand(listUnconfirmedTransactionsCmd) - BytomcliCmd.AddCommand(decodeRawTransactionCmd) - - BytomcliCmd.AddCommand(listUnspentOutputsCmd) - BytomcliCmd.AddCommand(listBalancesCmd) - - BytomcliCmd.AddCommand(rescanWalletCmd) - BytomcliCmd.AddCommand(walletInfoCmd) - - BytomcliCmd.AddCommand(buildTransactionCmd) - BytomcliCmd.AddCommand(signTransactionCmd) - BytomcliCmd.AddCommand(submitTransactionCmd) - BytomcliCmd.AddCommand(estimateTransactionGasCmd) - - BytomcliCmd.AddCommand(getBlockCountCmd) - BytomcliCmd.AddCommand(getBlockHashCmd) - BytomcliCmd.AddCommand(getBlockCmd) - BytomcliCmd.AddCommand(getBlockHeaderCmd) - BytomcliCmd.AddCommand(getDifficultyCmd) - BytomcliCmd.AddCommand(getHashRateCmd) - - BytomcliCmd.AddCommand(createKeyCmd) - BytomcliCmd.AddCommand(deleteKeyCmd) - BytomcliCmd.AddCommand(listKeysCmd) - BytomcliCmd.AddCommand(updateKeyAliasCmd) - BytomcliCmd.AddCommand(resetKeyPwdCmd) - BytomcliCmd.AddCommand(checkKeyPwdCmd) - - BytomcliCmd.AddCommand(signMsgCmd) - BytomcliCmd.AddCommand(verifyMsgCmd) - BytomcliCmd.AddCommand(decodeProgCmd) - - BytomcliCmd.AddCommand(createTransactionFeedCmd) - BytomcliCmd.AddCommand(listTransactionFeedsCmd) - BytomcliCmd.AddCommand(deleteTransactionFeedCmd) - BytomcliCmd.AddCommand(getTransactionFeedCmd) - BytomcliCmd.AddCommand(updateTransactionFeedCmd) - - BytomcliCmd.AddCommand(isMiningCmd) - BytomcliCmd.AddCommand(setMiningCmd) - - BytomcliCmd.AddCommand(netInfoCmd) - BytomcliCmd.AddCommand(gasRateCmd) - - BytomcliCmd.AddCommand(versionCmd) + VaporcliCmd.AddCommand(createAccessTokenCmd) + VaporcliCmd.AddCommand(listAccessTokenCmd) + VaporcliCmd.AddCommand(deleteAccessTokenCmd) + VaporcliCmd.AddCommand(checkAccessTokenCmd) + + VaporcliCmd.AddCommand(createAccountCmd) + VaporcliCmd.AddCommand(deleteAccountCmd) + VaporcliCmd.AddCommand(listAccountsCmd) + VaporcliCmd.AddCommand(updateAccountAliasCmd) + VaporcliCmd.AddCommand(createAccountReceiverCmd) + VaporcliCmd.AddCommand(listAddressesCmd) + VaporcliCmd.AddCommand(validateAddressCmd) + VaporcliCmd.AddCommand(listPubKeysCmd) + + VaporcliCmd.AddCommand(createAssetCmd) + VaporcliCmd.AddCommand(getAssetCmd) + VaporcliCmd.AddCommand(listAssetsCmd) + VaporcliCmd.AddCommand(updateAssetAliasCmd) + + VaporcliCmd.AddCommand(getTransactionCmd) + VaporcliCmd.AddCommand(listTransactionsCmd) + + VaporcliCmd.AddCommand(getUnconfirmedTransactionCmd) + VaporcliCmd.AddCommand(listUnconfirmedTransactionsCmd) + VaporcliCmd.AddCommand(decodeRawTransactionCmd) + + VaporcliCmd.AddCommand(listUnspentOutputsCmd) + VaporcliCmd.AddCommand(listBalancesCmd) + + VaporcliCmd.AddCommand(rescanWalletCmd) + VaporcliCmd.AddCommand(walletInfoCmd) + + VaporcliCmd.AddCommand(buildTransactionCmd) + VaporcliCmd.AddCommand(signTransactionCmd) + VaporcliCmd.AddCommand(submitTransactionCmd) + VaporcliCmd.AddCommand(estimateTransactionGasCmd) + + VaporcliCmd.AddCommand(getBlockCountCmd) + VaporcliCmd.AddCommand(getBlockHashCmd) + VaporcliCmd.AddCommand(getBlockCmd) + VaporcliCmd.AddCommand(getBlockHeaderCmd) + VaporcliCmd.AddCommand(getDifficultyCmd) + VaporcliCmd.AddCommand(getHashRateCmd) + + VaporcliCmd.AddCommand(createKeyCmd) + VaporcliCmd.AddCommand(deleteKeyCmd) + VaporcliCmd.AddCommand(listKeysCmd) + VaporcliCmd.AddCommand(updateKeyAliasCmd) + VaporcliCmd.AddCommand(resetKeyPwdCmd) + VaporcliCmd.AddCommand(checkKeyPwdCmd) + + VaporcliCmd.AddCommand(signMsgCmd) + VaporcliCmd.AddCommand(verifyMsgCmd) + VaporcliCmd.AddCommand(decodeProgCmd) + + VaporcliCmd.AddCommand(createTransactionFeedCmd) + VaporcliCmd.AddCommand(listTransactionFeedsCmd) + VaporcliCmd.AddCommand(deleteTransactionFeedCmd) + VaporcliCmd.AddCommand(getTransactionFeedCmd) + VaporcliCmd.AddCommand(updateTransactionFeedCmd) + + VaporcliCmd.AddCommand(isMiningCmd) + VaporcliCmd.AddCommand(setMiningCmd) + + VaporcliCmd.AddCommand(netInfoCmd) + VaporcliCmd.AddCommand(gasRateCmd) + + VaporcliCmd.AddCommand(versionCmd) } -// AddTemplateFunc adds usage template to the root command BytomcliCmd. +// AddTemplateFunc adds usage template to the root command VaporcliCmd. func AddTemplateFunc() { walletEnableCmd := []string{ createAccountCmd.Name(), diff --git a/cmd/vaporcli/commands/version.go b/cmd/vaporcli/commands/version.go index 5bfa3fd5..9ce75851 100644 --- a/cmd/vaporcli/commands/version.go +++ b/cmd/vaporcli/commands/version.go @@ -11,8 +11,8 @@ import ( var versionCmd = &cobra.Command{ Use: "version", - Short: "Print the version number of Bytomcli", + Short: "Print the version number of vaporcli", Run: func(cmd *cobra.Command, args []string) { - jww.FEEDBACK.Printf("Bytomcli v%s %s/%s\n", version.Version, runtime.GOOS, runtime.GOARCH) + jww.FEEDBACK.Printf("vaporcli v%s %s/%s\n", version.Version, runtime.GOOS, runtime.GOARCH) }, } diff --git a/cmd/vapord/commands/root.go b/cmd/vapord/commands/root.go index dc43b08d..6f75655e 100644 --- a/cmd/vapord/commands/root.go +++ b/cmd/vapord/commands/root.go @@ -16,7 +16,7 @@ var ( ) var RootCmd = &cobra.Command{ - Use: "bytomd", + Use: "vapord", Short: "Multiple asset management.", PersistentPreRunE: func(cmd *cobra.Command, args []string) error { err := viper.Unmarshal(config) diff --git a/cmd/vapord/commands/run_node.go b/cmd/vapord/commands/run_node.go index fb841663..8df7f00a 100644 --- a/cmd/vapord/commands/run_node.go +++ b/cmd/vapord/commands/run_node.go @@ -14,12 +14,12 @@ const logModule = "cmd" var runNodeCmd = &cobra.Command{ Use: "node", - Short: "Run the bytomd", + Short: "Run the vapord", RunE: runNode, } func init() { - runNodeCmd.Flags().String("prof_laddr", config.ProfListenAddress, "Use http to profile bytomd programs") + runNodeCmd.Flags().String("prof_laddr", config.ProfListenAddress, "Use http to profile vapord programs") runNodeCmd.Flags().Bool("mining", config.Mining, "Enable mining") runNodeCmd.Flags().Bool("auth.disable", config.Auth.Disable, "Disable rpc access authenticate") diff --git a/docs/Running-in-Docker.md b/docs/Running-in-Docker.md index 580e39cd..2340f77f 100644 --- a/docs/Running-in-Docker.md +++ b/docs/Running-in-Docker.md @@ -18,7 +18,7 @@ vapor data directory has three config files: - `federation.json` - `node_key.txt` -Then you can use bytomd and bytomcli following [Bytom Wiki](https://github.com/Bytom/bytom/wiki/Command-Line-Options). +Then you can use bytomd and vaporcli following [Bytom Wiki](https://github.com/Bytom/bytom/wiki/Command-Line-Options). Use `exit` to exit Docker's iterative mode. @@ -45,7 +45,7 @@ $ docker ps __To execute a command inside a containner, for example:__ ```bash -$ docker exec -it bytomcli create-access-token +$ docker exec -it vaporcli create-access-token ``` __To stop a running containner:__ diff --git a/netsync/sync_manager.go b/netsync/sync_manager.go index 2451749e..95ffbb48 100644 --- a/netsync/sync_manager.go +++ b/netsync/sync_manager.go @@ -101,7 +101,7 @@ func (sm *SyncManager) Stop() { } -// IsListening check if the bytomd service port is open? +// IsListening check if the vapord service port is open? func (sm *SyncManager) IsListening() bool { if sm.config.VaultMode { return false diff --git a/node/node.go b/node/node.go index d4c7fd58..69948239 100644 --- a/node/node.go +++ b/node/node.go @@ -135,7 +135,7 @@ func NewNode(config *cfg.Config) *Node { // run the profile server profileHost := config.ProfListenAddress if profileHost != "" { - // Profiling bytomd programs.see (https://blog.golang.org/profiling-go-programs) + // Profiling vapord programs.see (https://blog.golang.org/profiling-go-programs) // go tool pprof http://profileHose/debug/pprof/heap go func() { if err = http.ListenAndServe(profileHost, nil); err != nil { diff --git a/p2p/discover/mdns/mdns.go b/p2p/discover/mdns/mdns.go index c061be9f..2c9ca7b0 100644 --- a/p2p/discover/mdns/mdns.go +++ b/p2p/discover/mdns/mdns.go @@ -7,7 +7,7 @@ import ( ) const ( - instanceName = "bytomd" + instanceName = "vapord" serviceName = "lanDiscover" domainName = "local" ) diff --git a/p2p/listener.go b/p2p/listener.go index fcd9df09..2c3e92ef 100644 --- a/p2p/listener.go +++ b/p2p/listener.go @@ -70,11 +70,11 @@ func getUPNPExternalAddress(externalPort, internalPort int) (*NetAddress, error) if externalPort == 0 { externalPort = defaultExternalPort } - externalPort, err = nat.AddPortMapping("tcp", externalPort, internalPort, "bytomd tcp", 0) + externalPort, err = nat.AddPortMapping("tcp", externalPort, internalPort, "vapord tcp", 0) if err != nil { return nil, errors.Wrap(err, "could not add tcp UPNP port mapping") } - externalPort, err = nat.AddPortMapping("udp", externalPort, internalPort, "bytomd udp", 0) + externalPort, err = nat.AddPortMapping("udp", externalPort, internalPort, "vapord udp", 0) if err != nil { return nil, errors.Wrap(err, "could not add udp UPNP port mapping") } @@ -93,7 +93,7 @@ func splitHostPort(addr string) (host string, port int) { return host, port } -//DefaultListener Implements bytomd server Listener +//DefaultListener Implements vapord server Listener type DefaultListener struct { cmn.BaseService diff --git a/p2p/node_info_test.go b/p2p/node_info_test.go index 6e1c4b79..0f3e5be5 100644 --- a/p2p/node_info_test.go +++ b/p2p/node_info_test.go @@ -47,7 +47,7 @@ func TestNodeInfoWriteRead(t *testing.T) { if err != nil { t.Fatal("create pubkey err.", err) } - nodeInfo := &NodeInfo{PubKey: pubKey.String(), Moniker: "bytomd", Network: "mainnet", NetworkID: 0x888, RemoteAddr: "127.0.0.2:0", ListenAddr: "127.0.0.1:0", Version: "1.1.0-test", ServiceFlag: 10, Other: []string{"abc", "bcd"}} + nodeInfo := &NodeInfo{PubKey: pubKey.String(), Moniker: "vapord", Network: "mainnet", NetworkID: 0x888, RemoteAddr: "127.0.0.2:0", ListenAddr: "127.0.0.1:0", Version: "1.1.0-test", ServiceFlag: 10, Other: []string{"abc", "bcd"}} n, err1, err2 := new(int), new(error), new(error) buf := new(bytes.Buffer) diff --git a/util/util.go b/util/util.go index f7e06fa1..e77696b0 100644 --- a/util/util.go +++ b/util/util.go @@ -14,12 +14,12 @@ const ( Success = iota // ErrLocalExe indicates error occurs before the rpc calling. ErrLocalExe - // ErrConnect indicates error occurs connecting to the bytomd, e.g., - // bytomd can't parse the received arguments. + // ErrConnect indicates error occurs connecting to the vapord, e.g., + // vapord can't parse the received arguments. ErrConnect // ErrLocalParse indicates error occurs locally when parsing the response. ErrLocalParse - // ErrRemote indicates error occurs in bytomd. + // ErrRemote indicates error occurs in vapord. ErrRemote ) @@ -51,7 +51,7 @@ func ClientCall(path string, req ...interface{}) (interface{}, int) { jww.ERROR.Println(response.Msg) return nil, ErrRemote case "": - jww.ERROR.Println("Unable to connect to the bytomd") + jww.ERROR.Println("Unable to connect to the vapord") return nil, ErrConnect } diff --git a/version/version.go b/version/version.go index 31e2e917..1ed6743d 100644 --- a/version/version.go +++ b/version/version.go @@ -127,7 +127,7 @@ func (s *UpdateStatus) CheckUpdate(localVerStr string, remoteVerStr string, remo "Current version": localVerStr, "Newer version": remoteVerStr, "seed": remoteAddr, - }).Warn("Please update your bytomd via https://github.com/Bytom/bytom/releases/ or http://bytom.io/wallet/") + }).Warn("Please update your vapord via https://github.com/Bytom/bytom/releases/ or http://bytom.io/wallet/") s.notified = true } return nil -- 2.11.0