Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ members = [
"modules/llrt_child_process",
"modules/llrt_console",
"modules/llrt_crypto",
"modules/llrt_dgram",
"modules/llrt_events",
"modules/llrt_exceptions",
"modules/llrt_fetch",
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ test: export JS_MINIFY = 0
test: export TEST_SUB_DIR = unit
test: export LLRT_ASYNC_HOOKS = 1
test: js
cargo run -- test -d bundle/js/__tests__/$(TEST_SUB_DIR)
cargo run -- test -d bundle/js/__tests__/$(TEST_SUB_DIR) dgram

init-wpt:
cd wpt && \
Expand Down
2 changes: 2 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ const ES_BUILD_OPTIONS = {
"node:console",
"crypto",
"node:crypto",
"dgram",
"node:dgram",
"dns",
"node:dns",
"events",
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions libs/llrt_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub mod error_messages;
pub mod fs;
pub mod hash;
pub mod io;
pub mod latch;
pub mod macros;
pub mod mc_oneshot;
pub mod module;
Expand Down
1 change: 0 additions & 1 deletion llrt_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub mod libs;
pub mod modules;
pub mod runtime_client;
mod security;
pub mod utils;
pub mod vm;

pub use llrt_modules::VERSION;
Expand Down
2 changes: 1 addition & 1 deletion llrt_core/src/runtime_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use crate::libs::{
#[cfg(not(test))]
use crate::modules::console::log_error;
use crate::modules::https::{HyperClient, HTTP_CLIENT};
use crate::utils::latch::Latch;
use llrt_utils::latch::Latch;

const ENV_AWS_LAMBDA_FUNCTION_NAME: &str = "AWS_LAMBDA_FUNCTION_NAME";
const ENV_AWS_LAMBDA_FUNCTION_VERSION: &str = "AWS_LAMBDA_FUNCTION_VERSION";
Expand Down
3 changes: 0 additions & 3 deletions llrt_core/src/utils/mod.rs

This file was deleted.

3 changes: 3 additions & 0 deletions llrt_modules/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ base = [
"buffer",
"child-process",
"crypto",
"dgram",
"dns",
"events",
"exceptions",
Expand Down Expand Up @@ -48,6 +49,7 @@ buffer = ["llrt_buffer"]
child-process = ["llrt_child_process"]
console = ["llrt_console"]
crypto = ["llrt_crypto"]
dgram = ["llrt_dgram"]
dns = ["llrt_dns"]
events = ["llrt_events"]
exceptions = ["llrt_exceptions"]
Expand Down Expand Up @@ -90,6 +92,7 @@ llrt_buffer = { version = "0.7.0-beta", path = "../modules/llrt_buffer", optiona
llrt_child_process = { version = "0.7.0-beta", path = "../modules/llrt_child_process", optional = true }
llrt_console = { version = "0.7.0-beta", path = "../modules/llrt_console", optional = true }
llrt_crypto = { version = "0.7.0-beta", path = "../modules/llrt_crypto", optional = true }
llrt_dgram = { version = "0.7.0-beta", path = "../modules/llrt_dgram", optional = true }
llrt_dns = { version = "0.7.0-beta", path = "../modules/llrt_dns", optional = true }
llrt_events = { version = "0.7.0-beta", path = "../modules/llrt_events", optional = true }
llrt_exceptions = { version = "0.7.0-beta", path = "../modules/llrt_exceptions", optional = true }
Expand Down
2 changes: 2 additions & 0 deletions llrt_modules/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ mod modules {
pub use llrt_console as console;
#[cfg(feature = "crypto")]
pub use llrt_crypto as crypto;
#[cfg(feature = "dgram")]
pub use llrt_dgram as dgram;
#[cfg(feature = "dns")]
pub use llrt_dns as dns;
#[cfg(feature = "events")]
Expand Down
4 changes: 4 additions & 0 deletions llrt_modules/src/module_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ impl Default for ModuleBuilder {
.with_global(crate::modules::crypto::init)
.with_module(crate::modules::crypto::CryptoModule);
}
#[cfg(feature = "dgram")]
{
builder = builder.with_module(crate::modules::dgram::DgramModule);
}
#[cfg(feature = "dns")]
{
builder = builder.with_module(crate::modules::dns::DnsModule);
Expand Down
27 changes: 27 additions & 0 deletions modules/llrt_dgram/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[package]
name = "llrt_dgram"
description = "LLRT Module dgram"
version = "0.7.0-beta"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/awslabs/llrt"
readme = "README.md"

[lib]
name = "llrt_dgram"
path = "src/lib.rs"

[dependencies]
itoa = { version = "1", default-features = false }
llrt_buffer = { version = "0.7.0-beta", path = "../llrt_buffer" }
llrt_context = { version = "0.7.0-beta", path = "../../libs/llrt_context" }
llrt_events = { version = "0.7.0-beta", path = "../llrt_events" }
llrt_utils = { version = "0.7.0-beta", path = "../../libs/llrt_utils", default-features = false }
rquickjs = { git = "https://github.com/DelSkayn/rquickjs.git", version = "0.10.0", default-features = false }
tokio = { version = "1", features = ["net", "macros"], default-features = false }
tracing = { version = "0.1", default-features = false }

[dev-dependencies]
llrt_test = { path = "../../libs/llrt_test" }
rand = { version = "0.9", features = ["alloc"], default-features = false }
tokio = { version = "1", features = ["rt", "macros"] }
27 changes: 27 additions & 0 deletions modules/llrt_dgram/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# llrt_dgram

LLRT implementation of Node.js `dgram` module for UDP datagram sockets.

## Features

- UDP socket support (IPv4 and IPv6)
- Send and receive datagrams
- Event-driven API compatible with Node.js
- Async/await support

## Supported APIs

- `dgram.createSocket(type[, callback])`
- `socket.send(msg, port, address[, callback])`
- `socket.bind([port][, address][, callback])`
- `socket.close([callback])`
- `socket.address()`
- `socket.unref()`
- `socket.ref()`

## Events

- `'message'` - Emitted when a new datagram is available
- `'listening'` - Emitted when socket begins listening for datagrams
- `'close'` - Emitted after socket is closed
- `'error'` - Emitted when an error occurs
Loading