Functions for filtering Bridges
.
bySubring
(hmac, assigned, total)[source]¶Create a filter function which filters for only the bridges which fall into the same assigned subhashring (based on the results of an hmac function).
Parameters: |
|
---|---|
Return type: | |
Returns: | A filter function for |
byFilters
(filtres)[source]¶Returns a filter which filters by multiple filtres.
Parameters: | filtres (list) – A list (or other iterable) of callables which some
Bridges should be filtered
according to. |
---|---|
Return type: | callable |
Returns: | A filter function for Bridges . |
byIPv
(ipVersion=None)[source]¶Return True
if at least one of the bridge‘s addresses has the
specified ipVersion.
Parameters: | ipVersion (int) – Either 4 or 6 . |
---|
byIPv4
(bridge)¶Determine if the bridge has an IPv4 address.
Parameters: | bridge (bridgedb.bridges.Bridge ) – A bridge to filter. |
---|---|
Return type: | bool |
Returns: | True if the bridge has an address with the
correct IP version; False otherwise. |
byIPv6
(bridge)¶Determine if the bridge has an IPv6 address.
Parameters: | bridge (bridgedb.bridges.Bridge ) – A bridge to filter. |
---|---|
Return type: | bool |
Returns: | True if the bridge has an address with the
correct IP version; False otherwise. |
byTransport
(methodname=None, ipVersion=None)[source]¶Returns a filter function for a Bridge
.
The returned filter function should be called on a
Bridge
. It returns True
if the
Bridge
has a
PluggableTransport
such that:
methodname
matches methodname, and,bridgedb.bridges.PluggableTransport.address.version
equals the ipVersion.Parameters: |
|
---|---|
Return type: | |
Returns: | A filter function for |
byNotBlockedIn
(countryCode=None, methodname=None, ipVersion=4)[source]¶Returns a filter function for Bridges
.
If a Pluggable Transport methodname was not specified, the returned
filter function returns True
if any of the Bridge
‘s addresses or
PluggableTransport
addresses aren’t blocked in
countryCode. See isBlockedIn()
.
Otherwise, if a Pluggable Transport methodname was specified, it
returns True
if the Bridge
has a
PluggableTransport
such that:
methodname
matches methodname,bridgedb.bridges.PluggableTransport.address.version
equals the ipVersion, and,PluggableTransport
.
address
isn’t
known to be blocked in countryCode.Parameters: |
|
---|---|
Return type: | |
Returns: | A filter function for |