libf 2 jaren geleden
bovenliggende
commit
a1ef4cca88
7 gewijzigde bestanden met toevoegingen van 833 en 19 verwijderingen
  1. 399 1
      ping/hosts.last.txt
  2. 399 1
      ping/hosts.txt
  3. 12 3
      ping/ping.go
  4. 9 0
      ping/probing/icmp/packetconn.go
  5. 10 7
      ping/probing/icmp/utils.go
  6. 2 2
      ping/probing/mpconn.go
  7. 2 5
      ping/probing/ping.go

+ 399 - 1
ping/hosts.last.txt

@@ -137,4 +137,402 @@ weiyun.com,weibo.com,189.cn,jianguoyun.com
 51.79.40.168
 175.214.166.176
 145.14.116.56
-115.139.137.217
+115.139.137.217
+189.153.21.195
+65.9.61.144
+73.44.12.10
+83.86.116.214
+136.175.41.33
+104.97.6.140
+184.25.153.153
+94.3.151.221
+115.5.115.167
+121.17.214.75
+67.238.144.46
+111.28.224.1,91.239.98.21
+62.23.210.102
+170.79.181.245
+116.236.213.37
+67.240.168.116
+116.55.110.73
+80.147.110.192,82.61.219.231
+114.228.142.53
+211.184.177.112
+178.69.116.242
+73.151.165.196
+73.40.151.190
+122.189.216.18
+90.211.183.123
+188.42.69.253
+149.56.142.35
+221.164.191.171
+174.107.231.181
+77.179.157.223
+118.208.101.201
+154.204.141.245,24.99.252.150
+156.234.205.193
+103.155.88.61
+108.7.184.233
+64.227.1.5
+107.148.78.10
+187.154.231.189
+72.133.57.192
+24.234.244.61
+110.47.174.163
+34.70.94.39
+124.61.73.48
+102.223.58.15
+110.11.232.43
+78.37.166.16,99.225.30.20
+71.197.16.240
+85.126.85.101,39.121.161.39,78.105.8.62,18.193.254.47
+37.150.214.12
+218.147.74.193
+73.6.194.164
+191.29.165.252
+18.154.197.188
+188.102.211.87
+209.40.216.39
+178.195.58.88
+113.201.167.150,168.235.80.113
+95.112.141.238,172.100.15.6
+173.172.185.170
+185.144.62.56
+190.165.116.164
+90.211.216.139
+66.232.222.28
+76.138.103.44
+72.129.129.241
+47.153.178.143
+74.47.102.82
+177.50.207.222
+185.47.248.163
+154.124.167.222
+50.214.187.230,118.39.177.235
+101.31.225.247
+103.24.193.223,68.43.160.63
+151.226.39.240
+2.18.233.217
+121.81.219.224,79.215.117.99
+106.242.75.9,113.8.226.157
+201.226.225.200,50.231.10.89
+70.168.13.46,80.31.13.155
+107.159.18.193
+206.43.67.219,98.23.239.145
+120.1.154.47
+107.149.148.47
+201.235.52.86
+23.49.181.87
+74.133.56.27
+106.75.156.69,104.109.67.23
+96.231.214.174
+184.65.185.147
+71.77.165.45
+81.178.156.108
+201.252.78.98
+136.116.5.140
+183.237.11.101,118.131.246.89
+195.253.8.168,176.149.10.141
+86.93.113.122,124.93.195.81
+47.183.237.29
+98.216.52.225
+37.21.166.160
+98.103.125.129
+109.122.244.192
+23.81.37.202
+24.20.133.116,153.148.77.15
+68.204.202.214
+174.52.254.156
+202.136.145.120
+156.238.153.136
+14.66.22.219
+216.119.121.124
+121.135.15.16
+82.48.112.131
+97.77.233.97,98.4.64.217,76.86.165.74,42.176.248.4
+47.156.180.23
+191.221.43.188
+181.215.214.217
+195.76.51.113
+47.6.122.139
+73.153.123.205
+216.238.152.195
+89.58.25.75
+186.52.176.138
+172.252.246.221
+64.125.184.23
+84.59.238.139
+220.245.250.66
+103.66.124.143
+201.157.40.65
+77.69.213.178
+187.173.234.251
+82.52.60.74
+82.28.60.147,113.205.101.222
+99.238.199.15,207.153.15.117
+85.214.67.20
+184.191.118.157,14.18.124.125,45.227.32.175
+125.119.219.92
+68.42.132.68,31.17.173.55
+27.217.100.244
+23.34.38.10
+24.231.216.17
+92.18.107.108
+107.162.174.29
+107.10.161.32
+84.216.103.251
+187.155.7.96
+174.48.70.232
+151.228.81.98,119.222.24.161
+52.165.148.254
+219.57.163.68
+91.246.115.88,94.244.66.174
+191.217.105.200
+94.5.126.21
+156.231.65.82
+134.34.111.92
+113.70.69.127
+44.214.91.18
+1.22.222.38
+121.101.68.62,60.11.254.129
+76.133.244.107
+217.71.50.124
+87.13.174.231
+141.164.148.75,180.231.37.63
+213.157.184.151
+45.93.138.65
+121.132.36.71
+97.116.117.130
+110.251.56.81,42.226.207.3
+112.5.5.48,39.117.87.209
+104.100.13.103
+86.8.178.106
+45.47.37.89,49.7.244.149,71.223.6.82
+101.91.203.167
+47.160.202.25
+72.76.223.36
+95.73.202.111
+122.9.66.123
+187.232.12.206
+187.220.183.128
+217.226.168.56,31.164.149.185
+146.168.44.21
+128.107.219.129
+47.205.218.63,112.237.79.99
+73.128.56.182
+172.74.18.54,72.238.108.136
+49.89.161.194
+47.177.129.125
+95.78.198.5
+82.65.250.101
+2.220.155.182
+93.126.1.112
+114.202.73.92
+92.91.110.59
+69.145.194.15
+201.152.19.80
+182.170.148.97
+171.247.172.43,125.31.41.169,96.246.210.40
+77.73.21.96
+68.42.8.79
+112.75.133.147
+189.159.126.27
+35.193.197.84,188.60.105.218,121.180.252.63
+36.92.22.17,88.198.200.16
+14.170.58.163
+118.178.15.107
+67.40.214.191,71.232.132.199,94.192.222.34
+23.4.88.121
+39.136.189.12
+203.137.63.130
+116.75.114.157
+98.211.202.39
+177.146.53.61
+18.161.157.251
+189.16.10.161
+125.123.254.104,42.117.4.227
+94.74.126.108
+67.227.82.229
+42.87.163.90
+88.150.86.34,1.81.188.162
+191.53.16.117
+181.50.136.100
+73.141.141.17
+175.206.215.173
+23.212.110.211,113.242.93.213
+123.11.121.182
+142.111.34.38
+221.141.109.199
+67.168.17.154
+27.196.215.27,23.193.27.174
+87.158.15.74
+59.23.218.244
+200.193.106.22,47.100.90.198
+177.7.230.145
+24.181.168.167
+119.86.254.200
+110.226.38.92
+67.184.38.190,121.128.230.100,61.175.112.190
+112.231.154.29
+183.89.57.94,47.92.67.86
+73.157.89.196
+108.41.199.78,74.128.176.51
+117.11.70.201,174.51.19.38
+175.162.109.80
+121.66.31.188
+58.239.85.129
+92.26.227.156
+202.61.228.214
+218.208.185.205,60.12.247.44
+2.63.55.124
+58.59.249.102
+24.115.135.70
+185.108.141.158
+110.230.197.18
+79.193.74.75
+23.205.32.251
+113.176.118.156
+191.15.162.36
+83.71.88.145
+23.236.178.172
+34.111.16.148
+72.204.159.249,107.146.72.62
+1.221.202.241
+58.143.97.1
+70.64.100.32
+77.201.75.116
+124.51.181.242
+74.131.56.210
+182.109.208.100
+104.171.30.167
+74.64.17.115,35.195.109.222,196.217.178.9
+84.222.2.106
+211.207.183.77
+58.87.140.229
+179.24.15.159
+23.61.129.67,47.28.65.86
+218.214.103.168
+187.79.168.15
+124.91.22.92
+200.44.228.83
+24.224.122.244
+194.65.172.19
+76.136.233.93
+173.71.218.128
+71.213.132.141,83.1.216.194
+95.176.211.162
+79.219.215.81
+139.208.211.206
+97.116.176.202
+93.177.168.163
+77.118.106.219
+125.128.196.34
+98.36.182.131
+87.65.162.246,185.196.189.168
+112.239.20.206
+98.18.153.223
+124.52.23.228
+177.1.242.60
+84.122.18.98
+119.191.119.31
+12.150.75.161,189.136.215.240
+124.56.202.180,183.111.186.213
+60.27.209.172,111.224.37.90
+60.119.174.47
+74.141.208.175
+79.35.217.118
+89.35.86.228
+173.177.222.203,103.170.155.78
+196.16.231.178,88.109.180.195
+208.51.143.162
+201.14.242.59
+104.225.179.113
+114.159.107.91
+180.241.98.147
+71.11.160.89
+2.21.224.53
+180.102.155.227
+71.215.81.219
+190.1.193.166,206.124.220.46
+119.210.77.113
+72.220.196.174
+124.169.143.59,76.118.158.3
+14.89.56.51
+159.28.183.176,217.7.210.249
+175.140.79.70
+183.136.121.199
+217.10.98.254
+39.83.224.85
+183.103.167.113
+160.173.24.193,68.15.13.157
+211.233.94.209
+14.215.236.141
+193.182.98.57
+38.238.225.137
+78.202.10.108
+78.202.174.77
+76.82.114.37
+191.222.196.242
+151.14.92.122
+94.200.181.17
+125.146.146.170
+71.200.195.100
+211.248.158.107,91.224.108.66
+154.220.23.94,62.7.105.3
+92.72.14.28,185.52.54.181
+84.253.29.42
+1.98.167.132
+182.117.2.123
+1.238.223.103
+144.123.37.1
+121.146.27.64,2.16.106.63
+38.74.1.145
+120.226.32.201
+70.19.77.195,124.116.192.141
+61.42.170.3
+68.149.161.138
+47.28.66.18
+147.253.62.65
+125.37.43.89
+174.172.166.120
+79.144.249.127
+178.248.145.214,187.134.180.144,222.121.99.194,58.141.195.202,121.157.77.194
+78.36.221.199
+71.11.240.204,194.230.112.172
+90.198.116.104
+189.127.164.40
+78.66.188.170
+115.136.222.107
+109.120.247.45
+213.76.80.129
+77.28.180.71,104.98.65.63
+195.47.41.73,120.6.137.11,112.236.77.218
+179.252.191.240,102.219.15.218
+73.175.180.210
+179.213.34.195
+112.180.27.251
+190.68.201.55
+180.102.106.117
+75.183.9.4
+125.29.19.162
+83.58.25.42,154.31.250.168
+72.12.110.134
+172.114.68.63,51.190.23.221
+67.61.84.193
+179.201.163.164
+123.181.118.251
+218.189.104.225
+125.46.161.15
+27.210.40.160
+193.176.187.14
+128.116.88.114
+75.75.33.115
+124.94.39.25
+111.231.126.232
+23.209.26.152
+217.82.29.110
+101.235.180.77
+223.239.35.47,52.203.146.60,144.48.222.108
+24.119.185.21
+98.49.232.177
+15.188.60.176

