用xargs让xray x25519 -i支持Linux管道 以私钥计算公钥
xray支持用x25519 -i带私钥来计算公钥。帮助信息如下: ubuntu@ubuntu22:~$ xray help x25519 usage: xray x25519 [-i "private key (base64.RawURLEncoding)"] Generate key pair for x25519 key exchange. Random: xray x25519 From private key: xray x25519 -i "private key (base64.RawURLEncoding)" 实际使用起来,像是下面这样: ubuntu@ubuntu22:~$ xray x25519 -i X23TSjifyqPQ-BVFdosjJqSz_i4O7pCFomPlkzX7DTM Private key: WG3TSjifyqPQ-BVFdosjJqSz_i4O7pCFomPlkzX7DXM Public key: 1wwKZV_IxO4W4wcGJ9dgzBMMaZ3mNOJZcy_MVVmC-1M 那么结合 上一篇 生成随机私钥的方法,像下面这样: ubuntu@ubuntu22:~$ head -c 32 /dev/random | base64 -w 0 | tr '+/' '-_' | tr -d '=' 90L0JJmD721jKRtVSVOqMQZQ6j8VFO2Hl168XfFzWyY 而当我们想使用Linux的管道来将上面的结合起来时,却遇到报错,像下面这样: ubuntu@ubuntu22:~$ head -c 32 /dev/random | base64 -w 0 | tr '+/' '-_' | tr -d '=' | xray x25519 -i flag needs an argument: -i usage: xray x25519 [-i "private key (base64.RawURLEncoding)"] Run 'xray help x25519' for details. 经过一番学习,感谢 yichya 的解答 ...