mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 01:08:33 +00:00
Command: Add wg
for wireguard key generation (#2794)
* Command: Add `wg` for wireguard key generation * Command: Merge `x25519` and `wg`
This commit is contained in:
parent
2c97beae4e
commit
2da476eef4
4 changed files with 87 additions and 53 deletions
27
main/commands/all/wg.go
Normal file
27
main/commands/all/wg.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
package all
|
||||
|
||||
import (
|
||||
"github.com/xtls/xray-core/main/commands/base"
|
||||
)
|
||||
|
||||
var cmdWG = &base.Command{
|
||||
UsageLine: `{{.Exec}} wg [-i "private key (base64.StdEncoding)"]`,
|
||||
Short: `Generate key pair for wireguard key exchange`,
|
||||
Long: `
|
||||
Generate key pair for wireguard key exchange.
|
||||
|
||||
Random: {{.Exec}} wg
|
||||
|
||||
From private key: {{.Exec}} wg -i "private key (base64.StdEncoding)"
|
||||
`,
|
||||
}
|
||||
|
||||
func init() {
|
||||
cmdWG.Run = executeWG // break init loop
|
||||
}
|
||||
|
||||
var input_wireguard = cmdWG.Flag.String("i", "", "")
|
||||
|
||||
func executeWG(cmd *base.Command, args []string) {
|
||||
Curve25519Genkey(true, *input_wireguard)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue