Merge pull request #633 from openziti/release-next

Release 0.25.0
This commit is contained in:
Paul Lorenz
2022-03-07 17:11:07 -05:00
committed by GitHub
14 changed files with 155 additions and 117 deletions
+79 -1
View File
@@ -1,6 +1,84 @@
# Release 0.24.13
# Release 0.25.0
## Breaking Changes
Routers with version 0.25.0 or greater must be used with a controller that is also v0.25 or greater.
Controllers will continue to work with older routers. Router of this version should also continue to interoperate with older routers.
NOTE: You may be used to seeing two links between routers, if they both have link listeners. Starting with v0.25 expect to see only
a single link between routers, unless you use the new link types feature.
## What's New
* Bug fix: Fixed an issue with the ziti CLI quickstart routine which also affected router and controller config generation leaving many config fields blank or incorrect.
* Note: This fix was previously reported to have been fixed in 0.24.13 but the fix was actually applied to this release.
* Enhancement: Router Link Refactor
* Support for multiple link types
* Existing link notifications
* Link heartbeats/latency have changed
* Inspect and ps upport for links
* Router version dissemination
* Distributed control preparation
* Enhancement: `ziti fabric list routers` now includes the link listener types and advertise addresses
## Router Link Refactor
### Multiple Link Types
Routers can now configure multiple link listeners. Listeners now support an option 'type' attribute. If no type is provided, the link type will be derived from the address. For example, given the following configuration:
```
link:
dialers:
- binding: transport
listeners:
- binding: transport
bind: tls:127.0.0.1:7878
advertise: tls:127.0.0.1:7878
- binding: transport
bind: tls:127.0.0.1:5876
advertise: tls:127.0.0.1:5876
type: cellular
```
The first listener will have a type of `tls` and the second listener will have a type of `cellular`.
Routers will now try to maintain one link of each type available on the target router.
When using `ziti fabric list links` the link type will now be shown.
### Existing link notifications
As the controller doesn't persist links, when the controller restarts or loses connection it loses all information about router links. Routers can now notify the controller about existing links when they reconnect. If they receive a link dial request for a link that they already have (based on the target router and link type), they can now report back the existing link. This should prevent the number of links to remain relatively constant.
### Link Heartbeats
Because we are now limiting the number of links it is even more vital to ensure that links are healthy, and to respond quickly when links become unresponsive. To that end links now use heartbeats. As data flows across the link, heartbeat headers will be added periodically. Heartbeat responses will be added to return messages. If the link is currently quiet, explicit heartbeat messages will be sent. Heartbeats will also be used to measure latency. If heartbeats are unreturned for a certain amount of time, the link will be considered bad and torn down, so a new one can be established.
The link.latency metric now is calculated starting when the message is about to be sent. It may have a few extra milliseconds time, as the response waits briefly to see if there's an existing message that the response can piggyback on.
Previously link.latency include both queue and network time. Now that it only has network time, there's a new metrics, `link.queue_time` which tracks how long it takes messages to get from send requested to just before send.
### Inspect and ps support for links
`ziti fabric inspect .* links` can now be used to see what links each router knows about. This can be useful to determine if/how the controller and routers may have gotten out of sync.
Router can also be interrogated directly for their links via IPC, using `ziti ps`.
```
$ ziti ps router dump-links 275061
id: 4sYO18tZ1Fz4HByXuIp1Dq dest: o.oVU2Qm. type: tls
id: 19V7yhjBpHAc2prTDiTihQ dest: hBjIP2wmxj type: tls
```
### Router version dissemination
Routers now get the version of the router they are dialing a link to, and pass their own version to that router as part of the dial. This allows routers to only enable specific features if both sides of the link support it.
### Distributed Control preparation
Giving the routers have more control over the links prepares us for a time when routers may be connected to multiple controllers. Routers will be able to notify controllers of existing links and will be prepared to resolve duplicate link dial requests from multiple sources.
# Release 0.24.13
* Enhancement: Added new `noTraversal` field to routers. Configures if a router should allow/disallow traversal. Required on create/update commands.
* Enhancement: `ziti edge update edge-router` now supports either `--no-traversal` flag which will allow/disallow a given router from being used to traverse.
* Enhancement: `ziti fabric list routers` and `ziti edge list routers` will now display the noTraversal flag of associated routers.
+6 -5
View File
@@ -35,9 +35,9 @@ require (
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d
github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19
github.com/michaelquigley/pfxlog v0.6.3
github.com/openziti/channel v0.18.11
github.com/openziti/foundation v0.17.7
github.com/openziti/sdk-golang v0.16.14
github.com/openziti/channel v0.18.14
github.com/openziti/foundation v0.17.8
github.com/openziti/sdk-golang v0.16.20
github.com/pborman/uuid v1.2.0
github.com/pkg/errors v0.9.1
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0
@@ -73,6 +73,7 @@ require (
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/dgoogauth v0.0.0-20190221195224-5a805980a5f3 // indirect
github.com/dineshappavoo/basex v0.0.0-20170425072625-481a6f6dc663 // indirect
github.com/disintegration/imaging v1.6.2 // indirect
github.com/dlclark/regexp2 v1.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
@@ -172,7 +173,7 @@ require (
require (
github.com/jedib0t/go-pretty/v6 v6.2.4
github.com/openziti/edge v0.21.115
github.com/openziti/fabric v0.17.57
github.com/openziti/edge v0.21.120
github.com/openziti/fabric v0.17.60
github.com/rivo/uniseg v0.2.0 // indirect
)
+14 -13
View File
@@ -214,6 +214,8 @@ github.com/dgryski/dgoogauth v0.0.0-20190221195224-5a805980a5f3 h1:AqeKSZIG/NIC7
github.com/dgryski/dgoogauth v0.0.0-20190221195224-5a805980a5f3/go.mod h1:hEfFauPHz7+NnjR/yHJGhrKo1Za+zStgwUETx3yzqgY=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8=
github.com/dineshappavoo/basex v0.0.0-20170425072625-481a6f6dc663 h1:fctNkSsavbXpt8geFWZb8n+noCqS8MrOXRJ/YfdZ2dQ=
github.com/dineshappavoo/basex v0.0.0-20170425072625-481a6f6dc663/go.mod h1:Kad2hux31v/IyD4Rf4wAwIyK48995rs3qAl9IUAhc2k=
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
@@ -818,22 +820,21 @@ github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
github.com/openziti/channel v0.18.9/go.mod h1:pjoD6e9QgDGnaiakRA+s8YT/FzUHWDhJJF573oOJkXg=
github.com/openziti/channel v0.18.11 h1:zT2zRI6m/POr81dXmM8azLpcCjysgeuVPppztl25Zc0=
github.com/openziti/channel v0.18.11/go.mod h1:9z2HLdoYZ3RYm9S8XqlQB5spf3j+BLPof0A1zvjLyzc=
github.com/openziti/channel v0.18.13/go.mod h1:9z2HLdoYZ3RYm9S8XqlQB5spf3j+BLPof0A1zvjLyzc=
github.com/openziti/channel v0.18.14 h1:MS6Wfo0BklKI/IQ/HQl+wKJBw9rPimTSSqFIeBcsHGQ=
github.com/openziti/channel v0.18.14/go.mod h1:F370DYbKEKpIEhRaZVbEK6xN+pirSZx4qnwbObQAV2I=
github.com/openziti/dilithium v0.3.3 h1:PLgQ6PMNLSTzCFbX/h98cmudgz/cU6TmjdSv5NAPD8k=
github.com/openziti/dilithium v0.3.3/go.mod h1:vsCjI2AU/hon9e+dLhUFbCNGesJDj2ASgkySOcpmvjo=
github.com/openziti/edge v0.21.115 h1:sIxlCCUEfXgOpUikmd6Ya3Hsn1fhMXaFznkNeUF+OPQ=
github.com/openziti/edge v0.21.115/go.mod h1:2gb49/wivJSAnQwRCC8rAkQ0+3lWjwUgo/Kb7+0WJpM=
github.com/openziti/fabric v0.17.54/go.mod h1:o206EkKYBOoQvDKsFj07rlHI+za6yMpxUXyWj2XVrw0=
github.com/openziti/fabric v0.17.57 h1:mCo89KoEH1oaHeo0lc3p0x3A8G6/LsSiPTpd7NKvND0=
github.com/openziti/fabric v0.17.57/go.mod h1:nPHmXHx1MxgS2LlsjIWrWqq4B92OyPGtsLCdV3GBlXw=
github.com/openziti/foundation v0.17.1/go.mod h1:qzctNeCrOrPDQDr9g70IPHw+awal87qPqRe3UJLwNXw=
github.com/openziti/edge v0.21.120 h1:hoSmHPec/PEgQE4JZ3L05IBnyR8UqRpVOJUK5egQlNc=
github.com/openziti/edge v0.21.120/go.mod h1:Sdf0gOmnF3tgts9cV4nQxMzyhY/R4KpXZxKqTMje+7M=
github.com/openziti/fabric v0.17.60 h1:xUc2e2ITkpgyeWvHHb8JGv7r5AtwSzFv2PenaIiXo2E=
github.com/openziti/fabric v0.17.60/go.mod h1:8oBcmWriG/nTGF/+8pkv1oAKQY97XXG4ptns8dUTMr4=
github.com/openziti/foundation v0.17.6/go.mod h1:dTaJgdO5OqnKpV+0OPHpnTnqfPpqNGbhJv8O6pMot6o=
github.com/openziti/foundation v0.17.7 h1:lnP+4e78Vmfu/iL1seKqurCiroYWi0Ae0SQEcM7b36A=
github.com/openziti/foundation v0.17.7/go.mod h1:dTaJgdO5OqnKpV+0OPHpnTnqfPpqNGbhJv8O6pMot6o=
github.com/openziti/sdk-golang v0.16.14 h1:PIjHRwQqKcclfJYVjEUnnri2PM9wCAEBLwFhwQ6FSJ4=
github.com/openziti/sdk-golang v0.16.14/go.mod h1:s8T8XNGGCeEeMhtCf5iUi2t97FqoslE6t1TTEbCVfPU=
github.com/openziti/foundation v0.17.8 h1:vlX6yQHrs5Tcp39xHylJhzohTDOZ6d/VrVlQahw7GBo=
github.com/openziti/foundation v0.17.8/go.mod h1:dTaJgdO5OqnKpV+0OPHpnTnqfPpqNGbhJv8O6pMot6o=
github.com/openziti/sdk-golang v0.16.19/go.mod h1:ougRN3x0v2L7sHwjkoeoa05ZlWs9+0ObyUCc2Sm8Kfw=
github.com/openziti/sdk-golang v0.16.20 h1:AtSaD0Do5HgkDWFR0dLUVpiOpky2WAh6cf78hcG30jk=
github.com/openziti/sdk-golang v0.16.20/go.mod h1:uQ90QCehBrfO/xmpnWGVr3Jj65BMUrvGPH4I0gRl0og=
github.com/oracle/oci-go-sdk v24.2.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
github.com/orcaman/concurrent-map v0.0.0-20190826125027-8c72a8bb44f6/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
github.com/orcaman/concurrent-map v0.0.0-20210106121528-16402b402231 h1:fa50YL1pzKW+1SsBnJDOHppJN9stOEwS+CRWyUtyYGU=
@@ -956,6 +956,8 @@ function ziti_createEnvFile {
export ZITI_BIN_ROOT="${ZITI_HOME}/ziti-bin"
if [[ "${ZITI_EDGE_ROUTER_RAWNAME-}" == "" ]]; then export ZITI_EDGE_ROUTER_RAWNAME="${ZITI_NETWORK}-edge-router"; fi
if [[ "${ZITI_CTRL_MGMT_HOST_PORT-}" == "" ]]; then export ZITI_CTRL_MGMT_HOST_PORT="${ZITI_CONTROLLER_HOSTNAME}:10000"; fi
if [[ "${ZITI_CTRL_IDENTITY_CERT-}" == "" ]]; then export ZITI_CTRL_IDENTITY_CERT="${ZITI_PKI_OS_SPECIFIC}/${ZITI_CONTROLLER_INTERMEDIATE_NAME}/certs/${ZITI_CONTROLLER_HOSTNAME}-client.cert"; fi
if [[ "${ZITI_CTRL_IDENTITY_SERVER_CERT-}" == "" ]]; then export ZITI_CTRL_IDENTITY_SERVER_CERT="${ZITI_PKI_OS_SPECIFIC}/${ZITI_CONTROLLER_INTERMEDIATE_NAME}/certs/${ZITI_CONTROLLER_HOSTNAME}-server.chain.pem"; fi
+1 -1
View File
@@ -1 +1 @@
0.24
0.25
+1
View File
@@ -159,6 +159,7 @@ type RouterListenerTemplateValues struct {
}
var workingDir string
var data = &ConfigTemplateValues{}
func init() {
zh := os.Getenv("ZITI_HOME")
@@ -70,9 +70,6 @@ type CreateConfigControllerOptions struct {
func NewCmdCreateConfigController() *cobra.Command {
controllerOptions := &CreateConfigControllerOptions{}
// Get env variable data global to all config files
data := &ConfigTemplateValues{}
cmd := &cobra.Command{
Use: "controller",
Short: "Create a controller config",
@@ -112,9 +112,6 @@ type CreateConfigEnvironmentOptions struct {
// NewCmdCreateConfigEnvironment creates a command object for the "environment" command
func NewCmdCreateConfigEnvironment() *cobra.Command {
// Get env variable data global to all config files
data := &ConfigTemplateValues{}
environmentOptions := &CreateConfigEnvironmentOptions{
ConfigTemplateValues: *data,
EnvVariableMetaData: EnvVariableMetaData{
+12 -12
View File
@@ -34,26 +34,26 @@ type CreateConfigRouterOptions struct {
CreateConfigOptions
RouterName string
WssEnabled bool
IsPrivate bool
}
var routerOptions = CreateConfigRouterOptions{}
// NewCmdCreateConfigRouter creates a command object for the "router" command
func NewCmdCreateConfigRouter() *cobra.Command {
options := &CreateConfigRouterOptions{}
// Get env variable data global to all config files
data := &ConfigTemplateValues{}
cmd := &cobra.Command{
Use: "router",
Short: "Creates a config file for specified Router name",
Aliases: []string{"rtr"},
PreRun: func(cmd *cobra.Command, args []string) {
PersistentPreRun: func(cmd *cobra.Command, args []string) {
// Setup logging
var logOut *os.File
if options.Verbose {
if routerOptions.Verbose {
logrus.SetLevel(logrus.DebugLevel)
// Only print log to stdout if not printing config to stdout
if strings.ToLower(options.Output) != "stdout" {
if strings.ToLower(routerOptions.Output) != "stdout" {
logOut = os.Stdout
} else {
logOut = os.Stderr
@@ -65,7 +65,7 @@ func NewCmdCreateConfigRouter() *cobra.Command {
data.populateDefaults()
// Update router data with options passed in
data.Router.Name = options.RouterName
data.Router.Name = routerOptions.RouterName
SetZitiRouterIdentity(&data.Router, data.Router.Name)
},
Run: func(cmd *cobra.Command, args []string) {
@@ -73,11 +73,11 @@ func NewCmdCreateConfigRouter() *cobra.Command {
},
}
cmd.AddCommand(NewCmdCreateConfigRouterEdge(data))
cmd.AddCommand(NewCmdCreateConfigRouterFabric(data))
cmd.AddCommand(NewCmdCreateConfigRouterEdge())
cmd.AddCommand(NewCmdCreateConfigRouterFabric())
options.addCreateFlags(cmd)
options.addFlags(cmd)
routerOptions.addCreateFlags(cmd)
routerOptions.addFlags(cmd)
return cmd
}
+10 -35
View File
@@ -49,20 +49,11 @@ var (
`)
)
// CreateConfigRouterEdgeOptions the options for the edge command
type CreateConfigRouterEdgeOptions struct {
CreateConfigRouterOptions
WssEnabled bool
IsPrivate bool
}
//go:embed config_templates/router.yml
var routerConfigEdgeTemplate string
// NewCmdCreateConfigRouterEdge creates a command object for the "edge" command
func NewCmdCreateConfigRouterEdge(data *ConfigTemplateValues) *cobra.Command {
options := &CreateConfigRouterEdgeOptions{}
func NewCmdCreateConfigRouterEdge() *cobra.Command {
cmd := &cobra.Command{
Use: "edge",
@@ -71,40 +62,24 @@ func NewCmdCreateConfigRouterEdge(data *ConfigTemplateValues) *cobra.Command {
Long: createConfigRouterEdgeLong,
Example: createConfigRouterEdgeExample,
PreRun: func(cmd *cobra.Command, args []string) {
// Setup logging
var logOut *os.File
if options.Verbose {
logrus.SetLevel(logrus.DebugLevel)
// Only print log to stdout if not printing config to stdout
if strings.ToLower(options.Output) != "stdout" {
logOut = os.Stdout
} else {
logOut = os.Stderr
}
logrus.SetOutput(logOut)
}
// Update edge router specific values with options passed in
data.Router.Name = options.RouterName
SetZitiRouterIdentity(&data.Router, data.Router.Name)
data.Router.IsWss = options.WssEnabled
data.Router.IsPrivate = options.IsPrivate
data.Router.IsWss = routerOptions.WssEnabled
data.Router.IsPrivate = routerOptions.IsPrivate
},
Run: func(cmd *cobra.Command, args []string) {
options.Cmd = cmd
options.Args = args
err := options.run(data)
routerOptions.Cmd = cmd
routerOptions.Args = args
err := routerOptions.runEdgeRouter(data)
cmdhelper.CheckErr(err)
},
}
options.addCreateFlags(cmd)
options.addFlags(cmd)
routerOptions.addCreateFlags(cmd)
routerOptions.addEdgeFlags(cmd)
return cmd
}
func (options *CreateConfigRouterEdgeOptions) addFlags(cmd *cobra.Command) {
func (options *CreateConfigRouterOptions) addEdgeFlags(cmd *cobra.Command) {
cmd.Flags().BoolVar(&options.WssEnabled, optionWSS, defaultWSS, wssDescription)
cmd.Flags().BoolVar(&options.IsPrivate, optionPrivate, defaultPrivate, privateDescription)
cmd.PersistentFlags().StringVarP(&options.RouterName, optionRouterName, "n", "", "name of the router")
@@ -115,7 +90,7 @@ func (options *CreateConfigRouterEdgeOptions) addFlags(cmd *cobra.Command) {
}
// run implements the command
func (options *CreateConfigRouterEdgeOptions) run(data *ConfigTemplateValues) error {
func (options *CreateConfigRouterOptions) runEdgeRouter(data *ConfigTemplateValues) error {
// Ensure private and wss are not both used
if options.IsPrivate && options.WssEnabled {
logrus.Fatal("Flags for private and wss configs are mutually exclusive. You must choose private or wss, not both")
@@ -40,17 +40,11 @@ var (
`)
)
// CreateConfigRouterFabricOptions the options for the fabric command
type CreateConfigRouterFabricOptions struct {
CreateConfigRouterOptions
}
//go:embed config_templates/router.yml
var routerConfigFabricTemplate string
// NewCmdCreateConfigRouterFabric creates a command object for the "fabric" command
func NewCmdCreateConfigRouterFabric(data *ConfigTemplateValues) *cobra.Command {
options := &CreateConfigRouterFabricOptions{}
func NewCmdCreateConfigRouterFabric() *cobra.Command {
cmd := &cobra.Command{
Use: "fabric",
@@ -59,39 +53,23 @@ func NewCmdCreateConfigRouterFabric(data *ConfigTemplateValues) *cobra.Command {
Long: createConfigRouterFabricLong,
Example: createConfigRouterFabricExample,
PreRun: func(cmd *cobra.Command, args []string) {
// Setup logging
var logOut *os.File
if options.Verbose {
logrus.SetLevel(logrus.DebugLevel)
// Only print log to stdout if not printing config to stdout
if strings.ToLower(options.Output) != "stdout" {
logOut = os.Stdout
} else {
logOut = os.Stderr
}
logrus.SetOutput(logOut)
}
// Update fabric router specific values with options passed in
data.Router.Name = options.RouterName
SetZitiRouterIdentity(&data.Router, data.Router.Name)
data.Router.IsFabric = true
},
Run: func(cmd *cobra.Command, args []string) {
options.Cmd = cmd
options.Args = args
err := options.run(data)
routerOptions.Cmd = cmd
routerOptions.Args = args
err := routerOptions.runFabricRouter(data)
cmdhelper.CheckErr(err)
},
}
options.addCreateFlags(cmd)
options.addFlags(cmd)
routerOptions.addCreateFlags(cmd)
routerOptions.addFabricFlags(cmd)
return cmd
}
func (options *CreateConfigRouterFabricOptions) addFlags(cmd *cobra.Command) {
func (options *CreateConfigRouterOptions) addFabricFlags(cmd *cobra.Command) {
cmd.PersistentFlags().StringVarP(&options.RouterName, optionRouterName, "n", "", "name of the router")
err := cmd.MarkPersistentFlagRequired(optionRouterName)
if err != nil {
@@ -100,7 +78,7 @@ func (options *CreateConfigRouterFabricOptions) addFlags(cmd *cobra.Command) {
}
// run implements the command
func (options *CreateConfigRouterFabricOptions) run(data *ConfigTemplateValues) error {
func (options *CreateConfigRouterOptions) runFabricRouter(data *ConfigTemplateValues) error {
tmpl, err := template.New("fabric-router-config").Parse(routerConfigFabricTemplate)
if err != nil {
+5 -1
View File
@@ -51,12 +51,16 @@ func (self *ListCmd) run(cmd *cobra.Command, args []string) error {
return err
}
if self.OutputResponseJson() {
return nil
}
result := inspectOk.Payload
if *result.Success {
fmt.Printf("\nResults: (%d)\n", len(result.Values))
for _, value := range result.Values {
fmt.Printf("%v.%v\n", stringz.OrEmpty(value.AppID), stringz.OrEmpty(value.Name))
fmt.Printf("%v\n\n", stringz.OrEmpty(value.Value))
fmt.Printf("%+v\n\n", value.Value)
}
} else {
fmt.Printf("\nEncountered errors: (%d)\n", len(result.Errors))
+15 -4
View File
@@ -184,10 +184,11 @@ func outputLinks(o *api.Options, children []*gabs.Container, pagingInfo *api.Pag
columnConfigs[4] = table.ColumnConfig{Align: text.AlignRight}
columnConfigs[5] = table.ColumnConfig{Align: text.AlignRight}
t.SetColumnConfigs(columnConfigs)
t.AppendHeader(table.Row{"ID", "Dialer", "Acceptor", "Static Cost", "Src Latency", "Dst Latency", "State", "Status", "Full Cost"})
t.AppendHeader(table.Row{"ID", "Type", "Dialer", "Acceptor", "Static Cost", "Src Latency", "Dst Latency", "State", "Status", "Full Cost"})
for _, entity := range children {
id := entity.Path("id").Data().(string)
linkType := entity.Path("type").Data().(string)
srcRouter := entity.Path("sourceRouter.name").Data().(string)
dstRouter := entity.Path("destRouter.name").Data().(string)
staticCost := entity.Path("staticCost").Data().(float64)
@@ -202,7 +203,7 @@ func outputLinks(o *api.Options, children []*gabs.Container, pagingInfo *api.Pag
status = "down"
}
t.AppendRow(table.Row{id, srcRouter, dstRouter, staticCost,
t.AppendRow(table.Row{id, linkType, srcRouter, dstRouter, staticCost,
fmt.Sprintf("%.2vms", srcLatency),
fmt.Sprintf("%.2vms", dstLatency),
state, status, cost})
@@ -291,7 +292,7 @@ func outputRouters(o *api.Options, children []*gabs.Container, pagingInfo *api.P
t := table.NewWriter()
t.SetStyle(table.StyleRounded)
t.AppendHeader(table.Row{"ID", "Name", "Online", "Cost", "No Traversal", "Version"})
t.AppendHeader(table.Row{"ID", "Name", "Online", "Cost", "No Traversal", "Version", "Listeners"})
for _, entity := range children {
id := entity.Path("id").Data().(string)
@@ -307,7 +308,17 @@ func outputRouters(o *api.Options, children []*gabs.Container, pagingInfo *api.P
arch := versionInfo.Path("arch").Data().(string)
version = fmt.Sprintf("%v on %v/%v", v, os, arch)
}
t.AppendRow(table.Row{id, name, connected, cost, noTraversal, version})
var listeners []string
listenerAddresses := entity.Path("listenerAddresses")
if listenerAddresses != nil {
children, _ := listenerAddresses.Children()
for idx, child := range children {
addr := child.Path("address").Data().(string)
linkType := child.Path("type").Data().(string)
listeners = append(listeners, fmt.Sprintf("%v: %v (%v)", idx+1, addr, linkType))
}
}
t.AppendRow(table.Row{id, name, connected, cost, noTraversal, version, strings.Join(listeners, "\n")})
}
renderTable(o, t, pagingInfo)
+2 -9
View File
@@ -78,10 +78,7 @@ func NewCmdPs(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Command
Short: "Show Ziti router process info",
Long: psLong,
Run: func(cmd *cobra.Command, args []string) {
options.Cmd = cmd
options.Args = args
err := options.Run()
cmdhelper.CheckErr(err)
cmdhelper.CheckErr(cmd.Help())
},
}
@@ -105,11 +102,7 @@ func NewCmdPs(f cmdutil.Factory, out io.Writer, errOut io.Writer) *cobra.Command
routerCmd.AddCommand(NewCmdPsBasicRouterCmd("disconnect", router.CloseControlChannel, f, out, errOut))
routerCmd.AddCommand(NewCmdPsBasicRouterCmd("reconnect", router.OpenControlChannel, f, out, errOut))
routerCmd.AddCommand(NewCmdPsBasicRouterCmd("dump-api-sessions", debugops.DumpApiSessions, f, out, errOut))
// cmd.AddCommand(NewCmdPsController(f, out, errOut))
// cmd.AddCommand(NewCmdPsMgmt(f, out, errOut))
// cmd.AddCommand(NewCmdPsMgmtGw(f, out, errOut))
// cmd.AddCommand(NewCmdPsRouter(f, out, errOut))
routerCmd.AddCommand(NewCmdPsBasicRouterCmd("dump-links", router.DumpLinks, f, out, errOut))
options.addPsFlags(cmd)
return cmd