aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/command_parser_executor.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-11-26 00:04:22 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-11-26 00:04:22 +0000
commit38ceb73848a3c37df60bce637d855b7564b09730 (patch)
treeed35b91ab9e9b6a90e612cfe1ad42d54ce1d5321 /src/daemon/command_parser_executor.cpp
parentnet_node: allow bans for custom amounts of time (diff)
downloadmonero-38ceb73848a3c37df60bce637d855b7564b09730.tar.xz
add RPC calls and commands to get/set bans
Diffstat (limited to '')
-rw-r--r--src/daemon/command_parser_executor.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp
index a07bb25de..487d86071 100644
--- a/src/daemon/command_parser_executor.cpp
+++ b/src/daemon/command_parser_executor.cpp
@@ -392,5 +392,34 @@ bool t_command_parser_executor::hard_fork_info(const std::vector<std::string>& a
return m_executor.hard_fork_info(version);
}
+bool t_command_parser_executor::show_bans(const std::vector<std::string>& args)
+{
+ if (!args.empty()) return false;
+ return m_executor.print_bans();
+}
+
+bool t_command_parser_executor::ban(const std::vector<std::string>& args)
+{
+ if (args.size() != 1 && args.size() != 2) return false;
+ std::string ip = args[0];
+ time_t seconds = P2P_IP_BLOCKTIME;
+ if (args.size() > 1)
+ {
+ seconds = std::stoi(args[0]);
+ if (seconds == 0)
+ {
+ return false;
+ }
+ }
+ return m_executor.ban(ip, seconds);
+}
+
+bool t_command_parser_executor::unban(const std::vector<std::string>& args)
+{
+ if (args.size() != 1) return false;
+ std::string ip = args[0];
+ return m_executor.unban(ip);
+}
+
} // namespace daemonize