Xray-core/main/commands/all/x25519.go
チセ 2da476eef4
Command: Add wg for wireguard key generation (#2794)
* Command: Add `wg` for wireguard key generation

* Command: Merge `x25519` and `wg`
2023-12-11 20:52:10 -05:00

29 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)
}