Update dependencies and fix some linter warnings
This commit is contained in:
@@ -41,7 +41,7 @@ func (s *PostgresStore) Add(attempt *ConnectionAttempt) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
defer tx.Rollback() // nolint: errcheck
|
||||
|
||||
_, err = tx.Exec(stmt, time.Now(), attempt.From, attempt.Port)
|
||||
if err != nil {
|
||||
|
@@ -25,7 +25,11 @@ func New(store Store) *Server {
|
||||
func (s *Server) Start(ctx context.Context) error {
|
||||
for _, port := range s.EnabledPortsTCP {
|
||||
portCtx, cancel := context.WithCancel(ctx)
|
||||
go s.doListenTCP(portCtx, port)
|
||||
go func() {
|
||||
if err := s.doListenTCP(portCtx, port); err != nil {
|
||||
s.Logger.Errorw("Unable to listen to port.", "err", err)
|
||||
}
|
||||
}()
|
||||
defer cancel()
|
||||
}
|
||||
|
||||
@@ -72,7 +76,9 @@ func (s *Server) doListenTCP(ctx context.Context, port string) error {
|
||||
|
||||
s.Logger.Infow("Got connection on port.", "port", port, "network", "tcp", "remote_addr", conn.RemoteAddr().String())
|
||||
|
||||
conn.SetReadDeadline(time.Now().Add(time.Second * 15))
|
||||
if err := conn.SetReadDeadline(time.Now().Add(time.Second * 15)); err != nil {
|
||||
s.Logger.Warnw("Error setting connection read deadline.", "err", err)
|
||||
}
|
||||
|
||||
buf := make([]byte, 256)
|
||||
|
||||
|
@@ -1,12 +1,12 @@
|
||||
// nolint: errcheck
|
||||
package ports_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"context"
|
||||
|
||||
"git.t-juice.club/torjus/apiary/honeypot/ports"
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user