onbasca.base.models package

Submodules

onbasca.base.models.base module

class onbasca.base.models.base.BaseManager(*args, **kwargs)[source]

Bases: Manager

delete_old(days=28)[source]
class onbasca.base.models.base.BaseModel(*args, **kwargs)[source]

Bases: Model

class Meta[source]

Bases: object

abstract = False
objects

onbasca.base.models.bridge module

Bridge base model.

class onbasca.base.models.bridge.BridgeBase(*args, **kwargs)[source]

Bases: BaseModel

class Meta[source]

Bases: object

abstract = False
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.

objects
class onbasca.base.models.bridge.BridgeManagerBase(*args, **kwargs)[source]

Bases: BaseManager

from_bridgeline(bridgeline)[source]

Create a bridge from a bridgeline

onbasca.base.models.bridge.fingerprint_from_bridgeline(bridgeline)[source]

Obtain the bridge fingerprint from a bridge line.

From 7. Displaying Bridge Information (https://gitlab.torproject.org/tpo/core/torspec/-/blob/main/bridgedb-spec.txt#L357) Bridges are formatted as:

<address:port> NL

Pluggable transports are formatted as:

<transportname> SP <address:port> [SP arglist] NL
Example::
  • with transport:: obfs4 <ip>:<port> <fingerprint> cert=<cert> iat-mode=<iat-mode>

  • without transport:: <ip>:<port> <fingerprint>

onbasca.base.models.bwfile module

class onbasca.base.models.bwfile.BwFileBase(*args, **kwargs)[source]

Bases: BaseModel

class Meta[source]

Bases: object

abstract = False
get_latest_by = 'file_created'
consensus_routerstatuses_count()[source]
file_created

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

latest_bandwidth

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

objects
relaybw_set_count()[source]
relaybw_set_vote_count()[source]
scanner_country

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

software

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

software_version

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

to_str()[source]
to_str_v15()[source]
tor_version

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

class onbasca.base.models.bwfile.BwFileManagerBase(*args, **kwargs)[source]

Bases: Manager

onbasca.base.models.consensus module

class onbasca.base.models.consensus.ConsensusBase(*args, **kwargs)[source]

Bases: BaseModel

class Meta[source]

Bases: object

abstract = False
get_next_by_valid_after(*, field=<django.db.models.fields.DateTimeField: valid_after>, is_next=True, **kwargs)
get_previous_by_valid_after(*, field=<django.db.models.fields.DateTimeField: valid_after>, is_next=False, **kwargs)
objects
relays()[source]
relays_count()[source]
routerstatuses()[source]
routerstatuses_count()[source]
valid_after

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

class onbasca.base.models.consensus.ConsensusManagerBase(*args, **kwargs)[source]

Bases: Manager

from_router_statuses(router_statuses, valid_after=None)[source]

onbasca.base.models.relay module

class onbasca.base.models.relay.RelayBase(*args, **kwargs)[source]

Bases: BaseModel

class Meta[source]

Bases: object

abstract = False
are_relaydescs_observed_bandwidth_0()[source]

Return True if any of the descriptors have observed bandwidth.

#41: This method is only to log when this happen. It will be logged when the generator scales the bandwidth.

consensuses

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

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

consensuses_count()[source]
fingerprint

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

is_exit()[source]
min_descriptor_consensus_bandwidth()[source]
objects
relaybws()[source]
relaybws_count()[source]
relaydesc_latest()[source]
relaydescs()[source]
relaydescs_count()[source]
relaydescs_min_bandwidth_latest()[source]
routerstatus_latest()[source]
routerstatuses()[source]
routerstatuses_count()[source]
set_relaydescs_min_bandwidth_mean()[source]
set_routerstatuses_bandwidth_mean()[source]
class onbasca.base.models.relay.RelayManagerBase(*args, **kwargs)[source]

Bases: Manager

from_router_status(router_status, consensus=None)[source]

onbasca.base.models.relaybw module

class onbasca.base.models.relaybw.RelayBwBase(*args, **kwargs)[source]

Bases: BaseModel

class Meta[source]

Bases: object

abstract = False
get_latest_by = 'measured_at'
unique_together = ['fingerprint', 'bwfile']
bw

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

consensus_bandwidth

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

consensus_bandwidth_is_unmeasured

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

desc_bw_avg

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

desc_bw_bur

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

desc_bw_obs_last

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

error_circ

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

error_stream

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.

is_exit()[source]
measured_at

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

nickname

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

objects
relay_in_recent_consensus_count

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

relay_recent_measurement_attempt_count

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

relay_recent_measurement_failure_count

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

relay_recent_measurements_excluded_error_count

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

relay_recent_priority_list_count

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

relay_relaydesc_latest()[source]
relay_routerstatus_latest()[source]
success

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

to_str()[source]
to_str_v15()[source]
under_min_report

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

updated_at

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

vote

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

class onbasca.base.models.relaybw.RelayBwManagerBase(*args, **kwargs)[source]

Bases: Manager

onbasca.base.models.relaydesc module

class onbasca.base.models.relaydesc.RelayDescBase(*args, **kwargs)[source]

Bases: BaseModel

class Meta[source]

Bases: object

abstract = False
get_latest_by = 'published'
unique_together = ('published', 'fingerprint')
average_bandwidth

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

burst_bandwidth

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

can_exit_443

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

ed25519_master_key

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.

nickname

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

objects
observed_bandwidth

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

published

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

set_min_bandwidth()[source]
class onbasca.base.models.relaydesc.RelayDescManagerBase(*args, **kwargs)[source]

Bases: Manager

from_relay_desc(relay_desc, **kwargs)[source]

onbasca.base.models.routerstatus module

class onbasca.base.models.routerstatus.RouterStatusBase(*args, **kwargs)[source]

Bases: BaseModel

class Meta[source]

Bases: object

abstract = False
get_latest_by = 'published'
unique_together = ('consensus', 'fingerprint')
address

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

bandwidth

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.

is_exit

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

is_unmeasured

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

nickname

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

objects
published

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

class onbasca.base.models.routerstatus.RouterStatusManagerBase(*args, **kwargs)[source]

Bases: Manager

from_router_status(router_status, consensus=None, **kwargs)[source]

Module contents