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

Method Notify

pkg/csplugin/notifier.go:23–38  ·  view source on GitHub ↗
(ctx context.Context, notification *protobufs.Notification)

Source from the content-addressed store, hash-verified

21}
22
23func (m *GRPCClient) Notify(ctx context.Context, notification *protobufs.Notification) (*protobufs.Empty, error) {
24 done := make(chan error)
25 go func() {
26 _, err := m.client.Notify(
27 ctx, &protobufs.Notification{Text: notification.GetText(), Name: notification.GetName()},
28 )
29 done <- err
30 }()
31 select {
32 case err := <-done:
33 return &protobufs.Empty{}, err
34
35 case <-ctx.Done():
36 return &protobufs.Empty{}, errors.New("timeout exceeded")
37 }
38}
39
40func (m *GRPCClient) Configure(ctx context.Context, config *protobufs.Config) (*protobufs.Empty, error) {
41 _, err := m.client.Configure(ctx, config)

Callers

nothing calls this directly

Calls 3

GetTextMethod · 0.80
NotifyMethod · 0.65
GetNameMethod · 0.65

Tested by

no test coverage detected