fix bug for reality

This commit is contained in:
Yuzuki616
2023-08-23 22:06:36 +08:00
parent 0a4bb84ccf
commit 2cb2199b83
5 changed files with 22 additions and 24 deletions

View File

@@ -58,22 +58,19 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
tls.Enabled = true
v := info.VAllss
tls.ServerName = v.TlsSettings.ServerName
if len(v.TlsSettings.ShortIds) == 0 {
v.TlsSettings.ShortIds = []string{""}
}
dest, _ := strconv.Atoi(v.TlsSettings.ServerPort)
mtd, _ := strconv.Atoi(strconv.FormatUint(v.RealityConfig.MaxTimeDiff, 10))
mtd, _ := time.ParseDuration(v.RealityConfig.MaxTimeDiff)
tls.Reality = &option.InboundRealityOptions{
Enabled: true,
ShortID: v.TlsSettings.ShortIds,
PrivateKey: v.TlsSettings.PrivateKey,
MaxTimeDifference: option.Duration(time.Duration(mtd) * time.Second),
Enabled: true,
ShortID: []string{v.TlsSettings.ShortId},
PrivateKey: v.TlsSettings.PrivateKey,
Handshake: option.InboundRealityHandshakeOptions{
ServerOptions: option.ServerOptions{
Server: tls.ServerName,
ServerPort: uint16(dest),
},
},
MaxTimeDifference: option.Duration(mtd),
}
}
in := option.Inbound{
@@ -118,7 +115,6 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
return option.Inbound{}, fmt.Errorf("decode NetworkSettings error: %s", err)
}
}
tls.ServerName = n.ServerName
if info.Type == "vless" {
in.Type = "vless"
in.VLESSOptions = option.VLESSInboundOptions{

View File

@@ -6,6 +6,8 @@ import (
"encoding/hex"
"errors"
"fmt"
"time"
"github.com/InazumaV/V2bX/api/panel"
"github.com/InazumaV/V2bX/conf"
"github.com/goccy/go-json"
@@ -107,19 +109,16 @@ func buildInbound(option *conf.Options, nodeInfo *panel.NodeInfo, tag string) (*
if err != nil {
return nil, fmt.Errorf("marshal reality dest error: %s", err)
}
short := nodeInfo.VAllss.TlsSettings.ShortIds
if len(short) == 0 {
short = []string{""}
}
mtd, _ := time.ParseDuration(v.RealityConfig.MaxTimeDiff)
in.StreamSetting.REALITYSettings = &coreConf.REALITYConfig{
Dest: d,
Xver: v.RealityConfig.Xver,
ServerNames: v.TlsSettings.ServerName,
ServerNames: []string{v.TlsSettings.ServerName},
PrivateKey: v.TlsSettings.PrivateKey,
MinClientVer: v.RealityConfig.MinClientVer,
MaxClientVer: v.RealityConfig.MaxClientVer,
MaxTimeDiff: v.RealityConfig.MaxTimeDiff,
ShortIds: short,
MaxTimeDiff: uint64(mtd.Microseconds()),
ShortIds: []string{v.TlsSettings.ShortId},
}
break
}