small fixes

This commit is contained in:
Alireza Ahmadi
2025-01-19 01:52:44 +01:00
parent a0dc165995
commit 891a61ac16
5 changed files with 51 additions and 49 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ func (o *Outbound) UnmarshalJSON(data []byte) error {
delete(raw, "tag")
// Remaining fields
o.Options, err = json.Marshal(raw)
o.Options, err = json.MarshalIndent(raw, "", " ")
return err
}
+2 -2
View File
@@ -163,7 +163,7 @@ func (s *ServerService) GenKeypair(keyType string, options string) []string {
case "reality":
return s.generateRealityKeyPair()
case "wireguard":
return generateWireGuardKey(options)
return s.generateWireGuardKey(options)
}
return []string{"Failed to generate keypair"}
@@ -195,7 +195,7 @@ func (s *ServerService) generateRealityKeyPair() []string {
return []string{"PrivateKey: " + base64.RawURLEncoding.EncodeToString(privateKey[:]), "PublicKey: " + base64.RawURLEncoding.EncodeToString(publicKey[:])}
}
func generateWireGuardKey(pk string) []string {
func (s *ServerService) generateWireGuardKey(pk string) []string {
if len(pk) > 0 {
key, _ := wgtypes.ParseKey(pk)
return []string{key.PublicKey().String()}