-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 #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:
- Wasmtime passes such a list directly as an argument to the
SocketAddrCheckclosure. - Wasmtime gives a way for the embedder to query what the list is at any time.
- Wasmtime allows the embedder to hook into DNS resolution and be called back with any (name, resolved IP address) pairs
- 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
ErrorCodeerror fromresolve_next_address
If we can agree on an approach, I'm happy to do the implementation.