fix(proxy): simplify password generation logic in GenerateShadowsocks2022Password
This commit is contained in:
parent
0fb0aac2fa
commit
b4a9bb23e9
@ -1,18 +1,15 @@
|
|||||||
package proxy
|
package proxy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/perfect-panel/server/pkg/tool"
|
|
||||||
"github.com/perfect-panel/server/pkg/uuidx"
|
"github.com/perfect-panel/server/pkg/uuidx"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GenerateShadowsocks2022Password(ss Shadowsocks, password string) (string, string) {
|
func GenerateShadowsocks2022Password(ss Shadowsocks, password string) (string, string) {
|
||||||
// server key
|
// server key
|
||||||
var serverKey string
|
serverKey := ss.ServerKey
|
||||||
if ss.Method == "2022-blake3-aes-128-gcm" {
|
if ss.Method == "2022-blake3-aes-128-gcm" {
|
||||||
serverKey = tool.GenerateCipher(ss.ServerKey, 16)
|
|
||||||
password = uuidx.UUIDToBase64(password, 16)
|
password = uuidx.UUIDToBase64(password, 16)
|
||||||
} else {
|
} else {
|
||||||
serverKey = tool.GenerateCipher(ss.ServerKey, 32)
|
|
||||||
password = uuidx.UUIDToBase64(password, 32)
|
password = uuidx.UUIDToBase64(password, 32)
|
||||||
}
|
}
|
||||||
return serverKey, password
|
return serverKey, password
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user