add timeout for sniffing

This commit is contained in:
ginuerzh
2023-05-21 15:47:51 +08:00
parent 30c705ffe5
commit 46db8480fa
17 changed files with 74 additions and 48 deletions

View File

@ -112,10 +112,10 @@ func (h *ssuHandler) Handle(ctx context.Context, conn net.Conn, opts ...handler.
}
t := time.Now()
log.Debugf("%s <-> %s", conn.LocalAddr(), cc.LocalAddr())
log.Infof("%s <-> %s", conn.LocalAddr(), cc.LocalAddr())
h.relayPacket(pc, cc, log)
log.WithFields(map[string]any{"duration": time.Since(t)}).
Debugf("%s >-< %s", conn.LocalAddr(), cc.LocalAddr())
Infof("%s >-< %s", conn.LocalAddr(), cc.LocalAddr())
return nil
}