mirror of
https://github.com/openziti/ziti.git
synced 2026-09-10 00:35:41 +00:00
86092a8640
Bumps the sdk-golang dependency from v1 to the v2 module (`github.com/openziti/sdk-golang/v2` at v2.0.0-pre1) and updates all import paths. This is a no-behavior-change precursor that isolates the dependency migration from the Connect-V2 feature work in #3884. - Rewrites `github.com/openziti/sdk-golang/...` imports to `github.com/openziti/sdk-golang/v2/...` across the main and zititest modules. - Pins both modules to `github.com/openziti/sdk-golang/v2 v2.0.0-pre1`. - Adapts `edgeXgressConn.AcceptMessage` to the v2 `MsgSink` signature, which now takes an `edge.SdkChannel` argument. - Replaces the removed `edge.Conn.GetRouterId()` with `RemoteAddr().String()` in the loop4 traffic-test logging. For openziti/sdk-golang#936.
53 lines
1.6 KiB
Go
53 lines
1.6 KiB
Go
/*
|
|
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 handler_xgress
|
|
|
|
import (
|
|
"github.com/openziti/sdk-golang/v2/xgress"
|
|
"github.com/openziti/ziti/v2/router/env"
|
|
"github.com/openziti/ziti/v2/router/metrics"
|
|
)
|
|
|
|
type bindHandler struct {
|
|
dataPlaneAdapter xgress.DataPlaneAdapter
|
|
closeHandler xgress.CloseHandler
|
|
metricsPeekHandler xgress.PeekHandler
|
|
env env.RouterEnv
|
|
}
|
|
|
|
func NewBindHandler(env env.RouterEnv, dataPlaneAdapter xgress.DataPlaneAdapter, closeHandler xgress.CloseHandler) *bindHandler {
|
|
return &bindHandler{
|
|
env: env,
|
|
dataPlaneAdapter: dataPlaneAdapter,
|
|
closeHandler: closeHandler,
|
|
metricsPeekHandler: metrics.NewXgressPeekHandler(env.GetXgressMetrics()),
|
|
}
|
|
}
|
|
|
|
func (bindHandler *bindHandler) HandleXgressBind(x *xgress.Xgress) {
|
|
x.SetDataPlaneAdapter(bindHandler.dataPlaneAdapter)
|
|
x.AddPeekHandler(bindHandler.metricsPeekHandler)
|
|
|
|
x.AddCloseHandler(bindHandler.closeHandler)
|
|
|
|
bindHandler.env.GetForwarder().RegisterDestination(x.CircuitId(), x.Address(), x)
|
|
}
|
|
|
|
func (bindHandler *bindHandler) GetMetricsPeekHandler() xgress.PeekHandler {
|
|
return bindHandler.metricsPeekHandler
|
|
}
|