mirror of
https://github.com/openziti/ziti.git
synced 2026-09-10 16:55:41 +00:00
c367679e79
* fixes openziti/ziti#3626 omit overlay bind points from /versions apiBaseUrls - adds BindPointTypeUnderlay and BindPointTypeOverlay constants - implements Type() on UnderlayBindPoint and OverlayBindPoint - skips non-underlay bind points when building apiBaseUrls in version_router - skips non-underlay bind points in GetApiAddresses - adds unit tests for Type() on both bind point implementations - updates xweb
59 lines
2.2 KiB
Go
59 lines
2.2 KiB
Go
/*
|
|
Copyright NetFoundry Inc.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
https://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package bindpoints
|
|
|
|
import (
|
|
"github.com/openziti/xweb/v3"
|
|
)
|
|
|
|
const (
|
|
BindPointTypeUnderlay xweb.BindPointType = "underlay"
|
|
BindPointTypeOverlay xweb.BindPointType = "overlay"
|
|
)
|
|
|
|
// BindPointListenerFactory implements the xweb.BindPointListenerFactory.
|
|
// It provides a factory that generates xweb.BindPoints based on the provided config section
|
|
type BindPointListenerFactory struct {
|
|
}
|
|
|
|
// New checks to see if this BindPoint is for overlay or underlay then calls the expected func.
|
|
// As of now there are only two types, OverlayBindPoint and UnderlayBindPoint
|
|
func (c *BindPointListenerFactory) New(conf map[interface{}]interface{}) (xweb.BindPoint, error) {
|
|
if conf["identity"] != nil {
|
|
return newOverlayBindPoint(conf)
|
|
} else { // only two options right now. underlay and overlay...
|
|
return newUnderlayBindPoint(conf, false)
|
|
}
|
|
}
|
|
|
|
// LegacyBindPointListenerFactory implements the xweb.LegacyBindPointListenerFactory.
|
|
// It provides a factory that generates xweb.LegacyBindPoints based on the provided config section. It also
|
|
// allows for "legacy" validation, specifically with respect to web.bindPoints.addresses where 0.0.0.0 was previously
|
|
// considered a valid address.
|
|
type LegacyBindPointListenerFactory struct {
|
|
}
|
|
|
|
// New checks to see if this LegacyBindPoint is for overlay or underlay then calls the expected func.
|
|
// As of now there are only two types, OverlayLegacyBindPoint and UnderlayLegacyBindPoint
|
|
func (c *LegacyBindPointListenerFactory) New(conf map[interface{}]interface{}) (xweb.BindPoint, error) {
|
|
if conf["identity"] != nil {
|
|
return newOverlayBindPoint(conf)
|
|
} else { // only two options right now. underlay and overlay...
|
|
return newUnderlayBindPoint(conf, true)
|
|
}
|
|
}
|