-
Notifications
You must be signed in to change notification settings - Fork 95
(feat) Enhance device discovery for complex and mesh networks #226
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: master
Are you sure you want to change the base?
Conversation
Further fixes (adding in --broad-search)
…w feature final cleanup of implementation; completing basic documentation of new feature
vishen
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.
Apologies this took so long for me to review. This looks good. I've left a comment about putting the new flag in with the rest of the global flags.
|
Awesome! I also cleaned up the rest of the |
vishen
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.
Apologies for the delay, have been on paternity leave.
This looks good other than a couple of minor comments.
| var app application.App | ||
| var err error | ||
|
|
||
| if broadSearch { |
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.
Is this still needed if castApplication checks this flag as well?
| exit("unable to seek current media: %v", err) | ||
| } | ||
| }, | ||
| Run: func(cmd *cobra.Command, args []string) { |
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.
The formatting on these look off, was this done with gofmt?
Hi @vishen, first off—thank you for creating and maintaining this fantastic tool!
This pull request introduces enhanced discovery mechanisms to make go-chromecast more robust for users with mesh networks, multiple VLANs, or larger device ecosystems. The changes are fully backward-compatible and significantly improve device discovery reliability.
Issue Encountered
After setting up a mesh wifi network, I found that device discovery became unreliable. While the
go-chromecast scan --cidr 192.168.4.0/24command could find some devices, it consistently missed others, including Chromecast groups, even when they were on the same subnet. The tool was also hardcoded to scan192.168.50.0/24by default, which didn't match most home networks.Solution
The default issue may affect a ton of use cases:
To address this, I've expanded on the existing scanning capabilities to provide a more powerful and flexible discovery process:
--broad-searchFlag (Universal across all relevant commands)Added to all device-connecting commands for the simplest and most powerful discovery. This flag automatically combines mDNS with comprehensive port scanning across all detected network interfaces to find devices that standard discovery might miss.
Works with all commands:
Enhanced
scanCommandThe
scancommand now supports flexible subnet targeting:Automatic Network Detection
-iconfiguration in most cases192.168.50.0/24defaultTesting
Test Coverage: Added unit tests for new utility functions (subnet parsing, flag handling) and integration tests using
testscriptto validate CLI behavior. Includes mocks for network-dependent functionality to ensure reliable testing. Tests can be run withgo test ./...or individual components withgo test ./cmd/.Performance Note:
--broad-searchis slower than standard discovery as it performs comprehensive network scanning, but finds devices that mDNS alone might miss.Backward Compatibility
I wanted to make sure any existing workflows will continue to work and leave existing functionality unchanged. This means:
--cidrflag works exactly as beforeI believe these changes make go-chromecast significantly more powerful on modern home networks. Please let me know if you have any questions or need any adjustments to merge this in!