mirror of
https://github.com/openziti/ziti.git
synced 2026-10-15 08:31:50 +00:00
Don't require listener address, as not every xgress impl needs one
This commit is contained in:
@@ -297,10 +297,6 @@ func LoadConfig(path string) (*Config, error) {
|
||||
if !found {
|
||||
return nil, fmt.Errorf("[listener] must provide [binding] (%v)", submap)
|
||||
}
|
||||
_, found = submap["address"]
|
||||
if !found {
|
||||
return nil, fmt.Errorf("[listener] must provide [address] (%v)", submap)
|
||||
}
|
||||
cfg.Listeners = append(cfg.Listeners, listenerBinding{name: binding, options: submap})
|
||||
}
|
||||
}
|
||||
|
||||
+16
-12
@@ -272,19 +272,23 @@ func (self *Router) startXgressListeners() {
|
||||
logrus.Fatalf("error creating xgress listener [%s] (%v)", binding.name, err)
|
||||
}
|
||||
self.xgressListeners = append(self.xgressListeners, listener)
|
||||
if address, found := binding.options["address"]; found {
|
||||
err = listener.Listen(address.(string),
|
||||
handler_xgress.NewBindHandler(
|
||||
handler_xgress.NewReceiveHandler(self.forwarder),
|
||||
handler_xgress.NewCloseHandler(self, self.forwarder),
|
||||
self.forwarder,
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
logrus.Fatalf("error listening [%s] (%v)", binding.name, err)
|
||||
}
|
||||
logrus.Infof("created xgress listener [%s] at [%s]", binding.name, address)
|
||||
|
||||
var address string
|
||||
if addressVal, found := binding.options["address"]; found {
|
||||
address = addressVal.(string)
|
||||
}
|
||||
|
||||
err = listener.Listen(address,
|
||||
handler_xgress.NewBindHandler(
|
||||
handler_xgress.NewReceiveHandler(self.forwarder),
|
||||
handler_xgress.NewCloseHandler(self, self.forwarder),
|
||||
self.forwarder,
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
logrus.Fatalf("error listening [%s] (%v)", binding.name, err)
|
||||
}
|
||||
logrus.Infof("created xgress listener [%s] at [%s]", binding.name, address)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package xgress_proxy
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/michaelquigley/pfxlog"
|
||||
"github.com/openziti/fabric/router/xgress"
|
||||
@@ -36,6 +37,9 @@ func newListener(id *identity.TokenId, ctrl xgress.CtrlChannel, options *xgress.
|
||||
}
|
||||
|
||||
func (listener *listener) Listen(address string, bindHandler xgress.BindHandler) error {
|
||||
if address == "" {
|
||||
return errors.New("address must be specified for proxy listeners")
|
||||
}
|
||||
txAddress, err := transport.ParseAddress(address)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot listen on invalid address [%s] (%s)", address, err)
|
||||
|
||||
@@ -21,12 +21,16 @@ import (
|
||||
"github.com/openziti/fabric/router/xgress"
|
||||
"github.com/openziti/fabric/router/xgress_udp"
|
||||
"github.com/openziti/foundation/util/info"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (l *listener) Listen(address string, bindHandler xgress.BindHandler) error {
|
||||
if address == "" {
|
||||
return errors.New("address must be specified for proxy_udp listeners")
|
||||
}
|
||||
l.address = address
|
||||
l.bindHandler = bindHandler
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package xgress_transport
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/michaelquigley/pfxlog"
|
||||
"github.com/openziti/fabric/router/xgress"
|
||||
@@ -43,6 +44,9 @@ func newListener(id *identity.TokenId, ctrl xgress.CtrlChannel, options *xgress.
|
||||
}
|
||||
|
||||
func (listener *listener) Listen(address string, bindHandler xgress.BindHandler) error {
|
||||
if address == "" {
|
||||
return errors.New("address must be specified for transport listeners")
|
||||
}
|
||||
txAddress, err := transport.ParseAddress(address)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot listen on invalid address [%s] (%s)", address, err)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package xgress_transport_udp
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/michaelquigley/pfxlog"
|
||||
"github.com/openziti/fabric/router/xgress"
|
||||
@@ -28,6 +29,9 @@ import (
|
||||
)
|
||||
|
||||
func (l *listener) Listen(address string, bindHandler xgress.BindHandler) error {
|
||||
if address == "" {
|
||||
return errors.New("address must be specified for transport_udp listeners")
|
||||
}
|
||||
l.address = address
|
||||
l.bindHandler = bindHandler
|
||||
|
||||
|
||||
Reference in New Issue
Block a user