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

Action proposal: Get devices in your network #82

Open
muametgrooby opened this issue Nov 15, 2022 · 2 comments
Open

Action proposal: Get devices in your network #82

muametgrooby opened this issue Nov 15, 2022 · 2 comments
Labels
blocked Blocked by something help wanted Extra attention is needed new action

Comments

@muametgrooby
Copy link

Description

When I am connected to Wi-Fi, I want a list of devices on my network so I can connect to them, I wanted to build a shortcut that would get a list of all devices in my network and control them using SSH commands. This would also be useful when your local ip address changes and for whatever reason you can not assign a static one. There are apps that do this (Fing, iNet) but they do not seem to provide an action for this.

@sindresorhus
Copy link
Owner

I looked into this extensively yesterday. It seems like all the methods to do this are deprecated and the new replacement API does not support this use-case. Scanning the network on iOS would also require special entitlement that Apple has to manually approve. So I'm unfortunately unlikely to do this. But I'll leave it open in case anyone wants to work on this.

@sindresorhus sindresorhus added the help wanted Extra attention is needed label Nov 16, 2022
@sindresorhus
Copy link
Owner

sindresorhus commented Nov 16, 2022

Some technical info. NWBrowser is the modern way to discover devices, but it does not support wildcard searching (you have to specify a type), and it's also not able to resolve the IP address without actually connecting to the devices. This leaves us with NetService, which is deprecated, or the archaic low-level <dns_sd.h> API, which I would not want to touch.

Some more resources:

It's really too bad. It would have been easy to achieve this if NWBrowser supported wildcard type. It could simply have been:

import Network

let browser = NWBrowser(for: .bonjour(type: "_services._dns-sd._udp" , domain: "local."), using: .udp)

browser.browseResultsChangedHandler = { results, changes in
	// …
}

browser.start(queue: DispatchQueue.main)

@sindresorhus sindresorhus added the blocked Blocked by something label Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked by something help wanted Extra attention is needed new action
Projects
None yet
Development

No branches or pull requests

2 participants