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

     1  package all
     2  
     3  import (
     4  	"github.com/xmplusdev/xray-core/main/commands/base"
     5  )
     6  
     7  var cmdX25519 = &base.Command{
     8  	UsageLine: `{{.Exec}} x25519 [-i "private key (base64.RawURLEncoding)"] [--std-encoding]`,
     9  	Short:     `Generate key pair for x25519 key exchange`,
    10  	Long: `
    11  Generate key pair for x25519 key exchange.
    12  
    13  Random: {{.Exec}} x25519
    14  
    15  From private key: {{.Exec}} x25519 -i "private key (base64.RawURLEncoding)"
    16  For Std Encoding: {{.Exec}} x25519 --std-encoding
    17  `,
    18  }
    19  
    20  func init() {
    21  	cmdX25519.Run = executeX25519 // break init loop
    22  }
    23  
    24  var input_stdEncoding = cmdX25519.Flag.Bool("std-encoding", false, "")
    25  var input_x25519 = cmdX25519.Flag.String("i", "", "")
    26  
    27  func executeX25519(cmd *base.Command, args []string) {
    28  	Curve25519Genkey(false, *input_x25519)
    29  }