Files
ziti/controller/handler_ctrl/trace.go
T
Paul Lorenz 1c122af490 Rewrite channel/v4 imports to channel/v5. For #3983
- moves the channel dependency to channel/v5 v5.0.10 and sdk-golang to v1.9.0 in the root and zititest modules
- mechanically rewrites every channel/v4 import path to channel/v5

This is the import-path-only step; the API-level changes the switch requires land in the following commit. This commit does not build on its own.
2026-06-18 12:51:02 -04:00

32 lines
862 B
Go

package handler_ctrl
import (
"github.com/michaelquigley/pfxlog"
"github.com/openziti/channel/v5"
"github.com/openziti/channel/v5/trace/pb"
"github.com/openziti/ziti/v2/common/pb/ctrl_pb"
"github.com/openziti/ziti/v2/common/trace"
"google.golang.org/protobuf/proto"
)
type traceHandler struct {
dispatcher trace.EventHandler
}
func newTraceHandler(dispatcher trace.EventHandler) *traceHandler {
return &traceHandler{dispatcher: dispatcher}
}
func (*traceHandler) ContentType() int32 {
return int32(ctrl_pb.ContentType_TraceEventType)
}
func (handler *traceHandler) HandleReceive(msg *channel.Message, _ channel.Channel) {
event := &trace_pb.ChannelMessage{}
if err := proto.Unmarshal(msg.Body, event); err == nil {
go handler.dispatcher.Accept(event)
} else {
pfxlog.Logger().Errorf("unexpected error decoding trace message (%s)", err)
}
}