diff --git a/pkg/types/constants.go b/pkg/types/constants.go deleted file mode 100644 index ff8e07c5a1e..00000000000 --- a/pkg/types/constants.go +++ /dev/null @@ -1,32 +0,0 @@ -package types - -const ( - ApiKeyAuthType = "api-key" - TlsAuthType = "tls" - PasswordAuthType = "password" -) - -const ( - CscliOrigin = "cscli" - CrowdSecOrigin = "crowdsec" - ConsoleOrigin = "console" - CscliImportOrigin = "cscli-import" - ListOrigin = "lists" - CAPIOrigin = "CAPI" - CommunityBlocklistPullSourceScope = "crowdsecurity/community-blocklist" - RemediationSyncOrigin = "remediation_sync" -) - -const DecisionTypeBan = "ban" - -func GetOrigins() []string { - return []string{ - CscliOrigin, - CrowdSecOrigin, - ConsoleOrigin, - CscliImportOrigin, - ListOrigin, - CAPIOrigin, - RemediationSyncOrigin, - } -} diff --git a/pkg/types/event.go b/pkg/types/event.go deleted file mode 100644 index 60d3967762d..00000000000 --- a/pkg/types/event.go +++ /dev/null @@ -1,31 +0,0 @@ -package types - -import ( - "strings" - -) - -// Move in leakybuckets -const ( - Undefined = "" - Ip = "Ip" - Range = "Range" - Filter = "Filter" - Country = "Country" - AS = "AS" -) - -func NormalizeScope(scope string) string { - switch strings.ToLower(scope) { - case "ip": - return Ip - case "range": - return Range - case "as": - return AS - case "country": - return Country - default: - return scope - } -} diff --git a/pkg/types/types.go b/pkg/types/types.go new file mode 100644 index 00000000000..0c805b8b11a --- /dev/null +++ b/pkg/types/types.go @@ -0,0 +1,73 @@ +package types + +import ( + "strings" +) + +type AuthType = string + +const ( + ApiKeyAuthType AuthType = "api-key" + TlsAuthType AuthType = "tls" + PasswordAuthType AuthType = "password" +) + +type DecisionType = string + +const ( + DecisionTypeBan DecisionType = "ban" + // TODO: add captcha, fix name.. +) + +type Origin = string + +const ( + CscliOrigin Origin = "cscli" + CrowdSecOrigin Origin = "crowdsec" + ConsoleOrigin Origin = "console" + CscliImportOrigin Origin = "cscli-import" + ListOrigin Origin = "lists" + CAPIOrigin Origin = "CAPI" + CommunityBlocklistPullSourceScope Origin = "crowdsecurity/community-blocklist" + RemediationSyncOrigin Origin = "remediation_sync" +) + +func GetOrigins() []Origin { + return []Origin{ + CscliOrigin, + CrowdSecOrigin, + ConsoleOrigin, + CscliImportOrigin, + ListOrigin, + CAPIOrigin, + RemediationSyncOrigin, + } +} + +type Scope = string + +// Move in leakybuckets +const ( + // TODO: fix names + Undefined Scope = "" + Ip Scope = "Ip" + Range Scope = "Range" + Filter Scope = "Filter" + Country Scope = "Country" + AS Scope = "AS" +) + +func NormalizeScope(strScope string) Scope { + switch strings.ToLower(strScope) { + case "ip": + return Ip + case "range": + return Range + case "as": + return AS + case "country": + return Country + default: + return strScope + } +}