Skip to content

Commit c214e29

Browse files
committed
Merged PR #44
2 parents e0bd8ad + ea42977 commit c214e29

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

internal/dns/dns_proxy.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ func (t *timedResponse) rewriteTTLs() (result *Response, stillValid bool) {
7676
Answers: slices.Clone(t.response.Answers),
7777
}
7878

79-
for _, a := range result.Answers {
80-
if a.TTL >= diffSeconds {
81-
a.TTL = a.TTL - diffSeconds
79+
for i := range result.Answers {
80+
if result.Answers[i].TTL >= diffSeconds {
81+
result.Answers[i].TTL = result.Answers[i].TTL - diffSeconds
8282
} else {
8383
ok = false
84-
a.TTL = 0
84+
result.Answers[i].TTL = 0
8585
}
8686
}
8787

@@ -618,9 +618,9 @@ func (w *worker) process(workerTask *workerTask) (processResponse, error) {
618618
// TODO responses without at TTL will not be evicted from the cache, so not caching it for now
619619
// TODO decide what to do with large responses
620620
if len(candidateResponse.Answers) > 0 && len(candidateResponse.Answers) < 1000 {
621-
for _, answer := range candidateResponse.Answers {
622-
if answer.TTL > w.config.MaxTTL {
623-
answer.TTL = w.config.MaxTTL
621+
for i := range candidateResponse.Answers {
622+
if candidateResponse.Answers[i].TTL > w.config.MaxTTL {
623+
candidateResponse.Answers[i].TTL = w.config.MaxTTL
624624
}
625625
}
626626

0 commit comments

Comments
 (0)