github.com/xmplusdev/xray-core@v1.8.10/main/commands/all/wg.go (about)

     1  package all
     2  
     3  import (
     4  	"github.com/xmplusdev/xray-core/main/commands/base"
     5  )
     6  
     7  var cmdWG = &base.Command{
     8  	UsageLine: `{{.Exec}} wg [-i "private key (base64.StdEncoding)"]`,
     9  	Short:     `Generate key pair for wireguard key exchange`,
    10  	Long: `
    11  Generate key pair for wireguard key exchange.
    12  
    13  Random: {{.Exec}} wg
    14  
    15  From private key: {{.Exec}} wg -i "private key (base64.StdEncoding)"
    16  `,
    17  }
    18  
    19  func init() {
    20  	cmdWG.Run = executeWG // break init loop
    21  }
    22  
    23  var input_wireguard = cmdWG.Flag.String("i", "", "")
    24  
    25  func executeWG(cmd *base.Command, args []string) {
    26  	Curve25519Genkey(true, *input_wireguard)
    27  }