1
# -*- test-case-name: twisted.words.test -*-
2
# Copyright (c) 2001-2005 Twisted Matrix Laboratories.
3
# See LICENSE for details.
6
""" A temporary placeholder for client-capable strports, until we
7
sufficient use cases get identified """
9
from twisted.application import strports
11
def _parseTCPSSL(factory, domain, port):
12
""" For the moment, parse TCP or SSL connections the same """
13
return (domain, int(port), factory), {}
15
def _parseUNIX(factory, address):
16
return (address, factory), {}
19
_funcs = { "tcp" : _parseTCPSSL,
21
"ssl" : _parseTCPSSL }
24
def parse(description, factory):
25
args, kw = strports._parse(description)
26
return (args[0].upper(),) + _funcs[args[0]](factory, *args[1:], **kw)
28
def client(description, factory):
29
from twisted.application import internet
30
name, args, kw = parse(description, factory)
31
return getattr(internet, name + 'Client')(*args, **kw)