+ 399 - 1
ping/hosts.txt

@@ -138,4 +138,402 @@ weiyun.com,weibo.com,189.cn,jianguoyun.com
 175.214.166.176
 145.14.116.56
 115.139.137.217
-189.153.21.195
+189.153.21.195
+65.9.61.144
+73.44.12.10
+83.86.116.214
+136.175.41.33
+104.97.6.140
+184.25.153.153
+94.3.151.221
+115.5.115.167
+121.17.214.75
+67.238.144.46
+111.28.224.1,91.239.98.21
+62.23.210.102
+170.79.181.245
+116.236.213.37
+67.240.168.116
+116.55.110.73
+80.147.110.192,82.61.219.231
+114.228.142.53
+211.184.177.112
+178.69.116.242
+73.151.165.196
+73.40.151.190
+122.189.216.18
+90.211.183.123
+188.42.69.253
+149.56.142.35
+221.164.191.171
+174.107.231.181
+77.179.157.223
+118.208.101.201
+154.204.141.245,24.99.252.150
+156.234.205.193
+103.155.88.61
+108.7.184.233
+64.227.1.5
+107.148.78.10
+187.154.231.189
+72.133.57.192
+24.234.244.61
+110.47.174.163
+34.70.94.39
+124.61.73.48
+102.223.58.15
+110.11.232.43
+78.37.166.16,99.225.30.20
+71.197.16.240
+85.126.85.101,39.121.161.39,78.105.8.62,18.193.254.47
+37.150.214.12
+218.147.74.193
+73.6.194.164
+191.29.165.252
+18.154.197.188
+188.102.211.87
+209.40.216.39
+178.195.58.88
+113.201.167.150,168.235.80.113
+95.112.141.238,172.100.15.6
+173.172.185.170
+185.144.62.56
+190.165.116.164
+90.211.216.139
+66.232.222.28
+76.138.103.44
+72.129.129.241
+47.153.178.143
+74.47.102.82
+177.50.207.222
+185.47.248.163
+154.124.167.222
+50.214.187.230,118.39.177.235
+101.31.225.247
+103.24.193.223,68.43.160.63
+151.226.39.240
+2.18.233.217
+121.81.219.224,79.215.117.99
+106.242.75.9,113.8.226.157
+201.226.225.200,50.231.10.89
+70.168.13.46,80.31.13.155
+107.159.18.193
+206.43.67.219,98.23.239.145
+120.1.154.47
+107.149.148.47
+201.235.52.86
+23.49.181.87
+74.133.56.27
+106.75.156.69,104.109.67.23
+96.231.214.174
+184.65.185.147
+71.77.165.45
+81.178.156.108
+201.252.78.98
+136.116.5.140
+183.237.11.101,118.131.246.89
+195.253.8.168,176.149.10.141
+86.93.113.122,124.93.195.81
+47.183.237.29
+98.216.52.225
+37.21.166.160
+98.103.125.129
+109.122.244.192
+23.81.37.202
+24.20.133.116,153.148.77.15
+68.204.202.214
+174.52.254.156
+202.136.145.120
+156.238.153.136
+14.66.22.219
+216.119.121.124
+121.135.15.16
+82.48.112.131
+97.77.233.97,98.4.64.217,76.86.165.74,42.176.248.4
+47.156.180.23
+191.221.43.188
+181.215.214.217
+195.76.51.113
+47.6.122.139
+73.153.123.205
+216.238.152.195
+89.58.25.75
+186.52.176.138
+172.252.246.221
+64.125.184.23
+84.59.238.139
+220.245.250.66
+103.66.124.143
+201.157.40.65
+77.69.213.178
+187.173.234.251
+82.52.60.74
+82.28.60.147,113.205.101.222
+99.238.199.15,207.153.15.117
+85.214.67.20
+184.191.118.157,14.18.124.125,45.227.32.175
+125.119.219.92
+68.42.132.68,31.17.173.55
+27.217.100.244
+23.34.38.10
+24.231.216.17
+92.18.107.108
+107.162.174.29
+107.10.161.32
+84.216.103.251
+187.155.7.96
+174.48.70.232
+151.228.81.98,119.222.24.161
+52.165.148.254
+219.57.163.68
+91.246.115.88,94.244.66.174
+191.217.105.200
+94.5.126.21
+156.231.65.82
+134.34.111.92
+113.70.69.127
+44.214.91.18
+1.22.222.38
+121.101.68.62,60.11.254.129
+76.133.244.107
+217.71.50.124
+87.13.174.231
+141.164.148.75,180.231.37.63
+213.157.184.151
+45.93.138.65
+121.132.36.71
+97.116.117.130
+110.251.56.81,42.226.207.3
+112.5.5.48,39.117.87.209
+104.100.13.103
+86.8.178.106
+45.47.37.89,49.7.244.149,71.223.6.82
+101.91.203.167
+47.160.202.25
+72.76.223.36
+95.73.202.111
+122.9.66.123
+187.232.12.206
+187.220.183.128
+217.226.168.56,31.164.149.185
+146.168.44.21
+128.107.219.129
+47.205.218.63,112.237.79.99
+73.128.56.182
+172.74.18.54,72.238.108.136
+49.89.161.194
+47.177.129.125
+95.78.198.5
+82.65.250.101
+2.220.155.182
+93.126.1.112
+114.202.73.92
+92.91.110.59
+69.145.194.15
+201.152.19.80
+182.170.148.97
+171.247.172.43,125.31.41.169,96.246.210.40
+77.73.21.96
+68.42.8.79
+112.75.133.147
+189.159.126.27
+35.193.197.84,188.60.105.218,121.180.252.63
+36.92.22.17,88.198.200.16
+14.170.58.163
+118.178.15.107
+67.40.214.191,71.232.132.199,94.192.222.34
+23.4.88.121
+39.136.189.12
+203.137.63.130
+116.75.114.157
+98.211.202.39
+177.146.53.61
+18.161.157.251
+189.16.10.161
+125.123.254.104,42.117.4.227
+94.74.126.108
+67.227.82.229
+42.87.163.90
+88.150.86.34,1.81.188.162
+191.53.16.117
+181.50.136.100
+73.141.141.17
+175.206.215.173
+23.212.110.211,113.242.93.213
+123.11.121.182
+142.111.34.38
+221.141.109.199
+67.168.17.154
+27.196.215.27,23.193.27.174
+87.158.15.74
+59.23.218.244
+200.193.106.22,47.100.90.198
+177.7.230.145
+24.181.168.167
+119.86.254.200
+110.226.38.92
+67.184.38.190,121.128.230.100,61.175.112.190
+112.231.154.29
+183.89.57.94,47.92.67.86
+73.157.89.196
+108.41.199.78,74.128.176.51
+117.11.70.201,174.51.19.38
+175.162.109.80
+121.66.31.188
+58.239.85.129
+92.26.227.156
+202.61.228.214
+218.208.185.205,60.12.247.44
+2.63.55.124
+58.59.249.102
+24.115.135.70
+185.108.141.158
+110.230.197.18
+79.193.74.75
+23.205.32.251
+113.176.118.156
+191.15.162.36
+83.71.88.145
+23.236.178.172
+34.111.16.148
+72.204.159.249,107.146.72.62
+1.221.202.241
+58.143.97.1
+70.64.100.32
+77.201.75.116
+124.51.181.242
+74.131.56.210
+182.109.208.100
+104.171.30.167
+74.64.17.115,35.195.109.222,196.217.178.9
+84.222.2.106
+211.207.183.77
+58.87.140.229
+179.24.15.159
+23.61.129.67,47.28.65.86
+218.214.103.168
+187.79.168.15
+124.91.22.92
+200.44.228.83
+24.224.122.244
+194.65.172.19
+76.136.233.93
+173.71.218.128
+71.213.132.141,83.1.216.194
+95.176.211.162
+79.219.215.81
+139.208.211.206
+97.116.176.202
+93.177.168.163
+77.118.106.219
+125.128.196.34
+98.36.182.131
+87.65.162.246,185.196.189.168
+112.239.20.206
+98.18.153.223
+124.52.23.228
+177.1.242.60
+84.122.18.98
+119.191.119.31
+12.150.75.161,189.136.215.240
+124.56.202.180,183.111.186.213
+60.27.209.172,111.224.37.90
+60.119.174.47
+74.141.208.175
+79.35.217.118
+89.35.86.228
+173.177.222.203,103.170.155.78
+196.16.231.178,88.109.180.195
+208.51.143.162
+201.14.242.59
+104.225.179.113
+114.159.107.91
+180.241.98.147
+71.11.160.89
+2.21.224.53
+180.102.155.227
+71.215.81.219
+190.1.193.166,206.124.220.46
+119.210.77.113
+72.220.196.174
+124.169.143.59,76.118.158.3
+14.89.56.51
+159.28.183.176,217.7.210.249
+175.140.79.70
+183.136.121.199
+217.10.98.254
+39.83.224.85
+183.103.167.113
+160.173.24.193,68.15.13.157
+211.233.94.209
+14.215.236.141
+193.182.98.57
+38.238.225.137
+78.202.10.108
+78.202.174.77
+76.82.114.37
+191.222.196.242
+151.14.92.122
+94.200.181.17
+125.146.146.170
+71.200.195.100
+211.248.158.107,91.224.108.66
+154.220.23.94,62.7.105.3
+92.72.14.28,185.52.54.181
+84.253.29.42
+1.98.167.132
+182.117.2.123
+1.238.223.103
+144.123.37.1
+121.146.27.64,2.16.106.63
+38.74.1.145
+120.226.32.201
+70.19.77.195,124.116.192.141
+61.42.170.3
+68.149.161.138
+47.28.66.18
+147.253.62.65
+125.37.43.89
+174.172.166.120
+79.144.249.127
+178.248.145.214,187.134.180.144,222.121.99.194,58.141.195.202,121.157.77.194
+78.36.221.199
+71.11.240.204,194.230.112.172
+90.198.116.104
+189.127.164.40
+78.66.188.170
+115.136.222.107
+109.120.247.45
+213.76.80.129
+77.28.180.71,104.98.65.63
+195.47.41.73,120.6.137.11,112.236.77.218
+179.252.191.240,102.219.15.218
+73.175.180.210
+179.213.34.195
+112.180.27.251
+190.68.201.55
+180.102.106.117
+75.183.9.4
+125.29.19.162
+83.58.25.42,154.31.250.168
+72.12.110.134
+172.114.68.63,51.190.23.221
+67.61.84.193
+179.201.163.164
+123.181.118.251
+218.189.104.225
+125.46.161.15
+27.210.40.160
+193.176.187.14
+128.116.88.114
+75.75.33.115
+124.94.39.25
+111.231.126.232
+23.209.26.152
+217.82.29.110
+101.235.180.77
+223.239.35.47,52.203.146.60,144.48.222.108
+24.119.185.21
+98.49.232.177
+15.188.60.176
+67.168.52.89

