mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2025-01-04 13:24:46 +00:00
chore: refactor dns
This commit is contained in:
parent
f6da91cc48
commit
97af86cd84
@ -2,7 +2,6 @@ package handler
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -27,11 +26,12 @@ func (l *LoggingHandler) DoHandle(ctx context.Context, host string, qTypes []uin
|
|||||||
t := time.Now()
|
t := time.Now()
|
||||||
addrs, err := resolver.Resolve(ctx, host, qTypes)
|
addrs, err := resolver.Resolve(ctx, host, qTypes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("%s: %w", resolver, err)
|
logger.Debug().Msgf("failed to resolve %s using %s", host, resolver)
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
if len(addrs) > 0 {
|
if len(addrs) > 0 {
|
||||||
d := time.Since(t).Milliseconds()
|
d := time.Since(t).Milliseconds()
|
||||||
logger.Debug().Msgf("resolved %s from %s in %d ms", addrs[0].String(), host, d)
|
logger.Debug().Msgf("resolved %s from %s in %d ms", addrs[0].String(), host, d)
|
||||||
}
|
}
|
||||||
return addrs, err
|
return addrs, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user