aboutsummaryrefslogtreecommitdiff
path: root/lib/dns/request.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dns/request.go')
-rw-r--r--lib/dns/request.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/dns/request.go b/lib/dns/request.go
index fc7355d5..7bfacd28 100644
--- a/lib/dns/request.go
+++ b/lib/dns/request.go
@@ -6,6 +6,7 @@ package dns
import (
"io"
"log"
+ "time"
)
// request contains UDP address and DNS query message from client.
@@ -26,16 +27,21 @@ type request struct {
// Message define the DNS query.
message *Message
+ // startAt set the start time the request received by server.
+ startAt time.Time
+
// Kind define the connection type that this request is belong to,
// e.g. UDP, TCP, or DoH.
kind connType
}
// newRequest create and initialize request.
-func newRequest() *request {
- return &request{
+func newRequest() (req *request) {
+ req = &request{
message: NewMessage(),
+ startAt: time.Now(),
}
+ return req
}
// error set the request message as an error.