diff --git a/internal/configs/ingress.go b/internal/configs/ingress.go index 1dc1ef6f76..1865b84ccb 100644 --- a/internal/configs/ingress.go +++ b/internal/configs/ingress.go @@ -48,6 +48,7 @@ type IngressEx struct { SecretRefs map[string]*secrets.SecretReference } +// DosEx holds a DosProtectedResource and the dos policy and log confs it references. type DosEx struct { DosProtected *v1beta1.DosProtectedResource DosPolicy *unstructured.Unstructured diff --git a/internal/k8s/appprotect/app_protect_configuration.go b/internal/k8s/appprotect/app_protect_configuration.go index f984cf8b9c..9a1f4e611b 100644 --- a/internal/k8s/appprotect/app_protect_configuration.go +++ b/internal/k8s/appprotect/app_protect_configuration.go @@ -588,7 +588,7 @@ func (fc *FakeConfiguration) AddOrUpdateLogConf(logConfObj *unstructured.Unstruc } // AddOrUpdateUserSig adds or updates App Protect User Defined Signature to App Protect Configuration -func (fc *FakeConfiguration) AddOrUpdateUserSig(userSigObj *unstructured.Unstructured) (change UserSigChange, problems []Problem) { +func (fc *FakeConfiguration) AddOrUpdateUserSig(_ *unstructured.Unstructured) (change UserSigChange, problems []Problem) { return change, problems } @@ -610,16 +610,16 @@ func (fc *FakeConfiguration) GetAppResource(kind, key string) (*unstructured.Uns } // DeletePolicy deletes an App Protect Policy from App Protect Configuration -func (fc *FakeConfiguration) DeletePolicy(key string) (changes []Change, problems []Problem) { +func (fc *FakeConfiguration) DeletePolicy(_ string) (changes []Change, problems []Problem) { return changes, problems } // DeleteLogConf deletes an App Protect Log Configuration from App Protect Configuration -func (fc *FakeConfiguration) DeleteLogConf(key string) (changes []Change, problems []Problem) { +func (fc *FakeConfiguration) DeleteLogConf(_ string) (changes []Change, problems []Problem) { return changes, problems } // DeleteUserSig deletes an App Protect User Defined Signature from App Protect Configuration -func (fc *FakeConfiguration) DeleteUserSig(key string) (change UserSigChange, problems []Problem) { +func (fc *FakeConfiguration) DeleteUserSig(_ string) (change UserSigChange, problems []Problem) { return change, problems } diff --git a/internal/k8s/appprotectdos/app_protect_dos_configuration.go b/internal/k8s/appprotectdos/app_protect_dos_configuration.go index 4ccdcbd40f..bc76d5cb59 100644 --- a/internal/k8s/appprotectdos/app_protect_dos_configuration.go +++ b/internal/k8s/appprotectdos/app_protect_dos_configuration.go @@ -266,6 +266,7 @@ func getNsName(defaultNamespace string, name string) string { return name } +// GetDosProtectedThatReferencedDosPolicy gets dos protected resources that mention the given dos policy func (ci *Configuration) GetDosProtectedThatReferencedDosPolicy(key string) []*v1beta1.DosProtectedResource { var protectedResources []*v1beta1.DosProtectedResource for _, protectedEx := range ci.dosProtectedResource { @@ -278,6 +279,7 @@ func (ci *Configuration) GetDosProtectedThatReferencedDosPolicy(key string) []*v return protectedResources } +// GetDosProtectedThatReferencedDosLogConf gets dos protected resources that mention the given dos log conf func (ci *Configuration) GetDosProtectedThatReferencedDosLogConf(key string) []*v1beta1.DosProtectedResource { var protectedResources []*v1beta1.DosProtectedResource for _, protectedEx := range ci.dosProtectedResource { diff --git a/internal/metrics/syslog_listener.go b/internal/metrics/syslog_listener.go index cacf7733a8..d15dc22c0f 100644 --- a/internal/metrics/syslog_listener.go +++ b/internal/metrics/syslog_listener.go @@ -63,17 +63,13 @@ func (l LatencyMetricsListener) Stop() { func isErrorRecoverable(err error) bool { var nerr *net.OpError - if errors.As(err, &nerr) && nerr.Temporary() { - return true - } else { - return false - } + return errors.As(err, &nerr) && nerr.Temporary() } // SyslogFakeListener is a fake implementation of the SyslogListener interface type SyslogFakeListener struct{} -// NewFakeSyslogServer returns a SyslogFakeListener +// NewSyslogFakeServer returns a SyslogFakeListener func NewSyslogFakeServer() *SyslogFakeListener { return &SyslogFakeListener{} } diff --git a/pkg/apis/configuration/v1/types.go b/pkg/apis/configuration/v1/types.go index a6136ebd9c..bb84e5b724 100644 --- a/pkg/apis/configuration/v1/types.go +++ b/pkg/apis/configuration/v1/types.go @@ -299,6 +299,7 @@ type VirtualServerRouteSpec struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// VirtualServerRouteList is a list of VirtualServerRoute type VirtualServerRouteList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata"` diff --git a/pkg/apis/configuration/v1alpha1/register.go b/pkg/apis/configuration/v1alpha1/register.go index a6e7301c05..22c1aa7327 100644 --- a/pkg/apis/configuration/v1alpha1/register.go +++ b/pkg/apis/configuration/v1alpha1/register.go @@ -21,8 +21,10 @@ func Resource(resource string) schema.GroupResource { } var ( + // SchemeBuilder build a scheme SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme + // AddToScheme exported add function + AddToScheme = SchemeBuilder.AddToScheme ) // Adds the list of known types to Scheme. diff --git a/pkg/apis/dos/register.go b/pkg/apis/dos/register.go index f446244e9c..ba5c19a015 100644 --- a/pkg/apis/dos/register.go +++ b/pkg/apis/dos/register.go @@ -1,5 +1,6 @@ package dos const ( + // GroupName the name of the group used by kubernetes. GroupName = "appprotectdos.f5.com" )