Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow me to resolve agent conn id #26

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions http_network_relay/network_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,15 @@ async def ws_for_access_clients(self, access_client_connection: WebSocket):
await access_client_connection.close()
return
# check if the client is registered
if not start_message.connection_target in self.registered_agent_connections:
logger.warning("Agent not registered: %s", start_message.connection_target)
agent_connection_id = await self.get_agent_connection_id_for_access_client(
start_message.connection_target
)
if not agent_connection_id in self.registered_agent_connections:
logger.warning(
"Agent not registered: %s (%s)",
agent_connection_id,
start_message.connection_target,
)
# send a message back and kill the connection
await access_client_connection.send_text(
RelayToAccessClientMessage(
Expand All @@ -465,7 +472,7 @@ async def ws_for_access_clients(self, access_client_connection: WebSocket):
return
try:
connection = await self.create_connection_async(
agent_connection_id=start_message.connection_target,
agent_connection_id=agent_connection_id,
target_ip=start_message.target_ip,
target_port=start_message.target_port,
protocol=start_message.protocol,
Expand Down Expand Up @@ -546,3 +553,6 @@ async def get_access_client_permission(
self, start_message: AtRStartMessage, access_client_connection
):
raise NotImplementedError()

async def get_agent_connection_id_for_access_client(self, connection_target: str):
return connection_target
Loading