【仙女】Android網絡測試與診斷

HttpInfo

Android網絡診斷工具java

Download
GitHub issues
GitHub forks
GitHub stars
GitHub license
Travis CI


github傳送門git

Table of Contents

依賴

implementation 'fairy.easy:httpmodel:{latest-version}'

複製代碼

調用方式

HttpModelHelper.getInstance()
                .init(getApplicationContext())
                .setChina(false)
                .setModelLoader(new HttpNormalUrlLoader())
                .setFactory()
                .addAll()
                .build()
                .startAsync(httpListener);

複製代碼

網絡信息

Index信息

域名以及請求時間github

中文鍵

    "Index":{
        "測速地址":"http://www.baidu.com",
        "請求時間":"2019-08-13 11:04:26"
    }

複製代碼

英文鍵

    "Index":{
        "address":"http://www.baidu.com",
        "time":"2019-08-13 11:17:46"
    }

複製代碼

Net信息

手機網絡信息apache

中文鍵

    "Net":{
        "網絡狀態":true,
        "網絡類型":"WIFI",
        "網絡制式":"4G_LTE",
        "WIFI狀態":true,
        "WIFI信號強度":-55,
        "WIFI信號等級":4,
        "WIFI信號評定":"信號優",
        "本地IP":"192.168.1.199",
        "出口IP":"219.139.215.219",
        "出口IP歸屬地":"湖北省武漢市電信",
        "本地DNS":"192.168.1.201",
        "出口DNS":"112.90.73.100",
        "出口DNS歸屬地":"廣東省深圳市聯通",
        "漫遊狀態":false,
        "手機信號電平值":75,
        "手機信號強度":-65,
        "手機信號等級":4,
        "手機信號評定":"信號優",
        "總消耗時間":"1119ms"
    }

複製代碼

英文鍵

    "Net":{
        "isNetworkAvailable":true,
        "netWorkType":"WIFI",
        "mobileType":"4G_LTE",
        "isWifiOpen":true,
        "wifiRssi":-56,
        "wifiLevel":3,
        "wifiLevelValue":"信號良",
        "ip":"192.168.1.199",
        "outputIp":"219.139.215.219",
        "outputIpCountry":"湖北省武漢市電信",
        "dns":"192.168.1.201",
        "outputDns":"220.249.245.92",
        "outputDnsCountry":"廣東省深圳市聯通",
        "isRoaming":false,
        "mobAsu":74,
        "mobDbm":-66,
        "mobLevel":4,
        "mobLevelValue":"信號優",
        "totalTime":"1062ms"
    }

複製代碼

Ping信息

相關ping信息服務器

中文鍵

    "Ping":{
        "網址":"http://www.baidu.com",
        "執行結果":200,
        "IP地址":"180.97.33.108",
        "生存時間":55,
        "發送包":10,
        "接收包":10,
        "丟包率":"0.0%",
        "最小RTT":"14.808ms",
        "平均RTT":"19.819ms",
        "最大RTT":"22.741ms",
        "算術平均誤差RTT":"2.683ms",
        "總消耗時間":"13121ms"
    }

複製代碼

英文鍵

    "Ping":{
        "address":"http://www.baidu.com",
        "status":200,
        "ip":"180.97.33.107",
        "ttl":55,
        "transmitted":10,
        "receive":10,
        "lossRate":"0.0%",
        "rttMin":"14.848ms",
        "rttAvg":"17.8ms",
        "rttMax":"23.528ms",
        "rttMDev":"2.421ms",
        "allTime":"9017ms"
    }

複製代碼

Http信息

http請求信息網絡

中文鍵

   "Http":{
        "執行結果":200,
        "網址":"http://www.baidu.com",
        "用時":"667ms",
        "總消耗時間":"1058ms",
        "速度":"112kbps",
        "請求狀態":200,
        "下載大小":"2.9KB",
        "服務器":"apache",
        "校驗服務器":"bfe/1.0.8.18",
        "跳轉":true,
        "返回header":[
            {
                "Server":"apache",
                "Connection":"Keep-Alive",
                "P3p":"CP=" OTI DSP COR IVA OUR IND COM "",
                "X-Android-Received-Millis":"1565665481199",
                "Date":"Tue, 13 Aug 2019 03:04:41 GMT",
                "X-Android-Selected-Protocol":"http/1.1",
                "null":"HTTP/1.1 302 Found",
                "Cache-Control":"no-cache",
                "Tracecode":"02812831040685689354081311, 02812609600843499786081311",
                "X-Android-Response-Source":"NETWORK 302"
            }
        ]
    }

複製代碼

英文鍵

    "Http":{
        "status":200,
        "address":"http://www.baidu.com",
        "time":"586ms",
        "totalTime":"1374ms",
        "speed":"128kbps",
        "responseCode":200,
        "size":"2.9KB",
        "headerServer":"apache",
        "checkHeaderServer":"bfe/1.0.8.18",
        "isJump":true,
        "header":[
            {
                "Server":"apache",
                "Connection":"Keep-Alive",
                "P3p":"CP=" OTI DSP COR IVA OUR IND COM "",
                "X-Android-Received-Millis":"1565666277021",
                "Date":"Tue, 13 Aug 2019 03:17:57 GMT",
                "X-Android-Selected-Protocol":"http/1.1",
                "null":"HTTP/1.1 302 Found",
                "Cache-Control":"no-cache",
                "Tracecode":"10770919360300337674081311, 10770855150396544522081311",
                "X-Android-Response-Source":"NETWORK 302"
            }
        ]
    }

複製代碼

Host信息

本地host信息app

中文鍵

    "Host":{
        "執行結果":200,
        "詳細信息":[
            "127.0.0.1 localhost",
            "::1 ip6-localhost"
        ],
        "總消耗時間":"3ms"
    }

