Files
zeekay 241625e7d9 rename: ziti → zt across all paths
- Repo names: ziti-* → zt-*
- Go modules: github.com/hanzozt/ziti → github.com/hanzozt/zt
- Docker images: hanzozt/ziti-* → hanzozt/zt-*
- C/Java/JS symbols: ziti_* → zt_*
- File and directory names updated
2026-02-18 18:34:19 -08:00

32 lines
854 B
Go

package handler_ctrl
import (
"github.com/michaelquigley/pfxlog"
"github.com/hanzozt/channel/v4"
"github.com/hanzozt/channel/v4/trace/pb"
"github.com/hanzozt/zt/v2/common/pb/ctrl_pb"
"github.com/hanzozt/zt/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)
}
}