From f9d8dd071592f33c0c8c735e88087ec0a5725b6a Mon Sep 17 00:00:00 2001 From: gberl002 Date: Tue, 1 Mar 2022 15:22:52 -0500 Subject: [PATCH 1/6] Fixing issue causing some template values to not populate --- ziti/cmd/ziti/cmd/create_config.go | 1 + ziti/cmd/ziti/cmd/create_config_controller.go | 3 --- ziti/cmd/ziti/cmd/create_config_environment.go | 3 --- ziti/cmd/ziti/cmd/create_config_router.go | 9 +++------ ziti/cmd/ziti/cmd/create_config_router_edge.go | 18 +----------------- .../ziti/cmd/create_config_router_fabric.go | 18 +----------------- 6 files changed, 6 insertions(+), 46 deletions(-) diff --git a/ziti/cmd/ziti/cmd/create_config.go b/ziti/cmd/ziti/cmd/create_config.go index 6521abe73..25744dfea 100644 --- a/ziti/cmd/ziti/cmd/create_config.go +++ b/ziti/cmd/ziti/cmd/create_config.go @@ -140,6 +140,7 @@ type RouterListenerTemplateValues struct { } var workingDir string +var data = &ConfigTemplateValues{} func init() { zh := os.Getenv("ZITI_HOME") diff --git a/ziti/cmd/ziti/cmd/create_config_controller.go b/ziti/cmd/ziti/cmd/create_config_controller.go index 7c26aa4f1..693b82749 100644 --- a/ziti/cmd/ziti/cmd/create_config_controller.go +++ b/ziti/cmd/ziti/cmd/create_config_controller.go @@ -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", diff --git a/ziti/cmd/ziti/cmd/create_config_environment.go b/ziti/cmd/ziti/cmd/create_config_environment.go index ac5c6144a..9a71f5a3e 100644 --- a/ziti/cmd/ziti/cmd/create_config_environment.go +++ b/ziti/cmd/ziti/cmd/create_config_environment.go @@ -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{ diff --git a/ziti/cmd/ziti/cmd/create_config_router.go b/ziti/cmd/ziti/cmd/create_config_router.go index 8bb90fff2..666dbb197 100644 --- a/ziti/cmd/ziti/cmd/create_config_router.go +++ b/ziti/cmd/ziti/cmd/create_config_router.go @@ -40,14 +40,11 @@ type CreateConfigRouterOptions struct { 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 { @@ -73,8 +70,8 @@ func NewCmdCreateConfigRouter() *cobra.Command { }, } - cmd.AddCommand(NewCmdCreateConfigRouterEdge(data)) - cmd.AddCommand(NewCmdCreateConfigRouterFabric(data)) + cmd.AddCommand(NewCmdCreateConfigRouterEdge()) + cmd.AddCommand(NewCmdCreateConfigRouterFabric()) options.addCreateFlags(cmd) options.addFlags(cmd) diff --git a/ziti/cmd/ziti/cmd/create_config_router_edge.go b/ziti/cmd/ziti/cmd/create_config_router_edge.go index c6db72182..d36f971d7 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_edge.go +++ b/ziti/cmd/ziti/cmd/create_config_router_edge.go @@ -61,7 +61,7 @@ type CreateConfigRouterEdgeOptions struct { var routerConfigEdgeTemplate string // NewCmdCreateConfigRouterEdge creates a command object for the "edge" command -func NewCmdCreateConfigRouterEdge(data *ConfigTemplateValues) *cobra.Command { +func NewCmdCreateConfigRouterEdge() *cobra.Command { options := &CreateConfigRouterEdgeOptions{} cmd := &cobra.Command{ @@ -71,22 +71,6 @@ 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 }, diff --git a/ziti/cmd/ziti/cmd/create_config_router_fabric.go b/ziti/cmd/ziti/cmd/create_config_router_fabric.go index 94190beff..38ef97f2e 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_fabric.go +++ b/ziti/cmd/ziti/cmd/create_config_router_fabric.go @@ -49,7 +49,7 @@ type CreateConfigRouterFabricOptions struct { var routerConfigFabricTemplate string // NewCmdCreateConfigRouterFabric creates a command object for the "fabric" command -func NewCmdCreateConfigRouterFabric(data *ConfigTemplateValues) *cobra.Command { +func NewCmdCreateConfigRouterFabric() *cobra.Command { options := &CreateConfigRouterFabricOptions{} cmd := &cobra.Command{ @@ -59,22 +59,6 @@ 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) { From fa8b4cb6c2c4a28d3887dbf9ffca99434c826eb8 Mon Sep 17 00:00:00 2001 From: gberl002 Date: Wed, 2 Mar 2022 13:22:23 -0500 Subject: [PATCH 2/6] Fixed bug with missing edge router name --- quickstart/docker/image/ziti-cli-functions.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index d76a58980..9e2e1f5fc 100644 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -814,6 +814,7 @@ function createEdgeRouterConfig { output_file="${ZITI_HOME}/${router_name}.yaml" + echo -e "**** ZITI_EDGE_ROUTER_RAWNAME is ${ZITI_EDGE_ROUTER_RAWNAME}" mkdir -p "${ZITI_PKI_OS_SPECIFIC}/routers/${router_name}" export ZITI_ROUTER_IDENTITY_CERT="${ZITI_PKI_OS_SPECIFIC}/routers/${router_name}/client.cert" export ZITI_ROUTER_IDENTITY_SERVER_CERT="${ZITI_PKI_OS_SPECIFIC}/routers/${router_name}/server.cert" @@ -956,6 +957,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 From 3652500278aeea5877314de54278556fc7b07f2b Mon Sep 17 00:00:00 2001 From: gberl002 Date: Wed, 2 Mar 2022 13:24:27 -0500 Subject: [PATCH 3/6] Removing print statement accidentally left in --- quickstart/docker/image/ziti-cli-functions.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index 9e2e1f5fc..d0b5882ee 100644 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -814,7 +814,6 @@ function createEdgeRouterConfig { output_file="${ZITI_HOME}/${router_name}.yaml" - echo -e "**** ZITI_EDGE_ROUTER_RAWNAME is ${ZITI_EDGE_ROUTER_RAWNAME}" mkdir -p "${ZITI_PKI_OS_SPECIFIC}/routers/${router_name}" export ZITI_ROUTER_IDENTITY_CERT="${ZITI_PKI_OS_SPECIFIC}/routers/${router_name}/client.cert" export ZITI_ROUTER_IDENTITY_SERVER_CERT="${ZITI_PKI_OS_SPECIFIC}/routers/${router_name}/server.cert" From 85b41751403f8dbff65267748c7b9e11556ca0a9 Mon Sep 17 00:00:00 2001 From: gberl002 Date: Mon, 7 Mar 2022 09:41:47 -0500 Subject: [PATCH 4/6] Fixing an issue with the router name coming up blank --- ziti/cmd/ziti/cmd/create_config_router.go | 15 ++++++----- .../cmd/ziti/cmd/create_config_router_edge.go | 27 +++++++------------ .../ziti/cmd/create_config_router_fabric.go | 20 +++++--------- 3 files changed, 25 insertions(+), 37 deletions(-) diff --git a/ziti/cmd/ziti/cmd/create_config_router.go b/ziti/cmd/ziti/cmd/create_config_router.go index 666dbb197..3fc7044b3 100644 --- a/ziti/cmd/ziti/cmd/create_config_router.go +++ b/ziti/cmd/ziti/cmd/create_config_router.go @@ -34,11 +34,14 @@ 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{} cmd := &cobra.Command{ Use: "router", @@ -47,10 +50,10 @@ func NewCmdCreateConfigRouter() *cobra.Command { 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 @@ -62,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,8 +76,8 @@ func NewCmdCreateConfigRouter() *cobra.Command { cmd.AddCommand(NewCmdCreateConfigRouterEdge()) cmd.AddCommand(NewCmdCreateConfigRouterFabric()) - options.addCreateFlags(cmd) - options.addFlags(cmd) + routerOptions.addCreateFlags(cmd) + routerOptions.addFlags(cmd) return cmd } diff --git a/ziti/cmd/ziti/cmd/create_config_router_edge.go b/ziti/cmd/ziti/cmd/create_config_router_edge.go index d36f971d7..f6262514b 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_edge.go +++ b/ziti/cmd/ziti/cmd/create_config_router_edge.go @@ -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() *cobra.Command { - options := &CreateConfigRouterEdgeOptions{} cmd := &cobra.Command{ Use: "edge", @@ -71,24 +62,24 @@ func NewCmdCreateConfigRouterEdge() *cobra.Command { Long: createConfigRouterEdgeLong, Example: createConfigRouterEdgeExample, PreRun: func(cmd *cobra.Command, args []string) { - 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") @@ -99,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") diff --git a/ziti/cmd/ziti/cmd/create_config_router_fabric.go b/ziti/cmd/ziti/cmd/create_config_router_fabric.go index 38ef97f2e..cdf376ff3 100644 --- a/ziti/cmd/ziti/cmd/create_config_router_fabric.go +++ b/ziti/cmd/ziti/cmd/create_config_router_fabric.go @@ -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() *cobra.Command { - options := &CreateConfigRouterFabricOptions{} cmd := &cobra.Command{ Use: "fabric", @@ -62,20 +56,20 @@ func NewCmdCreateConfigRouterFabric() *cobra.Command { 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 { @@ -84,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 { From e6e0381f97057ea1a8169e5e246600710f31c990 Mon Sep 17 00:00:00 2001 From: gberl002 Date: Mon, 7 Mar 2022 13:38:56 -0500 Subject: [PATCH 5/6] Fixing the changelog, incorrectly reporting a bug fix on a previous version. --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bcdf2abf..ca96429ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ +# Release 0.25.0 +* 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. + # Release 0.24.13 -* 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. * 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. From 3d6a85bd0e84a2f7408959295db4361325a33d07 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Thu, 24 Feb 2022 15:41:00 -0500 Subject: [PATCH 6/6] Update changelog and deps for link management refactor --- CHANGELOG.md | 77 ++++++++++++++++++++++++++++- go.mod | 11 +++-- go.sum | 27 +++++----- version | 2 +- ziti/cmd/ziti/cmd/fabric/inspect.go | 6 ++- ziti/cmd/ziti/cmd/fabric/list.go | 19 +++++-- ziti/cmd/ziti/cmd/ps.go | 11 +---- 7 files changed, 119 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca96429ef..a72901345 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,81 @@ # 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. + * 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 diff --git a/go.mod b/go.mod index de9dbdd79..16517b77b 100644 --- a/go.mod +++ b/go.mod @@ -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 ) diff --git a/go.sum b/go.sum index e2c6bd612..83fc98942 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/version b/version index fd137eb17..7d385d419 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.24 +0.25 diff --git a/ziti/cmd/ziti/cmd/fabric/inspect.go b/ziti/cmd/ziti/cmd/fabric/inspect.go index 677ebd840..c17406ddc 100644 --- a/ziti/cmd/ziti/cmd/fabric/inspect.go +++ b/ziti/cmd/ziti/cmd/fabric/inspect.go @@ -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)) diff --git a/ziti/cmd/ziti/cmd/fabric/list.go b/ziti/cmd/ziti/cmd/fabric/list.go index 3a941bded..87eb7283c 100644 --- a/ziti/cmd/ziti/cmd/fabric/list.go +++ b/ziti/cmd/ziti/cmd/fabric/list.go @@ -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) diff --git a/ziti/cmd/ziti/cmd/ps.go b/ziti/cmd/ziti/cmd/ps.go index f8bbfd78c..3aec9b609 100644 --- a/ziti/cmd/ziti/cmd/ps.go +++ b/ziti/cmd/ziti/cmd/ps.go @@ -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