-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Feature
I would like to be able to customise the resolution of certain DNS names in the Wasmtime host. Specifically, the .alt TLD is defined as being for the host to resolve, and I'd like to be able to use hosts under that TLD as aliases, mapping them to IP addresses within the host.
Benefit
The issue at hand is enabling a component to make an outbound connection to a debug server. We want to restrict outbound access in configuration. But we do not know at configuration time where the debug server is running. So the idea is to have the debuggee connecting on a fixed .alt address, which we resolve at debug time to the debug server address.
Implementation
I'm not sufficiently au fait with the hosting APIs to have a view on implementation. I guess I am hoping for something similar to WasiCtxBuilder::socket_addr_check, i.e. I can set a resolver function on the context and have it invoked during resolution. Ideally such a function would not be required to encompass all resolution: in most cases, it should be able to hand off to normal DNS resolution (e.g. by returning a sentinel value such as None).
Alternatives
An alternative approach would be for a host to virtualise wasi:sockets by synthesising a shim implementation at runtime - to translate the .alt addresses, and pass everything else on - and composing that onto the main component. This would mean that each host that cared about this would need to build a shim generator.