Merge branch 'pull_request_5'
[punjab-krb5-preauth] / twisted / plugins / punjab_plugin.py
1 from zope.interface import implements
2 from twisted.python import usage
3 from twisted.plugin import IPlugin
4 from twisted.application.service import IServiceMaker
5
6 # Due to the directory layout, and the fact that plugin directories aren't
7 # modules (no __init__.py), this file is named something other than punjab.py,
8 # to ensure that this import pulls in the right module.
9 import punjab
10
11 class Options(usage.Options):
12     optParameters = [
13         ('host', None, 'localhost'),
14         ('port', None, 5280),
15         ('httpb', 'b', "http-bind"),
16         ('polling', None, '15'),
17         ('html_dir', None, "./html"),
18         ('ssl', None, None),
19         ('ssl_privkey', None, "ssl.key"),
20         ('ssl_cert', None, "ssl.crt"),
21         ('white_list', None, None,
22             'Comma separated list of domains to allow connections to. \
23             Begin an entry with a period to allow connections to subdomains. \
24             e.g.: --white_list=.example.com,domain.com'),
25         ('black_list', None, None,
26          'Comma separated list of domains to deny connections to. ' \
27          'Begin an entry with a period to deny connections to subdomains. '\
28          'e.g.: --black_list=.example.com,domain.com'),
29     ]
30
31     optFlags = [
32         ('verbose', 'v', 'Show traffic'),
33     ]
34
35 class ServiceFactory(object):
36     implements(IServiceMaker, IPlugin)
37     tapname = "punjab"
38     description = "A HTTP XMPP client interface"
39     options = Options
40
41     def makeService(self, options):
42         return punjab.makeService(options)
43
44 service = ServiceFactory()
45