feat(net): add DNS, UDP, TCP listener and TLS endpoints

This commit is contained in:
Marqdo Agent committed 2026-11-21 10:43:08 +08:00
1 parent ee0c6cc80a
commit ff3f19a2ea
20 files changed
+1327 -61

No files matched your search

@@ -478,6 +478,10 @@ pub(crate) fn dispatch(
Err(error) => resource_recoverable(error),
}
}
"resource.accept" => {
let handle = resource_handle(take(&bound, "handle", builtin, span)?, span)?;
interpreter.resource_accept(handle, &module, span)
}
"resource.request" => {
let operation = expect_text_value(take(&bound, "operation", builtin, span)?, span)?;
let value_type = bound["arguments"].type_name();
+16
View File
@@ -903,6 +903,22 @@ impl<'a> Interpreter<'a> {
})
}
/// Accept one inbound TCP connection from a listener handle.
pub(crate) fn resource_accept(
&mut self,
handle: ResourceHandle,
module: &ModuleId,
span: Option<Span>,
) -> Result<Value, RuntimeError> {
let context = ExecutionContext::new(module.to_string(), span);
self.host
.resource_accept(handle, &context)
.map_err(|mut error| {
error.mark_callsite();
error
})
}
/// Execute one non-streaming resource operation.
pub(crate) fn resource_request(
&mut self,