Skip to content

Commit

Permalink
Merge pull request #6 from linyows/error-same-ip
Browse files Browse the repository at this point in the history
Close connection if same IP
  • Loading branch information
linyows authored May 7, 2022
2 parents f04d522 + 6cc0ccd commit 703fd9c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ func (s *Server) Start() error {
log.Printf("accept error: %#v", err)
continue
}
if s.Addr == conn.RemoteAddr().String() {
conn.Close()
log.Printf("closed connection due to same ip: %s", conn.RemoteAddr())
continue
}
go s.HandleConnection(conn)
}
}
Expand Down

0 comments on commit 703fd9c

Please sign in to comment.