Files
Paul Lorenz 08aa26a051 Rename single-underlay channel constructors for channel/v5. For #3983
- channel.NewChannel(name, factory, bindHandler, opts) -> channel.NewSingleChannel(...)
- channel.NewChannelWithUnderlay(...) -> channel.NewSingleChannelWithUnderlay(...)

channel/v5 repurposes NewChannel for the unified multi-underlay constructor, so the
single-underlay call sites move to the renamed helpers. Mechanical rename only; like the
preceding import commit it does not build on its own.
2026-06-18 12:51:02 -04:00

27 lines
904 B
Go

package testutil
import (
"time"
"github.com/openziti/channel/v5"
"github.com/openziti/ziti/v2/common/handler_common"
"github.com/openziti/ziti/v2/common/pb/ctrl_pb"
"github.com/stretchr/testify/require"
)
func AcceptControl(id string, uf channel.UnderlayFactory, assertions *require.Assertions) (channel.Channel, *MessageCollector) {
msgc := NewMessageCollector(id)
bindHandler := func(binding channel.Binding) error {
binding.AddReceiveHandler(channel.AnyContentType, msgc)
binding.AddReceiveHandlerF(int32(ctrl_pb.ContentType_VerifyRouterType), func(msg *channel.Message, ch channel.Channel) {
handler_common.SendSuccess(msg, ch, "link success")
})
return nil
}
timeoutUF := NewTimeoutUnderlayFactory(uf, 2*time.Second)
ch, err := channel.NewSingleChannel(id, timeoutUF, channel.BindHandlerF(bindHandler), channel.DefaultOptions())
assertions.NoError(err)
return ch, msgc
}