onbrisca.models package

Submodules

onbrisca.models.bridge module

class onbrisca.models.bridge.Bridge(*args, **kwargs)[source]

Bases: BridgeBase

Bridge model that calculates and saves the stream ratio.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

async asave(*args, **kwargs)[source]
bridgeline

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fingerprint

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

async helper_path(consensus: Consensus) list[source]
is_valid(ratio, ratio_threshold=0.9)[source]
latest_measurement()[source]
measurements

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <onbrisca.models.bridge.BridgeManager object>
set_bw_filt()[source]
set_bw_mean()[source]
set_ratio()[source]
set_ratio_filt(muf)[source]
set_ratio_stream(mu)[source]
set_ratios(mu, muf)[source]
class onbrisca.models.bridge.BridgeManager(*args, **kwargs)[source]

Bases: BridgeManagerBase

BridgeManager model for operations with all the bridges.

async acount()[source]
bridgelines() list[source]
bridgelines_config() dict[source]
bridgelines_from_bridges(bridges) list[source]

Return a bridgelines list for the given set of bridges.

delete_invalid()[source]

Delete the bridges in the database that have invalid bridgelines, so that they don’t fail to be set to tor configuration.

mu()[source]
muf()[source]
ordered()[source]

onbrisca.models.bridge_heartbeat module

class onbrisca.models.bridge_heartbeat.BridgeHeartbeat(id, _obj_created_at, _obj_updated_at, loops_count, measured_count, measured_percent, previous_measured_percent, elapsed_time, _min_percent_relays_to_report_reached_at)[source]

Bases: Heartbeat

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

log_status()[source]

Print the new percentage of the different bridges that were measured.

This way it can be known whether the scanner is making progress measuring all the Network.

Log the percentage, the number of bridges measured and not measured, the number of loops and the time elapsed since it started measuring.

objects = <onbrisca.models.bridge_heartbeat.BridgeHeartbeatManager object>
class onbrisca.models.bridge_heartbeat.BridgeHeartbeatManager(*args, **kwargs)[source]

Bases: BaseManager

onbrisca.models.bridge_measurement module

class onbrisca.models.bridge_measurement.BridgeMeasurement(id, _obj_created_at, _obj_updated_at, bridge, webserver, bandwidth, error)[source]

Bases: BaseModel

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

async ameasure_bandwidth(http_client, bytes_range, size=16384)[source]
async asave(*args, **kwargs)[source]
bandwidth

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

bridge

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

bridge_id
error

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

async finish_with_error(error)[source]
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <onbrisca.models.bridge_measurement.BridgeMeasurementManager object>
webserver

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

webserver_id
class onbrisca.models.bridge_measurement.BridgeMeasurementManager(*args, **kwargs)[source]

Bases: BaseManager

onbrisca.models.bridge_scanner module

class onbrisca.models.bridge_scanner.BridgeScanner(*args, **kwargs)[source]

Bases: Scanner

Singleton class that manages the measurers.

And initializes all the needed objects.

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

async ameasure_bridge(bridge: Bridge)[source]
delete_old_objects(days=28)[source]
handle_new_descriptor_event(event)[source]
init(port=None, socket=None)[source]
run()[source]
scan()[source]
async scan_bridge()[source]
scan_bridges()[source]

Module contents