Events¶
This page describes all the possible events and their parser implementation, received through
the callbacks registered by Controller.add_event_handler(). Note that all unknown events
will receive an EventUnknown, containing the raw Message received.
Base classes¶
- class aiostem.event.Event[source]¶
Bases:
ABCBase class for all events.
-
ADAPTER:
ClassVar[TypeAdapter[Self] |None] = None¶ Cached adapter used while deserializing the message.
-
TYPE:
ClassVar[EventWordInternal|EventWord|None]¶ Type of event this class is a parser for.
- classmethod adapter() TypeAdapter[Self][source]¶
Get a cached type adapter to deserialize a reply.
- Return type:
-
ADAPTER:
- class aiostem.event.EventLog[source]¶
Bases:
EventBase class for any event log.
-
severity:
LogSeverity¶ Log severity.
-
severity:
- class aiostem.event.EventSimple[source]¶
Bases:
EventAn event with a simple single syntax parser.
-
SYNTAX:
ClassVar[ReplySyntax]¶ Simple syntax to parse the message from.
-
SYNTAX:
Library events¶
This event is hooked on the event system provided and works in a similar way but is only handled internally by this library.
- class aiostem.event.EventDisconnect[source]¶
Bases:
EventStructure for a
DISCONNECTevent.Note
This event is internal to
aiostem.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'DISCONNECT'¶ Type of event this class is a parser for.
-
TYPE:
Circuit events¶
- class aiostem.event.EventAddrMap[source]¶
Bases:
EventSimpleStructure for a
ADDRMAPevent.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'ADDRMAP'¶ Type of event this class is a parser for.
-
TYPE:
- class aiostem.event.EventBuildTimeoutSet[source]¶
Bases:
EventSimpleStructure for a
BUILDTIMEOUT_SETevent.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'BUILDTIMEOUT_SET'¶ Type of event this class is a parser for.
-
TYPE:
- class aiostem.event.EventCirc[source]¶
Bases:
EventSimpleStructure for a
CIRCevent.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'CIRC'¶ Type of event this class is a parser for.
-
status:
Annotated[CircuitStatus|str]¶ Circuit status reported by this event.
-
conflux_id:
Annotated[bytes] |None¶ Conflux identifier
Note
Available starting from Tor v0.4.8.15 (ticket 40872)
-
conflux_rtt:
Annotated[timedelta] |None¶ Conflux round trip time
Note
Available starting from Tor v0.4.8.15 (ticket 40872)
-
hs_pow:
Annotated[CircuitHiddenServicePow] |None¶ Hidden service proof of work effort attached to this circuit.
-
path:
Annotated[Sequence[LongServerName]] |None¶ List of servers in this circuit, when provided.
-
purpose:
Annotated[CircuitPurpose|str] |None¶ Current circuit purpose.
-
reason:
Annotated[CircuitCloseReason|str] |None¶ This field is provided only for
FAILEDandCLOSEDevents.
-
remote_reason:
Annotated[CircuitCloseReason|str] |None¶ Provided only when we receive a DESTROY cell or RELAY_TRUNCATE message.
-
rend_query:
Annotated[Annotated[HiddenServiceAddressV2] |Annotated[HiddenServiceAddressV3]] |None¶ Onion address related to this circuit (if any).
-
socks_username:
str|None¶ Username used by a SOCKS client to connect to Tor and initiate this circuit.
-
TYPE:
- class aiostem.event.EventCircBW[source]¶
Bases:
EventSimpleStructure for a
CIRC_BWevent.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'CIRC_BW'¶ Type of event this class is a parser for.
-
TYPE:
- class aiostem.event.EventCircMinor[source]¶
Bases:
EventSimpleStructure for a
CIRC_MINORevent.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'CIRC_MINOR'¶ Type of event this class is a parser for.
-
event:
Annotated[CircuitEvent|str]¶ Circuit event, either
PURPOSE_CHANGEDorCANNIBALIZED.
-
path:
Annotated[Sequence[LongServerName]] |None¶ Circuit path, when provided.
-
purpose:
Annotated[CircuitPurpose|str] |None¶ Current circuit purpose.
-
rend_query:
Annotated[Annotated[HiddenServiceAddressV2] |Annotated[HiddenServiceAddressV3]] |None¶ Onion address related to this circuit.
-
old_hs_state:
Annotated[CircuitHiddenServiceState|str] |None¶ Previous hidden service state when applicable.
-
old_purpose:
Annotated[CircuitPurpose|str] |None¶ Previous circuit purpose.
-
TYPE:
- class aiostem.event.EventConnBW[source]¶
Bases:
EventSimpleStructure for a
CONN_BWevent.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'CONN_BW'¶ Type of event this class is a parser for.
-
TYPE:
- class aiostem.event.EventStream[source]¶
Bases:
EventSimpleStructure for a
STREAMevent.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'STREAM'¶ Type of event this class is a parser for.
-
status:
StreamStatus¶ Status of the stream event reported here.
-
target:
StreamTarget¶ Target address or server of this stream (or
0when unattached).
-
client_protocol:
Annotated[StreamClientProtocol|str] |None¶ The protocol that was used by a client to initiate this stream.
-
iso_fields:
Annotated[Set[str]] |None¶ Indicates the set of STREAM event fields for which stream isolation is enabled.
-
purpose:
Annotated[StreamPurpose|str] |None¶ Only for
NEWandNEWRESOLVEevents.
-
reason:
Annotated[StreamCloseReason|str] |None¶ Provided only for
FAILED,CLOSED, andDETACHEDevents,
-
remote_reason:
Annotated[StreamCloseReason|str] |None¶ Provided only when we receive a RELAY_END message.
-
session_group:
int|None¶ Indicates the session group of the listener port that a client used for this stream.
-
socks_username:
str|None¶ Username used by a SOCKS client to connect to Tor and initiate this circuit.
-
socks_password:
str|None¶ Password used by a SOCKS client to connect to Tor and initiate this circuit.
-
source:
Annotated[RemapSource|str] |None¶ Generally either
CACHEorEXIT, used withStreamStatus.REMAP.
-
source_addr:
TcpAddressPort|None¶ Source (local) address.
-
TYPE:
- class aiostem.event.EventStreamBW[source]¶
Bases:
EventSimpleStructure for a
STREAM_BWevent.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'STREAM_BW'¶ Type of event this class is a parser for.
-
TYPE:
Log events¶
- class aiostem.event.EventLogDebug[source]¶
Bases:
EventLogEvent parser for
DEBUGevents.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'DEBUG'¶ Type of event this class is a parser for.
-
TYPE:
- class aiostem.event.EventLogInfo[source]¶
Bases:
EventLogEvent parser for
INFOevents.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'INFO'¶ Type of event this class is a parser for.
-
TYPE:
- class aiostem.event.EventLogNotice[source]¶
Bases:
EventLogEvent parser for
NOTICEevents.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'NOTICE'¶ Type of event this class is a parser for.
-
TYPE:
Status events¶
- class aiostem.event.EventBaseNetworkStatus[source]¶
Bases:
EventBase class for network status events.
-
routers:
Sequence[RouterStatus]¶ Raw content of the new network status.
-
routers:
- class aiostem.event.EventDescChanged[source]¶
Bases:
EventSimpleStructure for a
DESCCHANGEDevent.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'DESCCHANGED'¶ Type of event this class is a parser for.
-
TYPE:
- class aiostem.event.EventGuard[source]¶
Bases:
EventSimpleStructure for a
GUARDevent.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'GUARD'¶ Type of event this class is a parser for.
-
name:
LongServerName¶ Full server name of the guard node.
-
status:
Annotated[GuardEventStatus|str]¶ Status of the guard in our event.
-
TYPE:
- class aiostem.event.EventNetworkLiveness[source]¶
Bases:
EventSimpleStructure for a
NETWORK_LIVENESSevent.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'NETWORK_LIVENESS'¶ Type of event this class is a parser for.
-
status:
LivenessStatus¶ Current network status.
-
TYPE:
- class aiostem.event.EventNetworkStatus[source]¶
Bases:
EventBaseNetworkStatusStructure for a
NSevent.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'NS'¶ Type of event this class is a parser for.
-
TYPE:
- class aiostem.event.EventNewConsensus[source]¶
Bases:
EventBaseNetworkStatusStructure for a
NEWCONSENSUSevent.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'NEWCONSENSUS'¶ Type of event this class is a parser for.
-
TYPE:
- class aiostem.event.EventNewDesc[source]¶
Bases:
EventSimpleStructure for a
NEWDESCevent.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'NEWDESC'¶ Type of event this class is a parser for.
-
servers:
Sequence[LongServerName]¶ List of new server identifiers received.
-
TYPE:
- class aiostem.event.EventOrConn[source]¶
Bases:
EventSimpleStructure for a
ORCONNevent.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'ORCONN'¶ Type of event this class is a parser for.
-
server:
LongServerName¶ Onion router server name reported in this event.
-
status:
OrConnStatus¶ Status of the connection to the onion router.
-
TYPE:
- class aiostem.event.EventStatusGeneral[source]¶
Bases:
EventStatusEvent parser for
STATUS_GENERALevents.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'STATUS_GENERAL'¶ Type of event this class is a parser for.
-
action:
StatusActionGeneral¶ Which action this general status event is for.
-
arguments:
Annotated[Annotated[StatusGeneralBug] |Annotated[StatusGeneralClockJumped] |Annotated[StatusGeneralClockSkew] |Annotated[StatusGeneralDangerousVersion] |Annotated[StatusGeneralTooManyConnections] |Annotated[None]]¶ Arguments associated with the
action.
-
TYPE:
- class aiostem.event.EventStatusClient[source]¶
Bases:
EventStatusEvent parser for
STATUS_CLIENTevents.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'STATUS_CLIENT'¶ Type of event this class is a parser for.
-
action:
StatusActionClient¶ Which action this client status event is for.
-
arguments:
Annotated[Annotated[StatusClientBootstrap] |Annotated[StatusClientCircuitNotEstablished] |Annotated[StatusClientDangerousPort] |Annotated[StatusClientDangerousSocks] |Annotated[StatusClientSocksBadHostname] |Annotated[None]]¶ Arguments associated with the
action.
-
TYPE:
- class aiostem.event.EventStatusServer[source]¶
Bases:
EventStatusEvent parser for
STATUS_SERVERevents.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'STATUS_SERVER'¶ Type of event this class is a parser for.
-
action:
StatusActionServer¶ Which action this server status event is for.
-
arguments:
Annotated[Annotated[StatusServerExternalAddress] |Annotated[StatusServerCheckingReachability] |Annotated[StatusServerReachabilitySucceeded] |Annotated[StatusServerNameserverStatus] |Annotated[StatusServerBadServerDescriptor] |Annotated[StatusServerAcceptedServerDescriptor] |Annotated[StatusServerReachabilityFailed] |Annotated[StatusServerHibernationStatus] |Annotated[None]]¶ Arguments associated with the
action.
-
TYPE:
Pluggable transport events¶
- class aiostem.event.EventPtLog[source]¶
Bases:
EventSimpleEvent parser for
PT_LOGevents.See also
-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'PT_LOG'¶ Type of event this class is a parser for.
-
message:
str¶ The status message that the PT sends back to the tor parent minus the
STATUSstring prefix.
-
severity:
LogSeverity¶ Log severity.
-
TYPE:
- class aiostem.event.EventPtStatus[source]¶
Bases:
EventEvent parser for
PT_STATUSevents.See also
-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'PT_STATUS'¶ Type of event this class is a parser for.
-
TYPE:
- class aiostem.event.EventTransportLaunched[source]¶
Bases:
EventSimpleEvent parser for
TRANSPORT_LAUNCHEDevents.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'TRANSPORT_LAUNCHED'¶ Type of event this class is a parser for.
-
host:
IPv4Address|IPv6Address¶ Host hosting the pluggable transport.
-
TYPE:
Stats events¶
- class aiostem.event.EventBandwidth[source]¶
Bases:
EventSimpleStructure for a
BWevent.Note
Documentation seems to tell that there are keyword arguments on this event but the real implementation does not show any of them. These are being ignored here for now.
-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'BW'¶ Type of event this class is a parser for.
-
TYPE:
- class aiostem.event.EventCellStats[source]¶
Bases:
EventSimpleStructure for a
CELL_STATSevent.Important
These events are only generated if TestingTorNetwork is set.
-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'CELL_STATS'¶ Type of event this class is a parser for.
-
circuit:
Annotated[int] |None¶ Circuit identifier only included if the circuit originates at this node.
-
inbound_queue:
int|None¶ InboundQueue is the identifier of the inbound circuit queue of this circuit.
-
inbound_added:
Annotated[Mapping[str,int]] |None¶ Total number of cells by cell type added to inbound queue.
-
inbound_removed:
Annotated[Mapping[str,int]] |None¶ Total number of cells by cell type processed from inbound queue.
-
inbound_time:
Annotated[Mapping[str,Annotated[timedelta]]] |None¶ Total waiting times in milliseconds of all processed cells by cell type.
-
outbound_queue:
int|None¶ OutboundQueue is the identifier of the outbound circuit queue of this circuit.
-
outbound_added:
Annotated[Mapping[str,int]] |None¶ Total number of cells by cell type added to outbound queue.
-
TYPE:
- class aiostem.event.EventClientsSeen[source]¶
Bases:
EventSimpleStructure for a
CLIENTS_SEENevent.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'CLIENTS_SEEN'¶ Type of event this class is a parser for.
-
TYPE:
- class aiostem.event.EventTbEmpty[source]¶
Bases:
EventSimpleStructure for a
TB_EMPTYevent.Important
These events are only generated if TestingTorNetwork is set.
-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'TB_EMPTY'¶ Type of event this class is a parser for.
-
TYPE:
Misc. events¶
- class aiostem.event.EventConfChanged[source]¶
Bases:
Event,ReplyGetMapStructure for a
CONF_CHANGEDevent.Hint
This class behaves somehow like
ReplyGetConf.-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = 'CONF_CHANGED'¶ Type of event this class is a parser for.
-
TYPE:
Helpers¶
- class aiostem.event.EventUnknown[source]¶
Bases:
EventStructure for an unknown event.
This structure is the default fallback when no event class suits the event type the user subscribed to.
-
TYPE:
ClassVar[EventWordInternal|EventWord|None] = None¶ Type of event this class is a parser for.
-
TYPE:
- aiostem.event.event_from_message(message: Message) Event[source]¶
Parse an event message to the corresponding event structure.
- Parameters:
message (
Message) – An event message to parse.- Raises:
MessageError – When the message is not an event.
- Returns:
Event– A parsed event corresponding to the event in the provided message.
Event enumeration¶
- class aiostem.event.EventWord[source]¶
Bases:
StrEnumAll possible events to subscribe to.
- STREAM = 'STREAM'¶
Stream status changed.
See also
- ORCONN = 'ORCONN'¶
OR Connection status changed.
See also
- BW = 'BW'¶
Bandwidth used in the last second.
See also
- DEBUG = 'DEBUG'¶
Debug log message.
See also
- INFO = 'INFO'¶
Info log message.
See also
- NOTICE = 'NOTICE'¶
Notice log message.
See also
- WARN = 'WARN'¶
Warning log message.
See also
- ERR = 'ERR'¶
Error log message.
See also
- NEWDESC = 'NEWDESC'¶
New descriptors available.
See also
- ADDRMAP = 'ADDRMAP'¶
New Address mapping.
See also
- AUTHDIR_NEWDESCS = 'AUTHDIR_NEWDESCS'¶
Descriptors uploaded to us in our role as authoritative dirserver.
This event has been deprecated since Tor v0.3.3.1.
- DESCCHANGED = 'DESCCHANGED'¶
Our descriptor changed.
See also
- STATUS_GENERAL = 'STATUS_GENERAL'¶
General status event.
See also
- STATUS_CLIENT = 'STATUS_CLIENT'¶
Client status event.
See also
- STATUS_SERVER = 'STATUS_SERVER'¶
Server status event.
See also
- GUARD = 'GUARD'¶
Our set of guard nodes has changed.
See also
- NS = 'NS'¶
Network status has changed.
See also
- STREAM_BW = 'STREAM_BW'¶
Bandwidth used on an application stream.
See also
- CLIENTS_SEEN = 'CLIENTS_SEEN'¶
Per-country client stats.
See also
- NEWCONSENSUS = 'NEWCONSENSUS'¶
New consensus networkstatus has arrived.
See also
- BUILDTIMEOUT_SET = 'BUILDTIMEOUT_SET'¶
New circuit buildtime has been set.
See also
- SIGNAL = 'SIGNAL'¶
Signal received.
See also
- CONF_CHANGED = 'CONF_CHANGED'¶
Configuration changed.
See also
- CIRC_MINOR = 'CIRC_MINOR'¶
Circuit status changed slightly.
See also
- TRANSPORT_LAUNCHED = 'TRANSPORT_LAUNCHED'¶
Pluggable transport launched.
See also
- CONN_BW = 'CONN_BW'¶
Bandwidth used on an OR or DIR or EXIT connection.
- CIRC_BW = 'CIRC_BW'¶
Bandwidth used by all streams attached to a circuit.
See also
- CELL_STATS = 'CELL_STATS'¶
Per-circuit cell stats.
See also
- TB_EMPTY = 'TB_EMPTY'¶
Token buckets refilled.
See also
- HS_DESC = 'HS_DESC'¶
HiddenService descriptors.
See also
- HS_DESC_CONTENT = 'HS_DESC_CONTENT'¶
HiddenService descriptors content.
See also
- NETWORK_LIVENESS = 'NETWORK_LIVENESS'¶
Network liveness has changed.
See also
- PT_LOG = 'PT_LOG'¶
Pluggable Transport Logs.
See also
- PT_STATUS = 'PT_STATUS'¶
Pluggable Transport Status.
See also