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

Method String

pkg/models/helpers.go:91–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

89}
90
91func (s *Source) String() string {
92 if s == nil || s.Scope == nil || *s.Scope == "" {
93 return "empty source"
94 }
95
96 cn := s.Cn
97
98 if s.AsNumber != "" {
99 cn += "/" + s.AsNumber
100 }
101
102 if cn != "" {
103 cn = " (" + cn + ")"
104 }
105
106 switch *s.Scope {
107 case Ip:
108 return "ip " + *s.Value + cn
109 case Range:
110 return "range " + *s.Value + cn
111 default:
112 return *s.Scope + " " + *s.Value
113 }
114}
115
116func (a *Alert) FormatAsStrings(machineID string, logger *log.Logger) []string {
117 src := a.Source.String()

Callers 15

searchHandlerFunction · 0.45
verboseDescriptionMethod · 0.45
compactDescriptionMethod · 0.45
doQueryMethod · 0.45
NewLongPollClientFunction · 0.45
global.goFile · 0.45
FullStringFunction · 0.45
FetchIndexMethod · 0.45
FetchContentMethod · 0.45
safeStringFunction · 0.45
getUUIDFunction · 0.45
FormatAlertsFunction · 0.45

Calls

no outgoing calls

Tested by 1

searchHandlerFunction · 0.36