1 # The software in this package is distributed under the GNU General
2 # Public License version 2 (with a special exception described below).
4 # A copy of GNU General Public License (GPL) is included in this distribution,
5 # in the file COPYING.GPL.
7 # As a special exception, if other files instantiate templates or use macros
8 # or inline functions from this file, or you compile this file and link it
9 # with other works to produce a work based on this file, this file
10 # does not by itself cause the resulting work to be covered
11 # by the GNU General Public License.
13 # However the source code for this file must still be made available
14 # in accordance with section (3) of the GNU General Public License.
16 # This exception does not invalidate any other reasons why a work based
17 # on this file might be covered by the GNU General Public License.
19 # Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
21 from .build_cnfvar import BuildCnfVar
22 """Class to create proxy accesslists on the fly"""
25 class BuildProxyAccesslist(BuildCnfVar):
26 def __init__(self, data='', instance=0, line_no=1):
27 BuildCnfVar.__init__(self, 'PROXY_ACCESSLIST', instance, data, line_no)
29 defaults = {'PROXY_ACCESSLIST_ENTRY_COUNT': '123',
30 'PROXY_ACCESSLIST_MODE': '1',
31 'PROXY_ACCESSLIST_SIZETYPE': 1,
32 'PROXY_ACCESSLIST_TYPE': 0}
34 self.add_defaults(defaults)
36 def mode_whitelist(self):
37 self.update_cnf('PROXY_ACCESSLIST_MODE', 0, '0')
40 def mode_blacklist(self):
41 self.update_cnf('PROXY_ACCESSLIST_MODE', 0, '1')
44 def add_url(self, url):
45 self.add_cnf('PROXY_ACCESSLIST_URL', -1, url)