lan_scanner
一個 Dart/Flutter 套件,可透過多線程 ICMP ping 發現本機網路(LAN)中的網路裝置。
- 星標
- 27
- 分支
- 4
- 最近推送(UTC)
- 2023年8月5日
- 專案狀態
- 已封存
原始 README
以下為英文專案原文快照,最新內容請造訪 GitHub。
lan_scanner
Dart / Flutter package that allows discovering network devices in local network (LAN) via multi-threaded ICMP pings.
Note: This library is intended to be used on Class C networks.
Getting Started
Add the package to your pubspec.yaml:
lan_scanner: ^4.0.0
Import the library:
import 'package:lan_scanner/lan_scanner.dart';
Create an instance of the class and call
quickIcmpScanAsync() on it:
final scanner = LanScanner();
final List<Host> hosts = scanner.quickIcmpScanAsync('192.168.0');
There is also stream-based icmpScan() method available, which provides progress callback, but is much slower and resource hungry than other methods.
If you don't know what subnet to provide, you can use network_info_plus to get your local IP and then ipToCSubnet() function, which will conviently strip the last octet of the IP address:
// 192.168.0.1
var wifiIP = await NetworkInfo().getWifiIP()
// 192.168.0
var subnet = ipToCSubnet(wifiIP);
iOS compatibility
Due to the issue with Flutter platform channels (#119207), iOS platform is currently supported only when using the quickIcmpScanSync() method and requires additional steps:
Add dart_ping_ios to your pubspec.yaml:
dart_ping_ios: ^4.0.0
Call register() method before running your app:
void main() {
DartPingIOS.register();
runApp(const App());
}
Configuration
Warning:
In order to use this package, you may need to do additional configuration on some platforms.
Android:
Add the android.permission.INTERNET to your AndroidManifest.xml file:
<uses-permission android:name="android.permission.INTERNET" />
MacOS:
Add following key to DebugProfile.entitlements and Release.entitlements files:
<key>com.apple.security.network.client</key>
<true/>
Features, bugs and contributions
Feel free to contribute to this project.
Please file feature requests and bugs at the issue tracker.
If you fixed a bug or implemented a feature by yourself, feel free to send a pull request.
Sponsoring
I am working on my packages in my free time.
If this package is helping you, please consider buying me a coffee, so I can keep updating and maintaining this package.
分類
使用的依賴
依賴清單 4 項
- dart_ping
^9.0.0 - import_sorter開發依賴
^4.6.0 - test開發依賴
^1.24.5 - very_good_analysis開發依賴
^5.0.0+1
如何選擇適合專案的儲存庫?
先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。
- 透過儲存庫名稱、作者或描述搜尋,再依技術分類縮小範圍。
- 綜合星標、分支與最近推送比較專案;星標反映社群關注,不保證品質。
- 使用前在 GitHub 確認 README、授權條款與 Issues。
來源與維護
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