+ 12 - 3
ping/ping.go

@@ -13,6 +13,7 @@ import (
 	"time"
 
 	"trial/ping/probing"
+	"trial/ping/probing/icmp"
 	"trial/ping/utils"
 
 	"git.wecise.com/wecise/common/logger"
@@ -71,6 +72,15 @@ var mcfg = cfg.MConfig()
 var allipsmutex sync.Mutex
 var allips = strset.New()
 
+/*
+  poolsize=1000  同时ping的不同目标地址个数
+  count=5        每轮ping的次数,每轮次产生一次统计结果,并切换目标地址
+  interval=1000  两次ping之间的间隔,单位毫秒
+  size=64        每次ping发送字节数,48~8192
+  timeout=2      ping超时,单位秒
+  detect=1ms     自动发现可ping通地址,并追加到 hosts.txt 文件,设置发现间隔时间需指定单位,如 ms,毫秒,us,微妙等,默认 0,不进行发现处理
+*/
+
 func main() {
 	input := &Input{}
 	input.statinfo = map[string]*StatInfo{}
@@ -140,6 +150,7 @@ func main() {
 				logger.Info(util.FormatDuration(time.Since(starttime)), "已经完成", pingcount, "次Ping操作,",
 					"平均每秒", (int64(pingcount+1) * int64(time.Second) / int64(time.Since(starttime))), "次",
 					"最近一秒", (pingcount - int32(last_count)), "次",
+					"最大缓冲", icmp.MaxReceiveBufferUsed(),
 				)
 				last_count = int(pingcount)
 			}
@@ -161,7 +172,7 @@ func main() {
 				Timeout:        mcfg.GetInt("timeout", 2),
 				NumberOfPings:  mcfg.GetInt("count", 5), // 至少为2,小于2会导致不能正常结束
 				PacketInterval: mcfg.GetInt("interval", 1000),
-				PacketSize:     mcfg.GetInt("size", 32),
+				PacketSize:     mcfg.GetInt("size", 64),
 			}
 		}
 		// time.Sleep(1 * time.Millisecond)
@@ -259,7 +270,6 @@ func (input *Input) send(t *task, workerNum int) error {
 			getcap /bin/goping-binary to validate
 		*/
 		pinger.SetPrivileged(false)
-		pinger.TTL = 64
 		if t.NumberOfPings > 0 {
 			pinger.Count = t.NumberOfPings
 		} else {
@@ -441,7 +451,6 @@ func detectip(addr string) (ok bool) {
 		return false
 	}
 	pinger.SetPrivileged(false)
-	pinger.TTL = 64
 	pinger.Count = 1
 	pinger.Interval = 200 * time.Millisecond
 	pinger.Size = 32

+ 9 - 0
ping/probing/icmp/packetconn.go

@@ -207,8 +207,17 @@ func (mp *MPacketConn) SendPacket(pkt *Packet) error {
 	}
 }
 
+var max_receive_buffer_used = 0
+
+func MaxReceiveBufferUsed() int {
+	return max_receive_buffer_used
+}
+
 func (mp *MPacketConn) processRecvPacket() {
 	for pkt := range mp.recvbuf {
+		if len(mp.recvbuf) > max_receive_buffer_used {
+			max_receive_buffer_used = len(mp.recvbuf)
+		}
 		err := mp.processPacket(pkt)
 		if err != nil {
 			if mp.OnRecvError != nil {

+ 10 - 7
ping/probing/icmp/utils.go

@@ -20,10 +20,13 @@ func netAddrToIPAddr(a net.Addr) *net.IPAddr {
 }
 
 func (pkt *Packet) BuildEchoRequestMessage(icmptype Type) ([]byte, error) {
-	if pkt.Nbytes < 40 {
-		pkt.Nbytes = 40
+	if pkt.Nbytes < 48 {
+		pkt.Nbytes = 48
 	}
-	bs := bytes.Repeat([]byte{1}, pkt.Nbytes)
+	if pkt.Nbytes > 8192 {
+		pkt.Nbytes = 8192
+	}
+	bs := bytes.Repeat([]byte{1}, pkt.Nbytes-8)
 	pkt.SendTime = time.Now()
 	binary.BigEndian.PutUint64(bs, uint64(pkt.SendTime.UnixNano()))
 	binary.BigEndian.PutUint64(bs[8:], uint64(pkt.Seq))
@@ -31,14 +34,14 @@ func (pkt *Packet) BuildEchoRequestMessage(icmptype Type) ([]byte, error) {
 	copy(bs[24:], pkt.UUID[:])
 
 	body := &icmp.Echo{
-		ID:   pkt.ID % 65535,
-		Seq:  pkt.Seq % 65536,
+		ID:   pkt.ID % 65536,  // 2 bytes
+		Seq:  pkt.Seq % 65536, // 2 bytes
 		Data: bs,
 	}
 
 	msg := &icmp.Message{
-		Type: icmptype,
-		Code: 0,
+		Type: icmptype, // 1 byte
+		Code: 0,        // 1 byte, Checksum 2 bytes
 		Body: body,
 	}
 

+ 2 - 2
ping/probing/mpconn.go

@@ -78,8 +78,8 @@ func newMPConn(ipv4 bool, protocol string) *mpingconn {
 			IPV4:     ipv4,
 			Protocol: protocol,
 			Source:   "",
-			Backlog:  10,
-			TTL:      64,
+			Backlog:  receive_buffer_count,
+			TTL:      ping_ttl,
 		},
 		uuid:       uuid.Must(uuid.NewUUID()),
 		pingidinfo: make(map[int]*mpinfo),

+ 2 - 5
ping/probing/ping.go

@@ -69,8 +69,8 @@ import (
 )
 
 var mcfg = cfg.MConfig()
-var receive_buffer_count = mcfg.GetInt("ping.recv.buf.count", 100)
-var ttl = mcfg.GetInt("ping.ttl", 64)
+var receive_buffer_count = mcfg.GetInt("ping.recv.buf.count", 10)
+var ping_ttl = mcfg.GetInt("ping.ttl", 64)
 var ping_interval = mcfg.GetDuration("ping.interval", 1000*time.Millisecond)
 var concurlimit_ping = mcfg.GetInt("concurlimit.ping", 100)
 var concurchan_ping = make(chan struct{}, concurlimit_ping)
@@ -106,7 +106,6 @@ func New(addr string) *Pinger {
 		network:           "ip",
 		protocol:          "udp",
 		awaitingSequences: firstSequence,
-		TTL:               64,
 	}
 }
 
@@ -204,8 +203,6 @@ type Pinger struct {
 	network string
 	// protocol is "icmp" or "udp".
 	protocol string
-
-	TTL int
 }
 
 // Packet represents a received and processed ICMP echo packet.