summaryrefslogtreecommitdiff
path: root/ext/net
diff options
context:
space:
mode:
Diffstat (limited to 'ext/net')
-rw-r--r--ext/net/Cargo.toml1
-rw-r--r--ext/net/lib.rs29
2 files changed, 30 insertions, 0 deletions
diff --git a/ext/net/Cargo.toml b/ext/net/Cargo.toml
index b9ddf8d70..10dfd0d77 100644
--- a/ext/net/Cargo.toml
+++ b/ext/net/Cargo.toml
@@ -15,6 +15,7 @@ path = "lib.rs"
[dependencies]
deno_core.workspace = true
+deno_permissions.workspace = true
deno_tls.workspace = true
pin-project.workspace = true
rustls-tokio-stream.workspace = true
diff --git a/ext/net/lib.rs b/ext/net/lib.rs
index fa8074b34..3b6c05282 100644
--- a/ext/net/lib.rs
+++ b/ext/net/lib.rs
@@ -30,6 +30,35 @@ pub trait NetPermissions {
-> Result<(), AnyError>;
}
+impl NetPermissions for deno_permissions::PermissionsContainer {
+ #[inline(always)]
+ fn check_net<T: AsRef<str>>(
+ &mut self,
+ host: &(T, Option<u16>),
+ api_name: &str,
+ ) -> Result<(), AnyError> {
+ deno_permissions::PermissionsContainer::check_net(self, host, api_name)
+ }
+
+ #[inline(always)]
+ fn check_read(
+ &mut self,
+ path: &Path,
+ api_name: &str,
+ ) -> Result<(), AnyError> {
+ deno_permissions::PermissionsContainer::check_read(self, path, api_name)
+ }
+
+ #[inline(always)]
+ fn check_write(
+ &mut self,
+ path: &Path,
+ api_name: &str,
+ ) -> Result<(), AnyError> {
+ deno_permissions::PermissionsContainer::check_write(self, path, api_name)
+ }
+}
+
/// Helper for checking unstable features. Used for sync ops.
fn check_unstable(state: &OpState, api_name: &str) {
// TODO(bartlomieju): replace with `state.feature_checker.check_or_exit`