diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2021-06-29 01:43:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-29 01:43:03 +0200 |
commit | 38a7128cdd6f3308ba3c13cfb0b0d4ef925a44c3 (patch) | |
tree | 8f0c86028d9ba0266f1846e7f3611f7049cb43a8 /runtime/permissions.rs | |
parent | 30cba2484815f712502ae8937a25afa13aba0818 (diff) |
feat: Add "deno_net" extension (#11150)
This commits moves implementation of net related APIs available on "Deno"
namespace to "deno_net" extension.
Following APIs were moved:
- Deno.listen()
- Deno.connect()
- Deno.listenTls()
- Deno.serveHttp()
- Deno.shutdown()
- Deno.resolveDns()
- Deno.listenDatagram()
- Deno.startTls()
- Deno.Conn
- Deno.Listener
- Deno.DatagramConn
Diffstat (limited to 'runtime/permissions.rs')
-rw-r--r-- | runtime/permissions.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/permissions.rs b/runtime/permissions.rs index f8385e201..d78e20076 100644 --- a/runtime/permissions.rs +++ b/runtime/permissions.rs @@ -962,6 +962,23 @@ impl Permissions { } } +impl deno_net::NetPermissions for Permissions { + fn check_net<T: AsRef<str>>( + &mut self, + host: &(T, Option<u16>), + ) -> Result<(), AnyError> { + self.net.check(host) + } + + fn check_read(&mut self, path: &Path) -> Result<(), AnyError> { + self.read.check(path) + } + + fn check_write(&mut self, path: &Path) -> Result<(), AnyError> { + self.write.check(path) + } +} + impl deno_fetch::FetchPermissions for Permissions { fn check_net_url(&mut self, url: &url::Url) -> Result<(), AnyError> { self.net.check_url(url) |