自动使用 IP4P 动态域名 SSH
`~/.ssh/ip4p.sh` :
```
#!/usr/bin/env bash
host=$1
raw=$(dig +short -t aaaa $host)
port=$((0x$(echo ${raw} | awk -F: ‘{ print $3 }’)))
ipab=$((0x$(echo ${raw} | awk -F: ‘{ print $4 }’)))
ipcd=$((0x$(echo ${raw} | awk -F: ‘{ print $5 }’)))
ipa=$((${ipab} >> 8))
ipb=$((${ipab} & 0xff))
ipc=$((${ipcd} >> 8))
ipd=$((${ipcd} & 0xff))
exec nc ${ipa}.${ipb}.${ipc}.${ipd} ${port}
```
`~/.ssh/config` :
</s><i> </i>Host ip4p HostName ip4p.com User root Port 2222 IdentityFile ~/.ssh/id_rsa ProxyCommand /bin/bash ~/.ssh/ip4p.sh %h<i> </i><e>
参考: NATMap SSH 客户端访问 (https://github.com/heiher/natmap/wiki/ssh#ssh%E5%AE%A2%E6%88%B7%E7%AB%AF%E8%AE%BF%E9%97%AE)
❗ IP4P
来自 NATMap, 将 IPv4 地址和端口同时编码在 DNS AAAA 记录中
❗ 相关内容
IP4P 请求自动重定向, 使用固定的 URL 访问 STUN 打洞的内网服务(以 Surge 模块为例) (https://t.me/zhetengsha/1198)
使用 Lucky 进行 STUN 内网穿透时, 配置自定义脚本实现自动更新 IP4P 动态域名 (https://t.me/zhetengsha/1184)
☁ Cloudflare Workers 配合 Lucky 实现动态公网节点订阅 (https://t.me/zhetengsha/1139)
Lucky 文档: STUN 内网穿透 (https://lucky666.cn/docs/modules/stun)
🔗 Sub-Store 域名解析新增 IP4P, 支持禁用缓存 (https://t.me/zhetengsha/1180)