搜索插件、代码仓与 APP 分类

GitHub 代码仓ivirtex/lan_scanner

lan_scanner

一个 Dart/Flutter 包,可通过多线程 ICMP ping 实现本地网络(LAN)中网络设备的发现。

lan_scanner 项目封面
星标
27
复刻
4
最近推送(UTC)
2023年8月5日
项目状态
已归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

lan_scanner

pub.dev badge GitHub build status

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.

pub.dev page | API reference

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.

Hubert Jóźwiak GitHub avatar
GitHub 作者

Hubert Jóźwiak ↗

@intelPoland
语言DartC++CMakeRubySwiftCKotlinObjective-C

分类

使用的依赖

依赖清单 4 项

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