crossbar.worker.proxy¶
Classes¶
Proxy connection run-time representation. |
|
Controller for proxy workers. Manages: |
|
Proxy route run-time representation. |
|
Internal run-time representation of a native worker (router or |
Module Contents¶
- class ProxyConnection(controller: ProxyController, connection_id: str, config: Dict[str, Any])[source]¶
Bases:
objectProxy connection run-time representation.
- property config: Dict[str, Any][source]¶
The original configuration as supplied to this proxy backend connection.
- Type:
return
- class ProxyController(config=None, reactor=None, personality=None)[source]¶
Bases:
crossbar.worker.transport.TransportControllerController for proxy workers. Manages:
proxy transports, for accepting incoming client connections
proxy connections, for backend router connections
proxy routes, for routes from
(realm_name, role_name)to backend router connections
and
web transport services (from base class TransportController), when running a proxy transport
of type
web.Proxy controllers also inherit more procedures and events from the base classes
- _connections: Dict[str, ProxyConnection][source]¶
- _connections_by_auth: Dict[Tuple[str, str], Set[ProxyConnection]][source]¶
- _routes: Dict[str, Dict[str, ProxyRoute]][source]¶
- _routes_by_connection: Dict[str, Set[ProxyRoute]][source]¶
- can_map_backend(session_id, realm, authid, authrole, authextra)[source]¶
Checks if the proxy can map the incoming frontend session to a backend.
- Returns:
True only-if map_backend() can succeed later for the same args (essentially, if the realm + role exist).
- get_backend_config(realm_name, role_name)[source]¶
Return backend connection information for the given backend realm and role.
- Returns:
a dict containing the connection configuration for the backend identified by the realm_name and role_name
- get_proxy_connection(connection_id, details=None)[source]¶
Get run-time information for a currently running proxy connection.
- Parameters:
connection_id – The run-time ID of the proxy connection to return information for.
details – WAMP call details.
- Returns:
Proxy connection configuration.
- get_proxy_connections(details=None)[source]¶
Get currently running proxy connections.
- Parameters:
details – WAMP call details.
- Returns:
List of run-time IDs of currently running connection.s
- get_proxy_realm_route(realm_name, route_id, details=None)[source]¶
Get a particular realm-route
- Parameters:
details (
autobahn.wamp.types.CallDetails) – Call details.- Returns:
Proxy route object.
- Return type:
- get_proxy_routes(details=None)[source]¶
Get proxy routes currently running in this proxy worker.
- Parameters:
details (
autobahn.wamp.types.CallDetails) – Call details.- Returns:
List of (target) realm names in proxy routes currently running.
- Return type:
- get_proxy_transport(transport_id, details=None)[source]¶
Get transport currently running in this proxy worker.
- Parameters:
details (
autobahn.wamp.types.CallDetails) – Call details.- Returns:
List of transports currently running.
- Return type:
- get_proxy_transports(details=None)[source]¶
Get proxy (listening) transports currently running in this proxy worker.
- Parameters:
details (
autobahn.wamp.types.CallDetails) – Call details.- Returns:
List of transport IDs of transports currently running.
- Return type:
- get_service_session(realm: str, authrole: str) autobahn.twisted.wamp.ApplicationSession[source]¶
Returns a cached service session on the given realm using the given role.
Service sessions are used for:
- access dynamic authenticators (see
:method:`crossbar.router.auth.pending.PendingAuth._init_dynamic_authenticator`)
access the WAMP meta API for the realm
forward to/from WAMP for the HTTP bridge
Service sessions are NOT used to forward WAMP client connections incoming to the proxy worker.
- Parameters:
realm – WAMP realm (the WAMP name, _not_ the run-time object ID).
authrole – WAMP authentication role (the WAMP URI, _not_ the run-time object ID).
- Returns:
The service session for the realm.
- has_realm(realm: str) bool[source]¶
Check if a route to a realm with the given name is currently running.
- Parameters:
realm – Realm name (the WAMP name, _not_ the run-time object ID).
- Returns:
True if a route to the realm (for any role) exists.
- has_role(realm: str, authrole: str) bool[source]¶
Check if a role with the given name is currently running in the given realm.
- Parameters:
realm – WAMP realm (the WAMP name, _not_ the run-time object ID).
authrole – WAMP authentication role (the WAMP URI, _not_ the run-time object ID).
- Returns:
True if a route to the realm for the role exists.
- list_proxy_realm_routes(realm_name, details=None)[source]¶
Get list of all routes enabled for a particular realm
- map_backend(frontend, realm: str, authid: str, authrole: str, authextra: Dict[str, Any] | None)[source]¶
Returns the cached backend forwarding session for the given frontend session. Map the given frontend session to a backend session under the given authentication credentials.
- Parameters:
frontend
realm
authid
authrole
authextra
- Returns:
a protocol instance connected to the backend
- start_proxy_connection(connection_id, config, details=None)[source]¶
Start a new backend connection for the proxy.
- Called from master node orchestration in
:method:`crossbar.master.arealm.arealm.ApplicationRealmMonitor._apply_webcluster_connections`.
- Parameters:
connection_id
config
details
- Returns:
- start_proxy_realm_route(realm_name, config, details=None)[source]¶
Start a new proxy route for the given realm. A proxy route maps authroles on the given realm to proxy backend connection IDs.
Example route configuration:
{ "anonymous": "conn1", "restbridge": "conn1", "user": "conn2" }
In this example, the two specified connections
"conn1"and"conn2"must be running already.- Parameters:
realm_name – The realm this route should apply for.
config – The route configuration.
details – WAMP call details.
- Returns:
Proxy route run-time information.
- start_proxy_transport(transport_id, config, details=None)[source]¶
Start a new proxy front-end listening transport.
- Parameters:
transport_id – The run-time ID to start the transport under.
config – The listening transport configuration.
details – WAMP call details.
- Returns:
Proxy transport run-time metadata.
- stop_proxy_connection(connection_id, details=None)[source]¶
- Parameters:
connection_id
details
- Returns:
- stop_proxy_realm_route(realm_name, route_id, details=None)[source]¶
Stop a currently running proxy route.
- Parameters:
realm_name – The name of the realm to stop the route for.
route_id – Which route to stop
details – WAMP call details.
- Returns:
Run-time information about the stopped route.
- class ProxyRoute(controller: ProxyController, realm_name: str, route_id: str, config: Dict[str, Any])[source]¶
Bases:
objectProxy route run-time representation.
- property config: Dict[str, Any][source]¶
The original configuration as supplied to this proxy route.
- Type:
return
- has_role(role_name) bool[source]¶
Checks if the given role is mapped in this proxy route.
- Parameters:
role_name – Role to lookup.
- Returns:
Trueif the role is configured in this proxy route.
- map_connection_id(role_name) str | None[source]¶
Map the given role to a connection ID according to the configuration of this route.
- Parameters:
role_name – Role to map.
- Returns:
Connection ID configured for the role in this proxy route.