fix: check whether the dst port is within the specified range

This commit is contained in:
laburaps 2024-12-10 14:40:29 +08:00
parent f3a43fe3a6
commit 6da8e6b564
No known key found for this signature in database
GPG key ID: 4BAD8DF506E12358

View file

@ -146,7 +146,7 @@ func (sd *Dispatcher) Enable() bool {
func (sd *Dispatcher) sniffDomain(conn *N.BufferedConn, metadata *C.Metadata) (string, error) {
for s := range sd.sniffers {
if s.SupportNetwork() == C.TCP {
if s.SupportNetwork() == C.TCP && s.SupportPort(metadata.DstPort) {
_ = conn.SetReadDeadline(time.Now().Add(1 * time.Second))
_, err := conn.Peek(1)
_ = conn.SetReadDeadline(time.Time{})