Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require network handle #59

Open
badeend opened this issue Oct 8, 2023 · 1 comment
Open

Require network handle #59

badeend opened this issue Oct 8, 2023 · 1 comment

Comments

@badeend
Copy link

badeend commented Oct 8, 2023

wasi-sockets requires a network handle to be passed to operations that talk with the outside world. Example: tcp::connect

/// An opaque resource that represents access to (a subset of) the network.
/// This enables context-based security for networking.
/// There is no need for this to map 1:1 to a physical network interface.
resource network

Even though this network resource is defined in the wasi-sockets repo, there is nothing socket-specific about it.

Should wasi-http require this handle too?

Edit: the http proxy world might do fine without, but I'm mainly coming at this from the cli world perspective.

@lukewagner
Copy link
Member

(sorry for the delay; I was out to the CG meeting last week)

At least in the current version of the proposal, there's only support for a single default HTTP handler (which can be virtualized using link-time virtualization). In future iterations, we've talked about having multiple HTTP handlers (that can be configured independently), which starts to look somewhat like resource network, but the HTTP backends are distinct concepts and thus I don't think need to share the same resource type.

More generally, since there is a reoccurring pattern here (in which there is an interface that is commonly imported as a global singleton, but for advanced use cases you want to "resource-ify" it), there's an idea to give this pattern first-class support in the component model and WIT by having a built-in way to automatically "resource-ify" any WIT interface to generate a new resource type whose methods correspond to the fields of the original interface. That is outside the Preview 2 timeframe, but it's something we could consider to simplify/regularize WASI proposals in the Preview 3 timeframe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants