fix(server): encode server key in base64 for shadowsocks protocol

This commit is contained in:
Chang lue Tsen 2025-06-01 12:54:48 -04:00
parent 565eb8cbbf
commit 76063bc071

View File

@ -1,6 +1,7 @@
package server
import (
"encoding/base64"
"encoding/json"
"fmt"
@ -61,6 +62,13 @@ func (l *GetServerConfigLogic) GetServerConfig(req *types.GetServerConfigRequest
l.Errorw("[GetServerConfig] json unmarshal error", logger.Field("error", err.Error()))
return nil, err
}
if nodeInfo.Protocol == "shadowsocks" {
if value, ok := cfg["server_key"]; ok && value != "" {
cfg["server_key"] = base64.StdEncoding.EncodeToString([]byte(value.(string)))
}
}
resp = &types.GetServerConfigResponse{
Basic: types.ServerBasic{
PullInterval: l.svcCtx.Config.Node.NodePullInterval,