mirror of https://github.com/Revertron/Alfis
Added more restriction by public key. Added alternative zones to restrictions.
parent
b39f5fa7f0
commit
809256b955
@ -0,0 +1,32 @@
|
||||
# OpenNIC zones
|
||||
bbs
|
||||
chan
|
||||
cyb
|
||||
dyn
|
||||
geek
|
||||
gopher
|
||||
indy
|
||||
libre
|
||||
neo
|
||||
null
|
||||
o
|
||||
oss
|
||||
oz
|
||||
parody
|
||||
pirate
|
||||
# Namecoin zone
|
||||
bit
|
||||
# Etherium
|
||||
eth
|
||||
# EmerCoin
|
||||
emc
|
||||
coin
|
||||
lib
|
||||
bazar
|
||||
# Reserved
|
||||
example
|
||||
invalid
|
||||
local
|
||||
localhost
|
||||
onion
|
||||
test
|
@ -1,28 +0,0 @@
|
||||
use std::collections::HashSet;
|
||||
|
||||
pub struct Iana {
|
||||
zones: HashSet<String>,
|
||||
hashes: HashSet<String>
|
||||
}
|
||||
|
||||
impl Iana {
|
||||
pub fn new() -> Self {
|
||||
let zones: HashSet<_> = include_str!("../iana-tlds.txt")
|
||||
.split("\n")
|
||||
.map(String::from)
|
||||
.collect();
|
||||
let hashes: HashSet<_> = include_str!("../iana-hashes.txt")
|
||||
.split("\n")
|
||||
.map(String::from)
|
||||
.collect();
|
||||
Self { zones, hashes }
|
||||
}
|
||||
|
||||
pub fn has_zone(&self, zone: &str) -> bool {
|
||||
self.zones.contains(zone)
|
||||
}
|
||||
|
||||
pub fn has_hash(&self, hash: &str) -> bool {
|
||||
self.hashes.contains(hash)
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
use std::collections::HashSet;
|
||||
use crate::blockchain::hash_utils::hash_identity;
|
||||
|
||||
pub struct ExternalZones {
|
||||
zones: HashSet<String>,
|
||||
hashes: HashSet<String>
|
||||
}
|
||||
|
||||
impl ExternalZones {
|
||||
pub fn new() -> Self {
|
||||
let mut zones: HashSet<_> = include_str!("../iana-tlds.txt")
|
||||
.split("\n")
|
||||
.map(String::from)
|
||||
.collect();
|
||||
let mut hashes: HashSet<_> = include_str!("../iana-hashes.txt")
|
||||
.split("\n")
|
||||
.map(String::from)
|
||||
.collect();
|
||||
let open_nic: HashSet<_> = include_str!("../other-tlds.txt")
|
||||
.split("\n")
|
||||
.map(String::from)
|
||||
.collect();
|
||||
for zone in open_nic.iter() {
|
||||
if zone.is_empty() || zone.starts_with("#") {
|
||||
continue;
|
||||
}
|
||||
zones.insert(zone.to_string());
|
||||
hashes.insert(hash_identity(zone, None).to_string());
|
||||
}
|
||||
|
||||
Self { zones, hashes }
|
||||
}
|
||||
|
||||
pub fn has_zone(&self, zone: &str) -> bool {
|
||||
self.zones.contains(zone)
|
||||
}
|
||||
|
||||
pub fn has_hash(&self, hash: &str) -> bool {
|
||||
self.hashes.contains(hash)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue