mirror of
https://github.com/openziti/ziti.git
synced 2026-10-13 23:59:53 +00:00
Update links to use channel library
This commit is contained in:
@@ -149,7 +149,7 @@ func (c *Controller) Run() error {
|
||||
if err := c.mgmtListener.Listen(c.mgmtConnectHandler); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
mgmtAccepter := handler_mgmt.NewMgmtAccepter(c.mgmtListener, c.config.Mgmt.Options)
|
||||
mgmtAccepter := handler_mgmt.NewMgmtAccepter(c.network, c.xmgmts, c.mgmtListener, c.config.Mgmt.Options)
|
||||
go mgmtAccepter.Run()
|
||||
|
||||
/*
|
||||
@@ -253,8 +253,6 @@ func (c *Controller) registerComponents() error {
|
||||
c.ctrlConnectHandler = handler_ctrl.NewConnectHandler(c.config.Id, c.network, c.xctrls)
|
||||
c.mgmtConnectHandler = handler_mgmt.NewConnectHandler(c.config.Id, c.network)
|
||||
|
||||
c.config.Mgmt.Options.BindHandler = handler_mgmt.NewBindHandler(c.network, c.xmgmts)
|
||||
|
||||
//add default REST XWeb
|
||||
if err := c.RegisterXweb(xweb.NewXwebImpl(c.xwebFactoryRegistry, c.config.Id)); err != nil {
|
||||
return err
|
||||
|
||||
@@ -51,10 +51,8 @@ func (self *CtrlAccepter) Run() {
|
||||
log.Info("started")
|
||||
defer log.Warn("exited")
|
||||
|
||||
self.options.SetBindHandlerF(self.Bind)
|
||||
|
||||
for {
|
||||
_, err := channel.NewChannel("ctrl", self.listener, self.options)
|
||||
_, err := channel.NewChannel("ctrl", self.listener, channel.BindHandlerF(self.Bind), self.options)
|
||||
if err != nil {
|
||||
log.WithError(err).Error("error accepting control channel connection")
|
||||
if err.Error() == "closed" {
|
||||
|
||||
@@ -19,28 +19,38 @@ package handler_mgmt
|
||||
import (
|
||||
"github.com/michaelquigley/pfxlog"
|
||||
"github.com/openziti/channel"
|
||||
"github.com/openziti/fabric/controller/network"
|
||||
"github.com/openziti/fabric/controller/xmgmt"
|
||||
)
|
||||
|
||||
type MgmtAccepter struct {
|
||||
listener channel.UnderlayListener
|
||||
options *channel.Options
|
||||
network *network.Network
|
||||
xmgmts []xmgmt.Xmgmt
|
||||
}
|
||||
|
||||
func NewMgmtAccepter(listener channel.UnderlayListener,
|
||||
func NewMgmtAccepter(network *network.Network,
|
||||
xmgmts []xmgmt.Xmgmt,
|
||||
listener channel.UnderlayListener,
|
||||
options *channel.Options) *MgmtAccepter {
|
||||
return &MgmtAccepter{
|
||||
network: network,
|
||||
xmgmts: xmgmts,
|
||||
listener: listener,
|
||||
options: options,
|
||||
}
|
||||
}
|
||||
|
||||
func (mgmtAccepter *MgmtAccepter) Run() {
|
||||
func (self *MgmtAccepter) Run() {
|
||||
log := pfxlog.Logger()
|
||||
log.Info("started")
|
||||
defer log.Warn("exited")
|
||||
|
||||
bindHandler := NewBindHandler(self.network, self.xmgmts)
|
||||
|
||||
for {
|
||||
ch, err := channel.NewChannel("mgmt", mgmtAccepter.listener, mgmtAccepter.options)
|
||||
ch, err := channel.NewChannel("mgmt", self.listener, bindHandler, self.options)
|
||||
if err == nil {
|
||||
log.Debugf("accepted mgmt connection [%s]", ch.Id().Token)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user