複製代碼

英文鍵

    "Host":{
        "status":200,
        "param":[
            "127.0.0.1 localhost",
            "::1 ip6-localhost"
        ],
        "totalTime":"3ms"
    }

複製代碼

MtuScan信息

傳輸單位的計算maven

中文鍵

    "MtuScan":{
        "執行結果":200,
        "傳輸單元":"1492bytes",
        "總消耗時間":"4461ms"
    }

複製代碼

英文鍵

    "MtuScan":{
        "status":200,
        "mtu":"1492bytes",
        "totalTime":"5437ms"
    }

複製代碼

PortScan信息

端口掃描svg

中文鍵

    "PortScan":{
        "網址":"http://www.baidu.com",
        "執行結果":200,
        "總消耗時間":"30179ms",
        "具體信息":[
            {
                "掃描時間":"19ms",
                "是否開放":true,
                "端口號":80
            },
            {
                "掃描時間":"26ms",
                "是否開放":true,
                "端口號":443
            }
        ]
    }

複製代碼

英文鍵

    "PortScan":{
        "address":"http://www.baidu.com",
        "status":200,
        "totalTime":"30205ms",
        "portNet":[
            {
                "delay":"22ms",
                "isConnected":true,
                "port":80
            },
            {
                "delay":"52ms",
                "isConnected":true,
                "port":443
            }
        ]
    }

複製代碼

TraceRoute信息

服務TraceRoute工具

中文鍵

    "TraceRoute":{
        "執行結果":200,
        "總消耗時間":"66389ms",
        "掃描結果":[
            {
                "生存時間":1,
                "IP地址":"192.168.1.1",
                "掃描時間":"1.22ms",
                "IP歸屬地":"私網地址"
            }
        ]
    }

複製代碼

英文鍵

    "TraceRoute":{
        "status":200,
        "totalTime":"81892ms",
        "traceRoute":[
            {
                "ttl":1,
                "ip":"192.168.1.1",
                "time":"3.17ms",
                "address":"私網地址"
            }
        ]
    }

複製代碼

NsLookup信息

服務NsLookup

中文鍵

    "NsLookup":{
        "總消耗時間":"14024ms",
        "執行結果":200,
        "本地DNS服務器":[
            {
                "具體IP":"192.168.1.201",
                "歸屬地":"私網地址"
            },
            {
                "具體IP":"192.168.1.1",
                "歸屬地":"私網地址"
            }
        ],
        "解析策略":[
            {
                "策略內容":"默認策略",
                "域名":"www.baidu.com",
                "結果":200,
                "用時":"5489ms",
                "IP地址":[
                    {
                        "具體IP":"180.97.33.108",
                        "歸屬地":"中國江蘇省中國電信"
                    },
                    {
                        "具體IP":"180.97.33.107",
                        "歸屬地":"未知"
                    }
                ]
            },
            {
                "策略內容":"指定DNS192.168.1.201",
                "域名":"www.baidu.com",
                "結果":200,
                "用時":"2760ms",
                "IP地址":[
                    {
                        "具體IP":"180.97.33.107",
                        "歸屬地":"中國江蘇省中國電信"
                    },
                    {
                        "具體IP":"180.97.33.108",
                        "歸屬地":"中國江蘇省中國電信"
                    }
                ]
            },
            {
                "策略內容":"指定DNS192.168.1.1",
                "域名":"www.baidu.com",
                "結果":200,
                "用時":"5530ms",
                "IP地址":[
                    {
                        "具體IP":"180.97.33.108",
                        "歸屬地":"中國江蘇省中國電信"
                    },
                    {
                        "具體IP":"180.97.33.107",
                        "歸屬地":"未知"
                    }
                ]
            }
        ]
    }

複製代碼

英文鍵

    "NsLookup":{
        "totalTime":"14007ms",
        "status":200,
        "localDns":[
            {
                "ip":"192.168.1.201",
                "param":"私網地址"
            },
            {
                "ip":"192.168.1.1",
                "param":"私網地址"
            }
        ],
        "strategy":[
            {
                "strategyParam":"默認策略",
                "strategyAddress":"www.baidu.com",
                "strategyStatus":200,
                "strategyTime":"2605ms",
                "strategyIp":[
                    {
                        "ip":"180.97.33.107",
                        "param":"中國江蘇省中國電信"
                    },
                    {
                        "ip":"180.97.33.108",
                        "param":"中國江蘇省中國電信"
                    }
                ]
            },
            {
                "strategyParam":"指定DNS192.168.1.201",
                "strategyAddress":"www.baidu.com",
                "strategyStatus":200,
                "strategyTime":"5171ms",
                "strategyIp":[
                    {
                        "ip":"180.97.33.108",
                        "param":"中國江蘇省中國電信"
                    },
                    {
                        "ip":"180.97.33.107",
                        "param":"未知"
                    }
                ]
            },
            {
                "strategyParam":"指定DNS192.168.1.1",
                "strategyAddress":"www.baidu.com",
                "strategyStatus":200,
                "strategyTime":"6004ms",
                "strategyIp":[
                    {
                        "ip":"180.97.33.107",
                        "param":"中國江蘇省中國電信"
                    },
                    {
                        "ip":"180.97.33.108",
                        "param":"未知"
                    }
                ]
            }
        ]
    }

複製代碼

注意事項

若是要使用第三方網絡庫或本身的封裝庫能夠繼承ModelLoader來實現。demo中已經寫入了OkHttp的庫OkHttpUrlLoader,使用的時候直接setModelLoader(new OkHttpUrlLoader())便可。

下載體驗。src文件下有下載二維碼,app/release下也有app體驗。

src文件下有完整的JSON數據格式,方便查看。

相關文章
相關標籤/搜索