apiary/honeypot/ports/store.go

27 lines
467 B
Go
Raw Normal View History

2021-10-21 08:33:28 +00:00
package ports
type ConnectionAttempt struct {
Port string
Network string
From string
Data []byte
}
type Store interface {
Add(attempt *ConnectionAttempt) error
List() ([]*ConnectionAttempt, error)
}
type MemoryStore struct {
data []*ConnectionAttempt
}
func (s *MemoryStore) Add(attempt *ConnectionAttempt) error {
s.data = append(s.data, attempt)
return nil
}
func (s *MemoryStore) List() ([]*ConnectionAttempt, error) {
return s.data, nil
}