Skip to content

Conversation

@rochaferraz
Copy link
Contributor

Adds a terminal script that continuously scans and resolves addresses for Thread Border Router's _meshcop._udp.local. (or other services) in the local network

@gemini-code-assist
Copy link

Summary of Changes

Hello @rochaferraz, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request adds a new Python utility script that continuously monitors and displays detailed information about mDNS services on the local network. It is particularly useful for discovering Thread Border Routers but can be configured to scan for any mDNS service, providing real-time updates on their network addresses and associated properties.

Highlights

  • New mDNS Browser Script: Introduces a new Python script, script/mdns-browser.py, designed to continuously scan and resolve mDNS services on the local network.
  • Detailed Service Information: The script provides comprehensive details for discovered services, including all associated IPv4 and IPv6 addresses, port numbers, and parsed TXT records.
  • Dynamic Service Monitoring: It actively monitors for services, clearly indicating newly discovered (✅) and updated (🔄) services with distinct icons in the terminal output.
  • Configurable Service Type: While defaulting to scanning for _meshcop._udp.local. services (relevant for Thread Border Routers), the script allows users to specify other mDNS service types via a command-line argument.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@rochaferraz rochaferraz changed the title [script] mdns-browser for Thread Border Routers or other services [script] mdns-browser for Thread Border Agents or other services Nov 10, 2025
@rochaferraz rochaferraz requested a review from wgtdkp November 10, 2025 19:17
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a helpful Python script, mdns-browser.py, for scanning and displaying mDNS services on a local network. The script is well-documented and functional. My review includes a few suggestions to improve its robustness and maintainability. The most critical feedback is regarding a blocking call within the mDNS listener, which could lead to missed service announcements. I've also suggested refactoring the listener class for better clarity and removing an unused import. Overall, this is a great addition.

@rochaferraz
Copy link
Contributor Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a helpful Python script for scanning mDNS services. The script is well-documented with a comprehensive header comment. My review focuses on improving its robustness, maintainability, and adherence to Python best practices. The most critical issue is a blocking call within an event callback, which could lead to missed service updates. I've also suggested using argparse for more robust command-line handling and improving code quality by using constants and type hints.

@rochaferraz
Copy link
Contributor Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a helpful Python script, mdns-browser.py, for scanning mDNS services. The script is well-structured, leveraging threading and queues for non-blocking service discovery. My review focuses on enhancing the script's robustness and code quality. I've identified a significant race condition in the shutdown logic that could lead to unpredictable behavior, along with some medium-severity suggestions to improve code cleanliness and the consistency of the user-facing output.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new Python script (mdns-browser.py) for continuously scanning and resolving mDNS services on the local network, with a default focus on Thread Border Router's _meshcop._udp.local. service.

Key changes:

  • New terminal-based mDNS browser with real-time service discovery, updates, and removal notifications
  • Multi-threaded architecture using a queue to handle service resolution asynchronously
  • Support for custom service types via command-line arguments

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rochaferraz
Copy link
Contributor Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new mDNS browser script, enhances network diagnostic capabilities, and adds support for RLOC16 addresses. It also includes extensive formatting changes across the codebase and updates build scripts to use newer toolchains like LLVM 19. The functional changes are solid, especially the network diagnostics and RLOC16 support, which are well-tested. My feedback focuses on minor issues in the new script and a couple of corrections in the test suite.

rochaferraz and others added 13 commits November 26, 2025 21:58
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Refactor mdns-browser.py to use a worker thread and a queue for service
resolution, preventing blocking of the main event loop.

- Correctly report host_ttl and other_ttl from ServiceInfo.
- Add robust error handling for all service info fields using getattr.
- Reintroduce proper TXT record parsing for binary data.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@rochaferraz
Copy link
Contributor Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Python script, mdns-browser.py, for scanning and displaying mDNS services on a local network. The script is well-written, using threading and a queue to handle service discovery and resolution asynchronously, which is a good design. The graceful shutdown on Ctrl+C is also implemented correctly. My review includes a couple of suggestions: one to improve the robustness of TXT record parsing by handling potential decoding errors for keys, and another to fix a minor typo in the script's usage examples.

rochaferraz and others added 2 commits November 26, 2025 22:01
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@rochaferraz
Copy link
Contributor Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Python script, mdns-browser.py, designed to scan for and display information about mDNS services on a local network. The script is well-structured, utilizing a separate worker thread for resolving service details to avoid blocking the main mDNS listener, and it includes proper handling for graceful shutdown. My review provides a few suggestions to enhance the script's quality, including correcting a typo in the documentation's usage example, renaming a function parameter to avoid shadowing a Python built-in, and refactoring a piece of duplicated code into a helper function to improve overall maintainability.

@rochaferraz
Copy link
Contributor Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a well-structured and useful Python script for browsing mDNS services. The code is clear, well-documented, and correctly handles asynchronous operations and graceful shutdown. My feedback includes a few suggestions to enhance maintainability and align with common Python practices, such as simplifying the worker thread's logic and improving how command-line arguments are handled.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@rochaferraz rochaferraz requested a review from wgtdkp November 27, 2025 03:21
@rochaferraz
Copy link
Contributor Author

@jwhui

Copy link
Member

@wgtdkp wgtdkp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Doug!

@jwhui jwhui requested a review from Vyrastas December 1, 2025 18:25
@@ -0,0 +1,148 @@
#!/usr/bin/python3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a test for this script?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Introduces IPv6 address support to the fake border agent script and
updates the mDNS browser integration test to verify the discovery of
both IPv4 and IPv6 addresses.

This change
- Adds an  constant to  and includes
  it in the  addresses.
- Modifies  to check for the presence of the IPv6
  address in the mDNS browser output.

Change-Id: Ib9ac247707b5664ef40dbec5fa08614a7bc4ca7c
Change-Id: Iac9cf222f6dae6171d6bbbbfb66b6e4fc4978867
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants