Skip to content
프로젝트

소개

iOS 플랫폼용 네트워크 진단 SDK입니다. IP 주소와 도메인에 대한 ping, UDP 및 ICMP 프로토콜을 사용하는 traceroute, TCP ping, 포트 스캔, nslookup, LAN 활성 IP 스캔 등을 지원합니다.

시스템 및 인프라

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

iOS network diagnostics sdk

阅读中文文档

Introduction

By ingegrating iOS network diagnostics sdk you can easily do ping/traceroute/mobile public network information/port scanning on IPhone.

Take a screenshot of the network diagnostic app developed with this sdk:

图片说明图片说明 图片说明
图片说明图片说明 图片说明
图片说明图片说明图片说明

Environment

  • iOS >= 9.0
  • Xcode >= 7.0
  • Setting Enable Bitcode to NO

Installation and use

Pod dependency

Add the following dependencies to your project's Podfile:

pod 'PhoneNetSDK'

Quick start

Import the SDK header file to the project:

#import <PhoneNetSDK/PhoneNetSDK.h>

In addition, you need to add -lc++,-ObjC,$(inherited) to the project's Build Setting->other link flags. As shown below:

ping

 [[PhoneNetManager shareInstance] netStartPing:@"www.baidu.com" packetCount:10 pingResultHandler:^(NSString * _Nullable pingres) {
       // your processing logic 
  }];

TCP ping

_tcpPing = [PNTcpPing start:hostDomain port:portNum.integerValue count:3 complete:^(NSMutableString *pingres) {
	// your processing logic
}];

UDP traceroute

The default traceroute command on the command line sends a UDP packet (referred to as udp traceroute):

 _udpTraceroute = [PNUdpTraceroute start:ip complete:^(NSMutableString *res) {
                    // your processinig logic
                }];

ICMP traceroute

In the terminal of mac, enter traceroute -I baidu.com to use the ICMP protocol to do traceroute. This function is provided in sdk:

 [[PhoneNetManager shareInstance] netStartTraceroute:@"www.baidu.com" tracerouteResultHandler:^(NSString * _Nullable tracertRes, NSString * _Nullable destIp) {
     // your processing logic                
  }];

nslookup

[[PhoneNetManager shareInstance] netLookupDomain:@"www.google.com" completeHandler:^(NSMutableArray<DomainLookUpRes *> * _Nullable lookupRes, PNError * _Nullable sdkError) {
	// your processing logic
}];

port scan

[[PhoneNetManager shareInstance] netPortScan:@"www.baidu.com" beginPort:8000 endPort:9000 completeHandler:^(NSString * _Nullable port, BOOL isOpen, PNError * _Nullable sdkError) {
	// your processing logic    
}];

LAN Scanning

If you want to do the LAN active ip scanning function, then you can quickly monitor every active ip with the SDK, and the SDK will return to you the scanning progress.

Specific steps are as follows:

  1. Create an object and set the proxy PNetMLanScannerDelegate
  2. Start the scan and process the active ip through its delegate method
  3. Monitor scan progress (optional)
 PNetMLanScanner *lanScanner = [PNetMLanScanner shareInstance];
 lanScanner.delegate =  self;
 [lanScanner scan];

Ohter functions

  • Setting SDK log level
  • Get device public ip info

NetPinger-Example

Ios platform network diagnostic APP (using the SDK), support ping and domain name ping, traceroute (udp, icmp protocol), support tcp ping, port scan, nslookup and other functions.

Simply go to the directory where the Podfile file is located and install the SDK to run successfully.

macdeiMac:NetPinger ethan$ pod install 
Analyzing dependencies
Downloading dependencies
Installing PhoneNetSDK (1.0.7)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `NetPinger.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

Project origin

In development, you often encounter problems with the interface (DNS resolution error, etc.), so you need to detect whether the mobile terminal to the server's network is not connected, so you need to interrupt ping on the mobile phone, but the free network detection tool on the market. Most have pop-up ads affecting the experience (eg: iNetTools), so it is necessary to develop a web drama detection app.

Implementation

All functions are implemented using the functions provided by the SDK. The pages and icons are mainly imitating the NetWork Utility on the MAC, and hope to provide a valuable reference for your application.

Contact us

  • If you have any questions or need any feature, please submit issue
  • If you want to contribute, please submit pull request
  • Welcome star & fork

관련 프로젝트 살펴보기

불러오는 중…