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`.`names`.`srvconnect`.`SRVConnector``

class documentation

`class SRVConnector: (source)`

Constructor: `SRVConnector(reactor, service, domain, factory, ...)`

Implements interfaces: `twisted.internet.interfaces.IConnector`

View In Hierarchy

A connector that looks up DNS SRV records.

RFC 2782 details how SRV records should be interpreted and selected for subsequent connection attempts. The algorithm for using the records' priority and weight is implemented in `pickServer`.

Method | `__init__` | No summary
Method | `connect` | Start connection to remote server.
Method | `connectionFailed` | Undocumented
Method | `connectionLost` | Undocumented
Method | `disconnect` | Disconnect whatever our are state is.
Method | `getDestination` | Return destination this will try to connect to.
Method | `pickServer` | Pick the next server.
Method | `stopConnecting` | Stop attempting to connect.
Instance Variable | `connectFuncArgs` | Undocumented
Instance Variable | `connectFuncKwArgs` | Undocumented
Instance Variable | `connectFuncName` | Undocumented
Instance Variable | `connector` | Undocumented
Instance Variable | `domain` | Undocumented
Instance Variable | `factory` | Undocumented
Instance Variable | `host` | Undocumented
Instance Variable | `orderedServers` | List of server records that have already been tried in this round of connection attempts.
Instance Variable | `port` | Undocumented
Instance Variable | `protocol` | Undocumented
Instance Variable | `reactor` | Undocumented
Instance Variable | `servers` | List of candidate server records for future connection attempts.
Instance Variable | `service` | Undocumented
Instance Variable | `stopAfterDNS` | Undocumented
Method | `_cbGotServers` | Undocumented
Method | `_ebGotServers` | Undocumented
Method | `_ebServiceUnknown` | Connect to the default port when the service name is unknown.
Method | `_reallyConnect` | Undocumented
Instance Variable | `_defaultPort` | Undocumented

def __init__(self, reactor, service, domain, factory, protocol='tcp', connectFuncName='connectTCP', connectFuncArgs=(), connectFuncKwArgs={}, defaultPort=None): (source)

Parameters
reactor | Undocumented
service | Undocumented
domain:`bytes` or `str` | The domain to connect to. If passed as a text string, it will be encoded using `idna` encoding.
factory | Undocumented
protocol | Undocumented
connectFuncName | Undocumented
connectFuncArgs | Undocumented
connectFuncKwArgs | Undocumented
defaultPort:`int` | Optional default port number to be used when SRV lookup fails and the service name is unknown. This should be the port number associated with the service name as defined by the IANA registry.

def connect(self): (source)
from `twisted.internet.interfaces.IConnector`

Start connection to remote server.

def connectionFailed(self, reason): (source)

Undocumented

def connectionLost(self, reason): (source)

Undocumented

def disconnect(self): (source)
from `twisted.internet.interfaces.IConnector`

Disconnect whatever our are state is.

def getDestination(self): (source)
from `twisted.internet.interfaces.IConnector`

Return destination this will try to connect to.

Returns
An object which provides `IAddress`.

def pickServer(self): (source)

Pick the next server.

This selects the next server from the list of SRV records according to their priority and weight values, as set out by the default algorithm specified in RFC 2782.

At the beginning of a round, `servers` is populated with `orderedServers`, and the latter is made empty. `servers` is the list of candidates, and `orderedServers` is the list of servers that have already been tried.

First, all records are ordered by priority and weight in ascending order. Then for each priority level, a running sum is calculated over the sorted list of records for that priority. Then a random value between 0 and the final sum is compared to each record in order. The first record that is greater than or equal to that random value is chosen and removed from the list of candidates for this round.

Returns
`tuple` of native `str` and `int` | A tuple of target hostname and port from the chosen DNS SRV record.

def stopConnecting(self): (source)
from `twisted.internet.interfaces.IConnector`

Stop attempting to connect.

connectFuncArgs = (source)

Undocumented

connectFuncKwArgs = (source)

Undocumented

connectFuncName = (source)

Undocumented

connector = (source)

Undocumented

domain = (source)

Undocumented

factory = (source)

Undocumented

host = (source)

Undocumented

orderedServers: `list` of `dns.Record_SRV` = (source)

List of server records that have already been tried in this round of connection attempts.

port = (source)

Undocumented

protocol = (source)

Undocumented

reactor = (source)

Undocumented

servers: `list` of `dns.Record_SRV` = (source)

List of candidate server records for future connection attempts.

service = (source)

Undocumented

stopAfterDNS: `int` = (source)

Undocumented

def _cbGotServers(self, result): (source)

Undocumented

def _ebGotServers(self, failure): (source)

Undocumented

def _ebServiceUnknown(self, failure): (source)

Connect to the default port when the service name is unknown.

If no SRV records were found, the service name will be passed as the port. If resolving the name fails with `error.ServiceNameUnknownError`, a final attempt is done using the default port.

def _reallyConnect(self): (source)

Undocumented

_defaultPort = (source)

Undocumented