Fixes and small changes
This commit is contained in:
@@ -192,7 +192,7 @@ class FiregexInterceptor:
|
|||||||
)
|
)
|
||||||
line_fut = self.process.stdout.readuntil()
|
line_fut = self.process.stdout.readuntil()
|
||||||
try:
|
try:
|
||||||
line_fut = await asyncio.wait_for(line_fut, timeout=1)
|
line_fut = await asyncio.wait_for(line_fut, timeout=3)
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
self.process.kill()
|
self.process.kill()
|
||||||
raise Exception("Invalid binary output")
|
raise Exception("Invalid binary output")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import traceback, asyncio
|
import asyncio
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
from modules.firegex import FiregexFilter, FiregexTables, RegexFilter
|
from modules.firegex import FiregexFilter, FiregexTables, RegexFilter
|
||||||
from modules.sqlite import Regex, SQLite, Service
|
from modules.sqlite import Regex, SQLite, Service
|
||||||
@@ -14,7 +14,6 @@ class FirewallManager:
|
|||||||
self.lock = asyncio.Lock()
|
self.lock = asyncio.Lock()
|
||||||
|
|
||||||
async def close(self):
|
async def close(self):
|
||||||
if self.updater_task: self.updater_task.cancel()
|
|
||||||
for key in list(self.proxy_table.keys()):
|
for key in list(self.proxy_table.keys()):
|
||||||
await self.remove(key)
|
await self.remove(key)
|
||||||
|
|
||||||
@@ -36,22 +35,6 @@ class FirewallManager:
|
|||||||
self.proxy_table[srv.id] = ServiceManager(srv, self.db)
|
self.proxy_table[srv.id] = ServiceManager(srv, self.db)
|
||||||
await self.proxy_table[srv.id].next(srv.status)
|
await self.proxy_table[srv.id].next(srv.status)
|
||||||
|
|
||||||
async def _stats_updater(self, callback):
|
|
||||||
try:
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
for key in list(self.proxy_table.keys()):
|
|
||||||
self.proxy_table[key].update_stats()
|
|
||||||
except Exception:
|
|
||||||
traceback.print_exc()
|
|
||||||
if callback:
|
|
||||||
if asyncio.iscoroutinefunction(callback): await callback()
|
|
||||||
else: callback()
|
|
||||||
await asyncio.sleep(5)
|
|
||||||
except asyncio.CancelledError:
|
|
||||||
self.updater_task = None
|
|
||||||
return
|
|
||||||
|
|
||||||
def get(self,srv_id):
|
def get(self,srv_id):
|
||||||
if srv_id in self.proxy_table:
|
if srv_id in self.proxy_table:
|
||||||
return self.proxy_table[srv_id]
|
return self.proxy_table[srv_id]
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class Service:
|
|||||||
|
|
||||||
|
|
||||||
class Regex:
|
class Regex:
|
||||||
def __init__(self, id: int, regex: str, mode: str, service_id: str, is_blacklist: bool, blocked_packets: int, is_case_sensitive: bool, active: bool):
|
def __init__(self, id: int, regex: bytes, mode: str, service_id: str, is_blacklist: bool, blocked_packets: int, is_case_sensitive: bool, active: bool):
|
||||||
self.regex = regex
|
self.regex = regex
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
self.service_id = service_id
|
self.service_id = service_id
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using namespace std;
|
|||||||
shared_ptr<regex_rules> regex_config;
|
shared_ptr<regex_rules> regex_config;
|
||||||
|
|
||||||
void config_updater (){
|
void config_updater (){
|
||||||
string line, data;
|
string line;
|
||||||
while (true){
|
while (true){
|
||||||
getline(cin, line);
|
getline(cin, line);
|
||||||
if (cin.eof()){
|
if (cin.eof()){
|
||||||
@@ -23,6 +23,7 @@ void config_updater (){
|
|||||||
istringstream config_stream(line);
|
istringstream config_stream(line);
|
||||||
regex_rules *regex_new_config = new regex_rules();
|
regex_rules *regex_new_config = new regex_rules();
|
||||||
while(!config_stream.eof()){
|
while(!config_stream.eof()){
|
||||||
|
string data;
|
||||||
config_stream >> data;
|
config_stream >> data;
|
||||||
if (data != "" && data != "\n"){
|
if (data != "" && data != "\n"){
|
||||||
regex_new_config->add(data.c_str());
|
regex_new_config->add(data.c_str());
|
||||||
|
|||||||
@@ -47,6 +47,11 @@ function App() {
|
|||||||
}
|
}
|
||||||
},[])
|
},[])
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
const updater = setInterval(fireUpdateRequest,6000)
|
||||||
|
return () => clearInterval(updater)
|
||||||
|
},[])
|
||||||
|
|
||||||
const form = useForm({
|
const form = useForm({
|
||||||
initialValues: {
|
initialValues: {
|
||||||
password:"",
|
password:"",
|
||||||
|
|||||||
Reference in New Issue
Block a user