punish clear

This commit is contained in:
John Smith 2023-12-09 20:43:38 -05:00 committed by Christien Rioux
parent 1e1faa3c1a
commit a076082763
2 changed files with 19 additions and 1 deletions

View File

@ -268,6 +268,13 @@ impl AddressFilter {
.or_insert(ts); .or_insert(ts);
} }
pub fn clear_punishments(&self) {
let mut inner = self.inner.lock();
inner.punishments_by_ip4.clear();
inner.punishments_by_ip6_prefix.clear();
inner.punishments_by_node_id.clear();
}
pub fn punish_ip_addr(&self, addr: IpAddr) { pub fn punish_ip_addr(&self, addr: IpAddr) {
log_net!(debug ">>> PUNISHED: {}", addr); log_net!(debug ">>> PUNISHED: {}", addr);
let ts = get_aligned_timestamp(); let ts = get_aligned_timestamp();

View File

@ -1710,10 +1710,20 @@ impl VeilidAPI {
let network_manager = self.network_manager()?; let network_manager = self.network_manager()?;
let address_filter = network_manager.address_filter(); let address_filter = network_manager.address_filter();
let out = format!("Address Filter Punishments:\n{:#?}", address_filter); let out = format!("Address filter punishments:\n{:#?}", address_filter);
Ok(out) Ok(out)
} }
async fn debug_punish_clear(&self, _args: Vec<String>) -> VeilidAPIResult<String> {
//
let network_manager = self.network_manager()?;
let address_filter = network_manager.address_filter();
address_filter.clear_punishments();
Ok("Address Filter punishments cleared\n".to_owned())
}
async fn debug_punish(&self, args: String) -> VeilidAPIResult<String> { async fn debug_punish(&self, args: String) -> VeilidAPIResult<String> {
let args: Vec<String> = let args: Vec<String> =
shell_words::split(&args).map_err(|e| VeilidAPIError::parse_error(e, args))?; shell_words::split(&args).map_err(|e| VeilidAPIError::parse_error(e, args))?;
@ -1750,6 +1760,7 @@ appcall <destination> <data>
appreply [#id] <data> appreply [#id] <data>
relay <relay> [public|local] relay <relay> [public|local]
punish list punish list
clear
route allocate [ord|*ord] [rel] [<count>] [in|out] route allocate [ord|*ord] [rel] [<count>] [in|out]
release <route> release <route>
publish <route> [full] publish <route> [full]