mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-27 15:46:03 +03:00
2da476eef4
* Command: Add `wg` for wireguard key generation * Command: Merge `x25519` and `wg`
30 lines
754 B
Go
30 lines
754 B
Go
package all
|
|
|
|
import (
|
|
"github.com/xtls/xray-core/main/commands/base"
|
|
)
|
|
|
|
var cmdX25519 = &base.Command{
|
|
UsageLine: `{{.Exec}} x25519 [-i "private key (base64.RawURLEncoding)"] [--std-encoding]`,
|
|
Short: `Generate key pair for x25519 key exchange`,
|
|
Long: `
|
|
Generate key pair for x25519 key exchange.
|
|
|
|
Random: {{.Exec}} x25519
|
|
|
|
From private key: {{.Exec}} x25519 -i "private key (base64.RawURLEncoding)"
|
|
For Std Encoding: {{.Exec}} x25519 --std-encoding
|
|
`,
|
|
}
|
|
|
|
func init() {
|
|
cmdX25519.Run = executeX25519 // break init loop
|
|
}
|
|
|
|
var input_stdEncoding = cmdX25519.Flag.Bool("std-encoding", false, "")
|
|
var input_x25519 = cmdX25519.Flag.String("i", "", "")
|
|
|
|
func executeX25519(cmd *base.Command, args []string) {
|
|
Curve25519Genkey(false, *input_x25519)
|
|
}
|