MCPcopy
hub / github.com/crowdsecurity/crowdsec / NewLongPollClient

Function NewLongPollClient

pkg/longpollclient/client.go:262–281  ·  view source on GitHub ↗
(config LongPollClientConfig)

Source from the content-addressed store, hash-verified

260}
261
262func NewLongPollClient(config LongPollClientConfig) (*LongPollClient, error) {
263 var logger *log.Entry
264 if config.Url == (url.URL{}) {
265 return nil, errors.New("url is required")
266 }
267 if config.Logger == nil {
268 logger = log.WithField("component", "longpollclient")
269 } else {
270 logger = config.Logger.WithFields(log.Fields{
271 "component": "longpollclient",
272 "url": config.Url.String(),
273 })
274 }
275
276 return &LongPollClient{
277 url: config.Url,
278 logger: logger,
279 httpClient: config.HttpClient,
280 }, nil
281}

Callers 1

NewPAPIFunction · 0.92

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…