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

Function GetMachineIP

pkg/apiserver/apiserver_test.go:197–213  ·  view source on GitHub ↗
(t *testing.T, machineID string, config *csconfig.DatabaseCfg)

Source from the content-addressed store, hash-verified

195}
196
197func GetMachineIP(t *testing.T, machineID string, config *csconfig.DatabaseCfg) string {
198 ctx := t.Context()
199
200 dbClient, err := database.NewClient(ctx, config, nil)
201 require.NoError(t, err)
202
203 machines, err := dbClient.ListMachines(ctx)
204 require.NoError(t, err)
205
206 for _, machine := range machines {
207 if machine.MachineId == machineID {
208 return machine.IpAddress
209 }
210 }
211
212 return ""
213}
214
215func GetBouncers(t *testing.T, config *csconfig.DatabaseCfg) []*ent.Bouncer {
216 ctx := t.Context()

Calls 2

ListMachinesMethod · 0.95
NewClientFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…