minor changes
This commit is contained in:
parent
279fba0c57
commit
ba001b4c20
2 changed files with 22 additions and 13 deletions
|
|
@ -14,6 +14,13 @@ healthCheckNodePort
|
|||
|
||||
const Version = "v1"
|
||||
|
||||
type ProxyProtocol string
|
||||
|
||||
const (
|
||||
ProxyProtocolV1 ProxyProtocol = "v1"
|
||||
ProxyProtocolV2 = "v2"
|
||||
)
|
||||
|
||||
type LoadBalancer struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
IP string `json:"ip,omitempty"`
|
||||
|
|
@ -29,11 +36,11 @@ func NewLoadBalancerFromBytes(b []byte) (lb *LoadBalancer, err error) {
|
|||
}
|
||||
|
||||
type Options struct {
|
||||
Frontend []string `json:"frontend,omitempty"`
|
||||
Backend []string `json:"backend,omitempty"`
|
||||
ProxyProtocol string `json:"proxyProtocol,omitempty"`
|
||||
CheckProxyProtocol bool `json:"checkProxyProtocol,omitempty"`
|
||||
DefaultServer string `json:"defaultServer,omitempty`
|
||||
Frontend []string `json:"frontend,omitempty"`
|
||||
Backend []string `json:"backend,omitempty"`
|
||||
ProxyProtocol ProxyProtocol `json:"proxyProtocol,omitempty"`
|
||||
CheckProxyProtocol bool `json:"checkProxyProtocol,omitempty"`
|
||||
DefaultServer string `json:"defaultServer,omitempty`
|
||||
}
|
||||
|
||||
type Port struct {
|
||||
|
|
@ -144,6 +151,11 @@ func (lb LoadBalancer) ValidateServer() error {
|
|||
if lb.CIDR == "" {
|
||||
return errors.New("LoadBalancer.CIDR can not be empty")
|
||||
}
|
||||
switch lb.Options.ProxyProtocol {
|
||||
case "", ProxyProtocolV1, ProxyProtocolV2:
|
||||
default:
|
||||
return errors.New(`LoadBalancer.Options.ProxyProtocol invalid value. (allowed: "", "v1", "v2")`)
|
||||
}
|
||||
err := lb.ValidateClient()
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue