Skip to content

Commit

Permalink
Link management fixes. Fixes #1692 Fixes #1693
Browse files Browse the repository at this point in the history
  • Loading branch information
plorenz committed Jan 19, 2024
1 parent bb09799 commit c4abcae
Show file tree
Hide file tree
Showing 52 changed files with 1,506 additions and 783 deletions.
33 changes: 33 additions & 0 deletions common/capabilities/check.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
Copyright NetFoundry Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package capabilities

import (
"github.com/openziti/channel/v2"
"github.com/openziti/ziti/common/pb/ctrl_pb"
"math/big"
)

func IsCapable(ch channel.Channel, capability int) bool {
headers := ch.Underlay().Headers()
if val, found := headers[int32(ctrl_pb.ControlHeaders_CapabilitiesHeader)]; found {
capabilitiesMask := &big.Int{}
capabilitiesMask.SetBytes(val)
return capabilitiesMask.Bit(capability) == 1
}
return false
}
3 changes: 2 additions & 1 deletion common/capabilities/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
package capabilities

const (
ControllerCreateTerminatorV2 int = 1
ControllerCreateTerminatorV2 int = 1
ControllerSingleRouterLinkSource int = 2
)
6 changes: 4 additions & 2 deletions common/inspect/links_inspect_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type LinksInspectResult struct {

type LinkInspectDetail struct {
Id string `json:"id"`
Iteration uint32 `json:"iteration"`
Key string `json:"key"`
Split bool `json:"split"`
Protocol string `json:"protocol"`
Expand All @@ -49,13 +50,14 @@ type LinkState struct {
Id string `json:"id"`
Key string `json:"key"`
Status string `json:"status"`
DialAttempts uint `json:"dialAttempts"`
ConnectedCount uint `json:"connectedCount"`
DialAttempts uint64 `json:"dialAttempts"`
ConnectedCount uint64 `json:"connectedCount"`
RetryDelay string `json:"retryDelay"`
NextDial string `json:"nextDial"`
TargetAddress string `json:"targetAddress"`
TargetGroups []string `json:"targetGroups"`
TargetBinding string `json:"targetBinding"`
DialerGroups []string `json:"dialerGroups"`
DialerBinding string `json:"dialerBinding"`
CtrlsNotified bool `json:"ctrlsNotified"`
}
Loading

0 comments on commit c4abcae

Please sign in to comment.