github傳送門git
implementation 'fairy.easy:httpmodel:{latest-version}'
複製代碼
HttpModelHelper.getInstance()
.init(getApplicationContext())
.setChina(false)
.setModelLoader(new HttpNormalUrlLoader())
.setFactory()
.addAll()
.build()
.startAsync(httpListener);
複製代碼
域名以及請求時間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"
}
複製代碼
手機網絡信息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":{
"網址":"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":{
"執行結果":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信息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"
}
複製代碼
傳輸單位的計算maven
"MtuScan":{
"執行結果":200,
"傳輸單元":"1492bytes",
"總消耗時間":"4461ms"
}
複製代碼
"MtuScan":{
"status":200,
"mtu":"1492bytes",
"totalTime":"5437ms"
}
複製代碼
端口掃描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":{
"執行結果":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":{
"總消耗時間":"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數據格式,方便查看。