Currently, because the Dns resolver functions return an nb::Result, this means that some higher-level has to actually cache the the hostname being looked up during repeated calls to resolve the name. However, this isn't really a great API because it enforces caching and RAM usage if the hostnames are long. Thus, if an implementation wants to support N simultanenous queries of 255 bytes, it must cache at least 255 * N bytes locally.
Ideally, we would refactor the functions to be get_host_by_name() -> Handle, where Handle is some unique ID that can be queried against in the future (and can ideally be really lightweight, like a u32).
Also, it seems like get_host_by_ip() is a bit of a different DNS use-case and isn't super well-suited for embedded (I just mark it as unimplemented!() in my case because smoltcp doesn't support it). Perhaps it would be best to move this to a separate trait.
Currently, because the
Dns
resolver functions return annb::Result
, this means that some higher-level has to actually cache the the hostname being looked up during repeated calls to resolve the name. However, this isn't really a great API because it enforces caching and RAM usage if the hostnames are long. Thus, if an implementation wants to support N simultanenous queries of 255 bytes, it must cache at least 255 * N bytes locally.Ideally, we would refactor the functions to be
get_host_by_name() -> Handle
, whereHandle
is some unique ID that can be queried against in the future (and can ideally be really lightweight, like au32
).So the API may be:
Also, it seems like
get_host_by_ip()
is a bit of a different DNS use-case and isn't super well-suited for embedded (I just mark it asunimplemented!()
in my case becausesmoltcp
doesn't support it). Perhaps it would be best to move this to a separate trait.