Giter Site home page Giter Site logo

net-diagnosis's Introduction

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.

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    
}];

Ohter functions

  • Setting SDK log level
  • Get device public ip info

Contact us

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

net-diagnosis's People

Contributors

mediaios avatar

Watchers

James Cloos avatar 谭培 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.