网络相关
cURL
vim curl.format
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_redirect: %{time_redirect}\n
time_pretransfer: %{time_pretransfer}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
执行curl命令
curl -w "@curl.format" -s https://qq.com -I
HTTP/2 302
date: Thu, 06 Aug 2020 13:07:14 GMT
content-type: text/html
server: squid/3.5.24
location: https://www.qq.com?fromdefault
expires: Thu, 06 Aug 2020 13:08:15 GMT
cache-control: max-age=60
vary: Accept-Encoding
x-cache: EXPIRED from shenzhen.qq.com
time_namelookup: 0.005594
time_connect: 0.014348
time_appconnect: 0.053759
time_redirect: 0.000000
time_pretransfer: 0.053873
time_starttransfer: 0.099312
----------
time_total: 0.099468
上面几个参数的解释
- time_namelookup:DNS 域 d名解析的时候,就是把 https://qq.com 转换成 ip 地址的过程
- time_connect:TCP 连接建立的时间,就是三次握手的时间
- time_appconnect:SSL/SSH 等上层协议建立连接的时间,比如 connect/handshake 的时间
- time_redirect:从开始到最后一个请求事务的时 间
- time_pretransfer:从请求开始到响应开始传输的时间
- time_starttransfer:从请求开始到第一个字节将要传输的时间
- time_total:本次请求花费的全部时间
httpstat
httpstat 是Python封装的工具,本质上封装的cURL命令
安装
pip install httpstat
使用
httpstat https://www.taobao.com

iperf3
iperf3 -c 42.193.116.59 -p 5201 -u -b 5M -t 240 -i 5
-p 执行端口号 -u 使用udp -b 指定MiB包 -t 持续时间/s
Socks5代理配置
系统: ubuntu: 22.0.4
apt update
apt install dante-server
systemctl status danted.service
vim /etc/danted.conf
logoutput: /tmp/socks.log
internal: eth0 port = 1082
external: eth0
clientmethod: none
socksmethod: username
user.privileged: root
user.notprivileged: nobody
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: error connect disconnect
}
client block {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect error
}
socks pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
command: bind connect udpassociate
log: error connect disconnect
socksmethod: username
}
socks block {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect error
}
sudo useradd -r -s /bin/false danted
sudo passwd danted
sudo systemctl disable ufw
sudo systemctl restart danted.service
curl -v -x socks5://danted:密码@服务器地址:端口 http://www.xxxx.com/
TCP
选择性重传
快速选择性重传(一般是跟选择性重传一起配合来使用),在wireshark中表示TCP Fast Retransmission
数据包
告诉服务器当前已收到数据包长度的范围,需要告诉服务器需要重传的范围: 34895 599618 +1440之间的数据
左边缘348960 1058-348960 9698右边缘 左边缘348961 1138-348961 4018右边缘