-
Notifications
You must be signed in to change notification settings - Fork 48
[script] mdns-browser for Thread Border Agents or other services #334
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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.
|
/gemini review |
There was a problem hiding this 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.
|
/gemini review |
There was a problem hiding this 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.
There was a problem hiding this 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.
|
/gemini review |
There was a problem hiding this 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.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…d non-needed socket lib
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>
|
/gemini review |
There was a problem hiding this 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.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this 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.
|
/gemini review |
There was a problem hiding this 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>
wgtdkp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Doug!
| @@ -0,0 +1,148 @@ | |||
| #!/usr/bin/python3 | |||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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