2022-10-07 09:05:35 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/aquasecurity/table"
|
|
|
|
|
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/database/ent"
|
2024-02-23 15:05:01 +00:00
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/emoji"
|
2022-10-07 09:05:35 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func getBouncersTable(out io.Writer, bouncers []*ent.Bouncer) {
|
|
|
|
t := newLightTable(out)
|
|
|
|
t.SetHeaders("Name", "IP Address", "Valid", "Last API pull", "Type", "Version", "Auth Type")
|
|
|
|
t.SetHeaderAlignment(table.AlignLeft, table.AlignLeft, table.AlignLeft, table.AlignLeft, table.AlignLeft, table.AlignLeft)
|
|
|
|
t.SetAlignment(table.AlignLeft, table.AlignLeft, table.AlignLeft, table.AlignLeft, table.AlignLeft, table.AlignLeft)
|
|
|
|
|
|
|
|
for _, b := range bouncers {
|
2024-02-23 15:05:01 +00:00
|
|
|
revoked := emoji.CheckMark
|
|
|
|
if b.Revoked {
|
|
|
|
revoked = emoji.Prohibited
|
2022-10-07 09:05:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
t.AddRow(b.Name, b.IPAddress, revoked, b.LastPull.Format(time.RFC3339), b.Type, b.Version, b.AuthType)
|
|
|
|
}
|
|
|
|
|
|
|
|
t.Render()
|
|
|
|
}
|