zmap / zdns

Fast DNS Lookup Library and CLI Tool
Apache License 2.0
891 stars 121 forks source link

Avoid changing the timeouts selected by user, better handling of iteration timeout and normal timeout #383

Closed phillip-stephens closed 2 months ago

phillip-stephens commented 2 months ago

Closes #363

Changes

Testing

Was a bit difficult to test, but added a time.Sleep(time.Second) into the lookup section of the code and alternated between --timeout 1 and --iteration-timeout 1 to see what error was returned.

~/zdns/zdns-working on  phillip/363-no-timeout-change! ⌚ 12:11:05
$ echo "amazon.com" | ./zdns A  --iteration-timeout 1 --timeout 4 --iterative
{"data":{"protocol":"","resolver":""},"name":"amazon.com","status":"ITERATIVE_TIMEOUT","timestamp":"2024-06-11T12:11:14+09:00"}

~/zdns/zdns-working on  phillip/363-no-timeout-change! ⌚ 12:11:14
$ echo "amazon.com" | ./zdns A  --iteration-timeout 4 --timeout 1 --iterative
{"data":{"protocol":"","resolver":""},"name":"amazon.com","status":"TIMEOUT","timestamp":"2024-06-11T12:11:27+09:00"}

Note - The status is correctly reported`