bytecodealliance / bytecodealliance/wasmtime

[`wasi:sockets/ip-name-lookup#resolve_addresses`] way to track name to `IpAddress` resolution

Open
#7,694 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

My use case is essentially to allow any socket operation as long as the IP addressed used for that operation was resolved in the last call to `wasi:sockets/ip-name-lookup#resolve_addresses`.

Given the changes in https://github.com/bytecodealliance/wasmtime/pull/7662 this would stand to reason that somehow I need the ability to have a list of resolved names to IP addresses in the closure passed to `socket_addr_check`.

This could be accomplished in several ways:
1. Wasmtime passes such a list directly as an argument to the `SocketAddrCheck` closure.
2. Wasmtime gives a way for the embedder to query what the list is at any time.
3. Wasmtime allows the embedder to hook into DNS resolution and be called back with any (name, resolved IP address) pairs
4. Other ways?

I think I might lean towards option 3. Perhaps this callback could be in the form `Fn(&str, IpAddress) -> Result<(), ErrorCode>` which would be called anytime `resolve_next_address` is about to return a `Ok(Some(addr))` to the guest. This would allow the embedder to do the following things:
* Observe DNS resolution as it happens (needed to unlock my use case)
* Change resolution so that a name resolves to a different set of IP addresses
* Return an `ErrorCode` error from `resolve_next_address`

If we can agree on an approach, I'm happy to do the implementation.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.