Fixes and small changes
This commit is contained in:
@@ -192,7 +192,7 @@ class FiregexInterceptor:
|
||||
)
|
||||
line_fut = self.process.stdout.readuntil()
|
||||
try:
|
||||
line_fut = await asyncio.wait_for(line_fut, timeout=1)
|
||||
line_fut = await asyncio.wait_for(line_fut, timeout=3)
|
||||
except asyncio.TimeoutError:
|
||||
self.process.kill()
|
||||
raise Exception("Invalid binary output")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import traceback, asyncio
|
||||
import asyncio
|
||||
from typing import Dict
|
||||
from modules.firegex import FiregexFilter, FiregexTables, RegexFilter
|
||||
from modules.sqlite import Regex, SQLite, Service
|
||||
@@ -14,7 +14,6 @@ class FirewallManager:
|
||||
self.lock = asyncio.Lock()
|
||||
|
||||
async def close(self):
|
||||
if self.updater_task: self.updater_task.cancel()
|
||||
for key in list(self.proxy_table.keys()):
|
||||
await self.remove(key)
|
||||
|
||||
@@ -36,22 +35,6 @@ class FirewallManager:
|
||||
self.proxy_table[srv.id] = ServiceManager(srv, self.db)
|
||||
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):
|
||||
if srv_id in self.proxy_table:
|
||||
return self.proxy_table[srv_id]
|
||||
|
||||
@@ -116,7 +116,7 @@ class Service:
|
||||
|
||||
|
||||
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.mode = mode
|
||||
self.service_id = service_id
|
||||
|
||||
@@ -8,7 +8,7 @@ using namespace std;
|
||||
shared_ptr<regex_rules> regex_config;
|
||||
|
||||
void config_updater (){
|
||||
string line, data;
|
||||
string line;
|
||||
while (true){
|
||||
getline(cin, line);
|
||||
if (cin.eof()){
|
||||
@@ -23,6 +23,7 @@ void config_updater (){
|
||||
istringstream config_stream(line);
|
||||
regex_rules *regex_new_config = new regex_rules();
|
||||
while(!config_stream.eof()){
|
||||
string data;
|
||||
config_stream >> data;
|
||||
if (data != "" && data != "\n"){
|
||||
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({
|
||||
initialValues: {
|
||||
password:"",
|
||||
|
||||
Reference in New Issue
Block a user