Implement Equaler
This commit is contained in:
parent
75a4a61254
commit
92eeb7828b
12 changed files with 560 additions and 31 deletions
|
|
@ -44,7 +44,7 @@ type External struct {
|
|||
SigninURL string `json:"signinUrl"`
|
||||
Method string `json:"method"`
|
||||
SendBody bool `json:"sendBody"`
|
||||
ResponseHeaders []string `json:"responseHeaders"`
|
||||
ResponseHeaders []string `json:"responseHeaders,omitEmpty"`
|
||||
}
|
||||
|
||||
func (e1 *External) Equal(e2 *External) bool {
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ const (
|
|||
// AuthSSLConfig contains the AuthSSLCert used for muthual autentication
|
||||
// and the configured ValidationDepth
|
||||
type AuthSSLConfig struct {
|
||||
AuthSSLCert resolver.AuthSSLCert
|
||||
ValidationDepth int `json:"validationDepth"`
|
||||
AuthSSLCert resolver.AuthSSLCert `json:"authSSLCert"`
|
||||
ValidationDepth int `json:"validationDepth"`
|
||||
}
|
||||
|
||||
func (assl1 *AuthSSLConfig) Equal(assl2 *AuthSSLConfig) bool {
|
||||
|
|
@ -47,7 +47,7 @@ func (assl1 *AuthSSLConfig) Equal(assl2 *AuthSSLConfig) bool {
|
|||
if assl1 == nil || assl2 == nil {
|
||||
return false
|
||||
}
|
||||
if (&assl1.AuthSSLCert).Equal(&assl2.AuthSSLCert) {
|
||||
if !(&assl1.AuthSSLCert).Equal(&assl2.AuthSSLCert) {
|
||||
return false
|
||||
}
|
||||
if assl1.ValidationDepth != assl2.ValidationDepth {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ const (
|
|||
|
||||
// SourceRange returns the CIDR
|
||||
type SourceRange struct {
|
||||
CIDR []string `json:"cidr"`
|
||||
CIDR []string `json:"cidr,omitEmpty"`
|
||||
}
|
||||
|
||||
func (sr1 *SourceRange) Equal(sr2 *SourceRange) bool {
|
||||
|
|
@ -47,6 +47,10 @@ func (sr1 *SourceRange) Equal(sr2 *SourceRange) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
if len(sr1.CIDR) != len(sr2.CIDR) {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, s1l := range sr1.CIDR {
|
||||
found := false
|
||||
for _, sl2 := range sr2.CIDR {
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ func (rt1 *RateLimit) Equal(rt2 *RateLimit) bool {
|
|||
if rt1 == nil || rt2 == nil {
|
||||
return false
|
||||
}
|
||||
if (&rt1.Connections).Equal(&rt2.Connections) {
|
||||
if !(&rt1.Connections).Equal(&rt2.Connections) {
|
||||
return false
|
||||
}
|
||||
if (&rt1.RPS).Equal(&rt2.RPS) {
|
||||
if !(&rt1.RPS).Equal(&rt2.RPS) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package secureupstream
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
extensions "k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||
|
||||
|
|
@ -32,8 +33,8 @@ const (
|
|||
|
||||
// Secure describes SSL backend configuration
|
||||
type Secure struct {
|
||||
Secure bool
|
||||
CACert resolver.AuthSSLCert
|
||||
Secure bool `json:"secure"`
|
||||
CACert resolver.AuthSSLCert `json:"caCert"`
|
||||
}
|
||||
|
||||
type su struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue