mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-18 07:14:03 +02:00
19 lines
520 B
Go
19 lines
520 B
Go
package cti
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
const CTIBaseURL = "https://cti.api.crowdsec.net/v2"
|
|
|
|
// NewCTIClient creates a new CTI client with the correct URL and any required configuration.
|
|
func NewCTIClient(apiKey string, opts ...ClientOption) (*ClientWithResponses, error) {
|
|
provider, err := NewAPIKeyProvider(apiKey)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("failed to create API key provider: %w", err)
|
|
}
|
|
|
|
opts = append(opts, WithRequestEditorFn(provider.Intercept))
|
|
|
|
return NewClientWithResponses(CTIBaseURL, opts...)
|
|
}
|