Skip to content

Provide a way for a Wasmtime host to customise DNS resolution #12713

@itowlson

Description

@itowlson

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions