cfug/dio

RFC - Custom DNS Resolver

imiskolee opened this issue · 2 comments

Request Statement

Why do we need a custom DNS resolver?

Normally, the DNS resolution provided by the operating system depends on the local operator's dns server, which makes it difficult to control the DNS caching policy and resolution stability. In this case, we can try to use DNS Over HTTP as an alternative, or we can cache DNS results locally in the app according to a customized policy. Cache DNS to sqlite/file or other ways.

Solution Brainstorm

We can add a resolver method to configure, a common design in the Golang world.

final dio = Dio({
  resolver :  (domain) -> string {
        return "1.2.3.4"
 }
})

Creating a custom HttpClientAdapter with the resolver would be feasible. Is there any concern that this should be added to the Dio class?

@AlexV525 thanks, I will try out now.