mirror of
https://github.com/bettercap/bettercap
synced 2025-07-11 15:46:59 -07:00
new: centralized logging and implemented DELETE /api/events route, closes #5
This commit is contained in:
parent
269d7d845b
commit
f1f146d3d7
21 changed files with 144 additions and 184 deletions
|
@ -3,12 +3,9 @@ package packets
|
|||
import (
|
||||
"fmt"
|
||||
"github.com/google/gopacket/pcap"
|
||||
"github.com/op/go-logging"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var log = logging.MustGetLogger("mitm")
|
||||
|
||||
type Queue struct {
|
||||
iface string
|
||||
handle *pcap.Handle
|
||||
|
@ -17,7 +14,6 @@ type Queue struct {
|
|||
}
|
||||
|
||||
func NewQueue(iface string) (*Queue, error) {
|
||||
log.Debugf("Creating packet queue for interface %s.\n", iface)
|
||||
var err error
|
||||
|
||||
q := &Queue{
|
||||
|
@ -39,7 +35,6 @@ func (q *Queue) Send(raw []byte) error {
|
|||
q.lock.Lock()
|
||||
defer q.lock.Unlock()
|
||||
|
||||
log.Debugf("Sending %d bytes to packet queue.\n", len(raw))
|
||||
if q.active {
|
||||
return q.handle.WritePacketData(raw)
|
||||
} else {
|
||||
|
@ -51,8 +46,6 @@ func (q *Queue) Stop() {
|
|||
q.lock.Lock()
|
||||
defer q.lock.Unlock()
|
||||
|
||||
log.Debugf("Stopping packet queue.\n")
|
||||
|
||||
q.handle.Close()
|
||||
q.active = false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue