]> git.llucax.com Git - software/pymin.git/blob - services/vpn/host.py
Split proxy handler in submodules (refs #2).
[software/pymin.git] / services / vpn / host.py
1 # vim: set encoding=utf-8 et sw=4 sts=4 :
2
3 from pymin.seqtools import Sequence
4 from pymin.service.util import DictComposedSubHandler
5
6 __all__ = ('HostHandler',)
7
8
9 class Host(Sequence):
10     def __init__(self, vpn_src, ip, vpn_src_net, key):
11         self.name = vpn_src
12         self.ip = ip
13         self.src_net = vpn_src_net
14         self.pub_key = key
15         self._delete = False
16
17     def as_tuple(self):
18         return(self.name, self.ip, self.src_net, self.pub_key)
19
20 class HostHandler(DictComposedSubHandler):
21
22     handler_help = u"Manage hosts for a vpn"
23     _comp_subhandler_cont = 'vpns'
24     _comp_subhandler_attr = 'hosts'
25     _comp_subhandler_class = Host
26