-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support AS and country bans #7
Conversation
Signed-off-by: Shivam Sandbhor <shivam@crowdsec.net>
Signed-off-by: Shivam Sandbhor <shivam@crowdsec.net>
Signed-off-by: Shivam Sandbhor <shivam@crowdsec.net>
Signed-off-by: Shivam Sandbhor <shivam@crowdsec.net>
Signed-off-by: Shivam Sandbhor <shivam@crowdsec.net>
@@ -83,62 +159,24 @@ func (worker *CloudflareWorker) deleteExistingIPList() error { | |||
|
|||
func (worker *CloudflareWorker) removeIPListDependencies() error { | |||
zones, err := worker.API.ListZones(worker.Ctx) | |||
zoneIDs := make([]string, len(zones)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think you can use extractZoneIDs()
here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, extractZoneIDs()
requires https://github.com/sbs2001/cs-cloudflare-bouncer/blob/b30d2fe458fac91d156abc3d972b2d3bc9737a25/config.go#L14 . While worker.API.ListZones(worker.Ctx) gives https://pkg.go.dev/github.com/cloudflare/cloudflare-go#Zone
cloudflare.go
Outdated
IP: *decision.Value, | ||
Comment: "Added by crowdsec bouncer", | ||
}] = true | ||
if strings.ToUpper(*decision.Scope) == "IP" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use switch instead of else/if please?
cloudflare.go
Outdated
} | ||
|
||
if strings.ToUpper(*decision.Scope) == "IP" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use switch instead of else/if please?
Signed-off-by: Shivam Sandbhor <shivam@crowdsec.net>
No description provided.