Fix linter warnings

This commit is contained in:
Daniel 2023-11-22 14:01:53 +01:00
parent bd988724c4
commit 8ac80c2a12
7 changed files with 13 additions and 9 deletions

View file

@ -116,6 +116,7 @@ type updateProfileIconResponse struct {
Filename string `json:"filename"` Filename string `json:"filename"`
} }
//nolint:goconst
func handleUpdateProfileIcon(ar *api.Request) (any, error) { func handleUpdateProfileIcon(ar *api.Request) (any, error) {
// Check input. // Check input.
if len(ar.InputData) == 0 { if len(ar.InputData) == 0 {

View file

@ -672,7 +672,7 @@ Current Features:
- Disable Firefox' internal DNS-over-HTTPs resolver - Disable Firefox' internal DNS-over-HTTPs resolver
- Block direct access to public DNS resolvers - Block direct access to public DNS resolvers
Please note that DNS bypass attempts might be additionally blocked in the Sytem D there too.`, Please note that DNS bypass attempts might be additionally blocked in the System DNS Client App.`,
OptType: config.OptTypeInt, OptType: config.OptTypeInt,
ExpertiseLevel: config.ExpertiseLevelUser, ExpertiseLevel: config.ExpertiseLevelUser,
ReleaseLevel: config.ReleaseLevelStable, ReleaseLevel: config.ReleaseLevelStable,

View file

@ -163,7 +163,8 @@ func (fp fingerprintRegex) Match(value string) (score int) {
return 0 return 0
} }
type parsedFingerprints struct { // ParsedFingerprints holds parsed fingerprints for fast usage.
type ParsedFingerprints struct {
tagPrints []matchingFingerprint tagPrints []matchingFingerprint
envPrints []matchingFingerprint envPrints []matchingFingerprint
pathPrints []matchingFingerprint pathPrints []matchingFingerprint
@ -171,8 +172,8 @@ type parsedFingerprints struct {
} }
// ParseFingerprints parses the fingerprints to make them ready for matching. // ParseFingerprints parses the fingerprints to make them ready for matching.
func ParseFingerprints(raw []Fingerprint, deprecatedLinkedPath string) (parsed *parsedFingerprints, firstErr error) { func ParseFingerprints(raw []Fingerprint, deprecatedLinkedPath string) (parsed *ParsedFingerprints, firstErr error) {
parsed = &parsedFingerprints{} parsed = &ParsedFingerprints{}
// Add deprecated LinkedPath to fingerprints, if they are empty. // Add deprecated LinkedPath to fingerprints, if they are empty.
// TODO: Remove in v1.5 // TODO: Remove in v1.5
@ -239,7 +240,7 @@ func ParseFingerprints(raw []Fingerprint, deprecatedLinkedPath string) (parsed *
return parsed, firstErr return parsed, firstErr
} }
func (parsed *parsedFingerprints) addMatchingFingerprint(fp Fingerprint, matchingPrint matchingFingerprint) { func (parsed *ParsedFingerprints) addMatchingFingerprint(fp Fingerprint, matchingPrint matchingFingerprint) {
switch fp.Type { switch fp.Type {
case FingerprintTypeTagID: case FingerprintTypeTagID:
parsed.tagPrints = append(parsed.tagPrints, matchingPrint) parsed.tagPrints = append(parsed.tagPrints, matchingPrint)
@ -257,7 +258,7 @@ func (parsed *parsedFingerprints) addMatchingFingerprint(fp Fingerprint, matchin
// MatchFingerprints returns the highest matching score of the given // MatchFingerprints returns the highest matching score of the given
// fingerprints and matching data. // fingerprints and matching data.
func MatchFingerprints(prints *parsedFingerprints, md MatchingData) (highestScore int) { func MatchFingerprints(prints *ParsedFingerprints, md MatchingData) (highestScore int) {
// Check tags. // Check tags.
tags := md.Tags() tags := md.Tags()
if len(tags) > 0 { if len(tags) > 0 {

View file

@ -257,7 +257,7 @@ profileFeed:
return profile, nil return profile, nil
} }
func loadProfileFingerprints(r record.Record) (parsed *parsedFingerprints, err error) { func loadProfileFingerprints(r record.Record) (parsed *ParsedFingerprints, err error) {
// Ensure it's a profile. // Ensure it's a profile.
profile, err := EnsureProfile(r) profile, err := EnsureProfile(r)
if err != nil { if err != nil {

View file

@ -103,6 +103,7 @@ var iconDB = database.NewInterface(&database.Options{
Internal: true, Internal: true,
}) })
// IconInDatabase represents an icon saved to the database.
type IconInDatabase struct { type IconInDatabase struct {
sync.Mutex sync.Mutex
record.Base record.Base

View file

@ -21,7 +21,7 @@ import (
) )
// ProfileSource is the source of the profile. // ProfileSource is the source of the profile.
type ProfileSource string type ProfileSource string //nolint:golint
// Profile Sources. // Profile Sources.
const ( const (

View file

@ -8,11 +8,12 @@ import (
"strings" "strings"
"time" "time"
"github.com/vincent-petithory/dataurl"
"github.com/safing/portbase/api" "github.com/safing/portbase/api"
"github.com/safing/portbase/config" "github.com/safing/portbase/config"
"github.com/safing/portbase/log" "github.com/safing/portbase/log"
"github.com/safing/portmaster/profile" "github.com/safing/portmaster/profile"
"github.com/vincent-petithory/dataurl"
) )
// ProfileExport holds an export of a profile. // ProfileExport holds an export of a profile.