27 lines
467 B
Go
27 lines
467 B
Go
|
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
|
||
|
}
|