root/trunk/twisted/tap/socks.py

Revision 25168, 1.1 KB (checked in by exarkun, 22 months ago)

Merge remove-mktap-3393

Author: kehander1, exarkun
Reviewer: ralphm, itamar
Fixes: #3393

Remove almost all references to mktap(1) from the Twisted documentation.

The finger tutorial still refers to mktap since it also contains an
old-style plugin which will not work with twistd.

Line 
1
2# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
3# See LICENSE for details.
4
5
6"""
7I am a support module for making SOCKSv4 servers with twistd.
8"""
9
10from twisted.protocols import socks
11from twisted.python import usage
12from twisted.application import internet
13import sys
14
15class Options(usage.Options):
16    synopsis = "[-i <interface>] [-p <port>] [-l <file>]"
17    optParameters = [["interface", "i", "127.0.0.1", "local interface to which we listen"],
18                  ["port", "p", 1080, "Port on which to listen"],
19                  ["log", "l", None, "file to log connection data to"]]
20    zsh_actions = {"log" : "_files -g '*.log'"}
21
22    longdesc = "Makes a SOCKSv4 server."
23
24def makeService(config):
25    if config["interface"] != "127.0.0.1":
26        print
27        print "WARNING:"
28        print "  You have chosen to listen on a non-local interface."
29        print "  This may allow intruders to access your local network"
30        print "  if you run this on a firewall."
31        print
32    t = socks.SOCKSv4Factory(config['log'])
33    portno = int(config['port'])
34    return internet.TCPServer(portno, t, interface=config['interface'])
Note: See TracBrowser for help on using the browser.