mirror of
https://github.com/usestrix/firewall.git
synced 2026-11-10 17:58:11 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ba2e23032 |
No files matched your search
@@ -80,6 +80,18 @@ impl FirewallConfig {
|
|||||||
pub fn local_url(&self, path: &str) -> String {
|
pub fn local_url(&self, path: &str) -> String {
|
||||||
crate::local_url(self.port, path)
|
crate::local_url(self.port, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Without building a `Firewall`, which needs a runtime.
|
||||||
|
pub fn hosts(&self) -> Vec<&'static str> {
|
||||||
|
let mut hosts: Vec<&'static str> = Vec::new();
|
||||||
|
for registry in &self.registries {
|
||||||
|
let host = registry.host();
|
||||||
|
if !hosts.contains(&host) {
|
||||||
|
hosts.push(host);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hosts
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn path() -> Option<PathBuf> {
|
pub fn path() -> Option<PathBuf> {
|
||||||
|
|||||||
@@ -40,14 +40,7 @@ impl Firewall {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn hosts(&self) -> Vec<&'static str> {
|
pub fn hosts(&self) -> Vec<&'static str> {
|
||||||
let mut hosts: Vec<&'static str> = Vec::new();
|
self.config.hosts()
|
||||||
for registry in &self.config.registries {
|
|
||||||
let host = registry.host();
|
|
||||||
if !hosts.contains(&host) {
|
|
||||||
hosts.push(host);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hosts
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_index_url(&self, url: &str) -> bool {
|
pub fn is_index_url(&self, url: &str) -> bool {
|
||||||
|
|||||||
Reference in new issue
Block a user