fix bug for vless

This commit is contained in:
Yuzuki616
2023-08-23 19:13:36 +08:00
parent 0fce6588da
commit 9b3970348c
2 changed files with 15 additions and 10 deletions

View File

@@ -3,12 +3,13 @@ package panel
import (
"encoding/base64"
"fmt"
"github.com/InazumaV/V2bX/common/crypt"
"log"
"reflect"
"strconv"
"strings"
"time"
"github.com/InazumaV/V2bX/common/crypt"
"github.com/goccy/go-json"
)
@@ -70,7 +71,7 @@ type VAllssNode struct {
}
type TlsSettings struct {
ServerName []string `json:"sever_name"`
ServerName string `json:"server_name"`
ServerPort string `json:"server_port"`
ShortIds []string `json:"short_ids"`
PrivateKey string `json:"-"`
@@ -142,15 +143,15 @@ func (c *Client) GetNodeInfo() (node *NodeInfo, err error) {
node.VAllss = rsp
node.Security = node.VAllss.Tls
if len(rsp.NetworkSettings) > 0 {
/*err = json.Unmarshal(rsp.NetworkSettings, &rsp.RealityConfig)
err = json.Unmarshal(rsp.NetworkSettings, &rsp.RealityConfig)
if err != nil {
return nil, fmt.Errorf("decode reality config error: %s", err)
}*/
if node.Security == Reality {
key := crypt.GenX25519Private([]byte(strconv.Itoa(c.NodeId) + c.NodeType + c.Token))
rsp.TlsSettings.PrivateKey = base64.RawURLEncoding.EncodeToString(key)
}
}
if node.Security == Reality {
key := crypt.GenX25519Private([]byte(strconv.Itoa(c.NodeId) + c.NodeType + c.Token))
rsp.TlsSettings.PrivateKey = base64.RawURLEncoding.EncodeToString(key)
}
case "shadowsocks":
rsp := &ShadowsocksNode{}
err = json.Unmarshal(r.Body(), rsp)
@@ -233,6 +234,7 @@ func (c *Client) GetNodeInfo() (node *NodeInfo, err error) {
cm.BaseConfig = nil
c.nodeEtag = r.Header().Get("ETag")
log.Print(node.VAllss.TlsSettings.ServerName)
return
}