mirror of
https://codeberg.org/prof_x_pvt_ltd/captive.whump.shanti-portal
synced 2024-08-14 22:46:42 +00:00
move up chain
This commit is contained in:
parent
0356a57ba4
commit
88acc7752a
1 changed files with 9 additions and 10 deletions
|
@ -8,7 +8,7 @@ from datetime import datetime, timedelta
|
|||
|
||||
import iptc
|
||||
|
||||
from errors import *
|
||||
from errors import StorageNotFound, IPTCRuleNotFound
|
||||
|
||||
|
||||
class Client(object):
|
||||
|
@ -32,11 +32,14 @@ class Client(object):
|
|||
self.ip_address = kw.pop('ip_address')
|
||||
self.protocol = kw.pop('protocol')
|
||||
|
||||
if self.ip_address and self.protocol:
|
||||
client_data = self.storage.get_client(
|
||||
self._ip_address,
|
||||
self.protocol
|
||||
)
|
||||
client_data = self.storage.get_client(
|
||||
self._ip_address,
|
||||
self.protocol
|
||||
)
|
||||
|
||||
# Init iptables
|
||||
self.table = iptc.Table(iptc.Table.MANGLE)
|
||||
self.chain = iptc.Chain(self.table, self._chain)
|
||||
|
||||
if client_data:
|
||||
self.load_client(client_data)
|
||||
|
@ -50,10 +53,6 @@ class Client(object):
|
|||
self.last_activity = None
|
||||
self.expires = datetime.now() + timedelta(days=1)
|
||||
|
||||
# Init iptables
|
||||
self.table = iptc.Table(iptc.Table.MANGLE)
|
||||
self.chain = iptc.Chain(self.table, self._chain)
|
||||
|
||||
|
||||
def load_client(self, data):
|
||||
self.client_id = data.get('client_id')
|
||||
|
|
Loading…
Reference in a new issue