mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-03-04 21:07:30 +00:00
chore: simplify server config and add keygen for sudoku (#2407)
This commit is contained in:
@@ -6,13 +6,14 @@ import (
|
||||
|
||||
"github.com/metacubex/mihomo/component/ech"
|
||||
"github.com/metacubex/mihomo/transport/vless/encryption"
|
||||
"github.com/saba-futai/sudoku/pkg/crypto"
|
||||
|
||||
"github.com/gofrs/uuid/v5"
|
||||
)
|
||||
|
||||
func Main(args []string) {
|
||||
if len(args) < 1 {
|
||||
panic("Using: generate uuid/reality-keypair/wg-keypair/ech-keypair/vless-mlkem768/vless-x25519")
|
||||
panic("Using: generate uuid/reality-keypair/wg-keypair/ech-keypair/vless-mlkem768/vless-x25519/sudoku-keypair")
|
||||
}
|
||||
switch args[0] {
|
||||
case "uuid":
|
||||
@@ -69,5 +70,19 @@ func Main(args []string) {
|
||||
fmt.Println("PrivateKey: " + privateKeyBase64)
|
||||
fmt.Println("Password: " + passwordBase64)
|
||||
fmt.Println("Hash32: " + hash32Base64)
|
||||
case "sudoku-keypair":
|
||||
// Generate Master Key
|
||||
pair, err := crypto.GenerateMasterKey()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// Split the master private key to get Available Private Key
|
||||
availablePrivateKey, err := crypto.SplitPrivateKey(pair.Private)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// Output: Available Private Key for client, Master Public Key for server
|
||||
fmt.Println("PrivateKey: " + availablePrivateKey)
|
||||
fmt.Println("PublicKey: " + crypto.EncodePoint(pair.Public))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user