mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 09:58:14 -05:00
fix bug for vless
This commit is contained in:
parent
0fce6588da
commit
9b3970348c
@ -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
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
||||
case panel.Reality:
|
||||
tls.Enabled = true
|
||||
v := info.VAllss
|
||||
tls.ServerName = v.TlsSettings.ServerName[0]
|
||||
tls.ServerName = v.TlsSettings.ServerName
|
||||
if len(v.TlsSettings.ShortIds) == 0 {
|
||||
v.TlsSettings.ShortIds = []string{""}
|
||||
}
|
||||
@ -70,7 +70,7 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
||||
MaxTimeDifference: option.Duration(time.Duration(mtd) * time.Second),
|
||||
Handshake: option.InboundRealityHandshakeOptions{
|
||||
ServerOptions: option.ServerOptions{
|
||||
Server: v.TlsSettings.ServerName[0],
|
||||
Server: tls.ServerName,
|
||||
ServerPort: uint16(dest),
|
||||
},
|
||||
},
|
||||
@ -207,11 +207,14 @@ func (b *Box) AddNode(tag string, info *panel.NodeInfo, config *conf.Options) er
|
||||
c,
|
||||
nil,
|
||||
)
|
||||
b.inbounds[tag] = in
|
||||
if err != nil {
|
||||
return fmt.Errorf("init inbound error: %s", err)
|
||||
}
|
||||
err = in.Start()
|
||||
if err != nil {
|
||||
return fmt.Errorf("start inbound error: %s", err)
|
||||
}
|
||||
b.inbounds[tag] = in
|
||||
err = b.router.AddInbound(in)
|
||||
if err != nil {
|
||||
return fmt.Errorf("add inbound error: %s", err)
|
||||
|
Loading…
Reference in New Issue
Block a user