pub trait NetGate {
// Required methods
fn decide(&self, reach: &Reach) -> Option<Verdict>;
fn interfaces(&self) -> Option<Verdict>;
// Provided methods
fn ask(&self, reach: Reach) -> LocalBoxFuture<'static, Verdict> { ... }
fn ask_interfaces(&self) -> LocalBoxFuture<'static, Verdict> { ... }
fn ask_timeout(&self) -> Duration { ... }
}Expand description
The net permission gate. There is no allowing default: every
Peer, Network and
IceTransport is given one, and DenyAllGate
refuses everything.
Required Methods§
Sourcefn decide(&self, reach: &Reach) -> Option<Verdict>
fn decide(&self, reach: &Reach) -> Option<Verdict>
Answers now if it can. A gate that answers synchronously (a runtime’s
permission set) always returns Some; None makes the engine
ask. Called again each time the engine needs the
question answered, so it may answer from a cache of its own.
Sourcefn interfaces(&self) -> Option<Verdict>
fn interfaces(&self) -> Option<Verdict>
May the engine list the machine’s interface addresses (its host
candidates beyond loopback)? (Deno’s --allow-sys=networkInterfaces.)
Provided Methods§
Sourcefn ask(&self, reach: Reach) -> LocalBoxFuture<'static, Verdict>
fn ask(&self, reach: Reach) -> LocalBoxFuture<'static, Verdict>
Asks, the answer arriving through the returned future. Called only
after decide returned None, at most once per question at a time
per connection (the engine dedupes and remembers the answer). The
future is dropped when the connection closes or
NetGate::ask_timeout passes (a refusal). The default answers from
NetGate::decide (None is a refusal).
Sourcefn ask_interfaces(&self) -> LocalBoxFuture<'static, Verdict>
fn ask_interfaces(&self) -> LocalBoxFuture<'static, Verdict>
NetGate::interfaces, asked. The default answers from
interfaces() (None is a refusal).
Sourcefn ask_timeout(&self) -> Duration
fn ask_timeout(&self) -> Duration
How long the engine waits for an ask /
ask_interfaces answer before it takes
the question as refused.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".