Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`protocols`.`socks`.`SOCKSv4``

class documentation

`class SOCKSv4(protocol.Protocol): (source)`

View In Hierarchy

An implementation of the SOCKSv4 protocol.

Method | `__init__` | Undocumented
Method | `authorize` | Undocumented
Method | `connectClass` | Undocumented
Method | `connectionLost` | Called when the connection is shut down.
Method | `connectionMade` | Called when a connection is made.
Method | `dataReceived` | Called whenever data is received.
Method | `listenClass` | Undocumented
Method | `log` | Undocumented
Method | `makeReply` | Undocumented
Method | `write` | Undocumented
Instance Variable | `buf` | Part of a SOCKSv4 connection request.
Instance Variable | `logging` | If not `None`, the name of the logfile to which connection information will be written.
Instance Variable | `otherConn` | Until the connection has been established, `otherConn` is `None`. After that, it is the proxy-to-destination protocol instance along which the client's connection is being forwarded.
Instance Variable | `reactor` | The reactor used to create connections.
Method | `_dataReceived2` | The second half of the SOCKS connection setup. For a SOCKSv4 packet this is after the server address has been extracted from the header. For a SOCKSv4a packet this is after the host name has been resolved.

Inherited from `Protocol`:

Method | `logPrefix` | Return a prefix matching the class name, to identify log messages related to this protocol instance.
Class Variable | `factory` | Undocumented

Inherited from `BaseProtocol` (via `Protocol`):

Method | `makeConnection` | Make a connection to a transport and a server.
Instance Variable | `connected` | Undocumented
Instance Variable | `transport` | Undocumented

def __init__(self, logging=None, reactor=reactor): (source)

Undocumented

def authorize(self, code, server, port, user): (source)

Undocumented

def connectClass(self, host, port, klass, *args): (source)

Undocumented

def connectionLost(self, reason): (source)
from `twisted.internet.interfaces.IProtocol`
overrides `twisted.internet.protocol.Protocol.connectionLost`

Called when the connection is shut down.

Clear any circular references here, and any external references to this Protocol. The connection has been closed.

Parameters
reason:`twisted.python.failure.Failure` | Undocumented

def connectionMade(self): (source)
from `twisted.internet.interfaces.IProtocol`
overrides `twisted.internet.protocol.BaseProtocol.connectionMade`

Called when a connection is made.

This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.

def dataReceived(self, data): (source)
from `twisted.internet.interfaces.IProtocol`
overrides `twisted.internet.protocol.Protocol.dataReceived`

Called whenever data is received.

Parameters
data:`bytes` | Part or all of a SOCKSv4 packet.

def listenClass(self, port, klass, *args): (source)

Undocumented

def log(self, proto, data): (source)

Undocumented

def makeReply(self, reply, version=0, port=0, ip='0.0.0.0'): (source)

Undocumented

def write(self, data): (source)

Undocumented

buf: `str` = (source)

Part of a SOCKSv4 connection request.

logging: `str` or `None` = (source)

If not `None`, the name of the logfile to which connection information will be written.

otherConn: `SOCKSv4Incoming`, `SOCKSv4Outgoing` or `None` = (source)

Until the connection has been established, `otherConn` is `None`. After that, it is the proxy-to-destination protocol instance along which the client's connection is being forwarded.

reactor: object providing `twisted.internet.interfaces.IReactorTCP` = (source)

The reactor used to create connections.

def _dataReceived2(self, server, user, version, code, port): (source)

The second half of the SOCKS connection setup. For a SOCKSv4 packet this is after the server address has been extracted from the header. For a SOCKSv4a packet this is after the host name has been resolved.

Parameters
server:`str` | The IP address of the destination, represented as a dotted quad.
user:`str` | The username associated with the connection.
version:`int` | The SOCKS protocol version number.
code:`int` | The command code. 1 means establish a TCP/IP stream connection, and 2 means establish a TCP/IP port binding.
port:`int` | The port number associated with the connection.