Makes protocol version a little clearer.

This commit is contained in:
James Phillips 2016-08-17 11:29:09 -07:00
parent 9d154a55ad
commit bedd0c5a9e
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
2 changed files with 14 additions and 5 deletions

View File

@ -2,6 +2,7 @@ package command
import ( import (
"fmt" "fmt"
"github.com/hashicorp/consul/command/agent"
"github.com/hashicorp/consul/consul" "github.com/hashicorp/consul/consul"
"github.com/mitchellh/cli" "github.com/mitchellh/cli"
) )
@ -18,8 +19,16 @@ func (c *VersionCommand) Help() string {
func (c *VersionCommand) Run(_ []string) int { func (c *VersionCommand) Run(_ []string) int {
c.Ui.Output(fmt.Sprintf("Consul Version: %s", c.HumanVersion)) c.Ui.Output(fmt.Sprintf("Consul Version: %s", c.HumanVersion))
c.Ui.Output(fmt.Sprintf("Supported Protocol Version(s): %d to %d",
consul.ProtocolVersionMin, consul.ProtocolVersionMax)) config := agent.DefaultConfig()
var supplement string
if config.Protocol < consul.ProtocolVersionMax {
supplement = fmt.Sprintf(" (agent will automatically use protocol >%d when speaking to compatible agents)",
config.Protocol)
}
c.Ui.Output(fmt.Sprintf("Protocol Version: speaks %d by default, understands %d to %d%s",
config.Protocol, consul.ProtocolVersionMin, consul.ProtocolVersionMax, supplement))
return 0 return 0
} }

View File

@ -73,12 +73,12 @@ running `consul -v`. You'll see output similar to that below:
``` ```
$ consul -v $ consul -v
Consul v0.7.0 Consul Version: v0.7.0
Supported Protocol Version(s): 2 to 3 Protocol Version: speaks 2 by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
``` ```
This says the version of Consul as well as the protocol versions this This says the version of Consul as well as the protocol versions this
agent can understand. agent speaks and can understand.
Note that sometimes Consul will default to speak a lower protocol version Note that sometimes Consul will default to speak a lower protocol version
than it understands, in order to ease compatibility with older agents. For than it understands, in order to ease compatibility with older agents. For