mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 09:58:14 -05:00
fix bug for reality
This commit is contained in:
parent
0a4bb84ccf
commit
2cb2199b83
@ -70,10 +70,10 @@ type VAllssNode struct {
|
||||
}
|
||||
|
||||
type TlsSettings struct {
|
||||
ServerName string `json:"server_name"`
|
||||
ServerPort string `json:"server_port"`
|
||||
ShortIds []string `json:"short_ids"`
|
||||
PrivateKey string `json:"-"`
|
||||
ServerName string `json:"server_name"`
|
||||
ServerPort string `json:"server_port"`
|
||||
ShortId string `json:"short_id"`
|
||||
PrivateKey string `json:"-"`
|
||||
}
|
||||
|
||||
type RealityConfig struct {
|
||||
@ -81,7 +81,7 @@ type RealityConfig struct {
|
||||
Xver uint64 `json:"Xver"`
|
||||
MinClientVer string `json:"MinClientVer"`
|
||||
MaxClientVer string `json:"MaxClientVer"`
|
||||
MaxTimeDiff uint64 `json:"MaxTimeDiff"`
|
||||
MaxTimeDiff string `json:"MaxTimeDiff"`
|
||||
}
|
||||
|
||||
type ShadowsocksNode struct {
|
||||
@ -148,7 +148,7 @@ func (c *Client) GetNodeInfo() (node *NodeInfo, err error) {
|
||||
}
|
||||
}
|
||||
if node.Security == Reality {
|
||||
key := crypt.GenX25519Private([]byte(strconv.Itoa(c.NodeId) + c.NodeType + c.Token))
|
||||
key := crypt.GenX25519Private([]byte("vless" + c.Token))
|
||||
rsp.TlsSettings.PrivateKey = base64.RawURLEncoding.EncodeToString(key)
|
||||
}
|
||||
case "shadowsocks":
|
||||
|
@ -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{
|
||||
|
@ -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
|
||||
}
|
||||
|
5
go.mod
5
go.mod
@ -11,7 +11,6 @@ require (
|
||||
github.com/go-redis/redis/v8 v8.11.5
|
||||
github.com/go-resty/resty/v2 v2.7.0
|
||||
github.com/goccy/go-json v0.10.2
|
||||
github.com/google/uuid v1.3.0
|
||||
github.com/hashicorp/go-multierror v1.1.1
|
||||
github.com/inazumav/sing-box v0.0.0-20230809113805-82b279719f5f
|
||||
github.com/juju/ratelimit v1.0.2
|
||||
@ -22,7 +21,7 @@ require (
|
||||
golang.org/x/crypto v0.12.0
|
||||
golang.org/x/sys v0.11.0
|
||||
google.golang.org/protobuf v1.31.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
||||
)
|
||||
|
||||
require (
|
||||
@ -86,6 +85,7 @@ require (
|
||||
github.com/google/btree v1.1.2 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.7.1 // indirect
|
||||
github.com/gophercloud/gophercloud v1.0.0 // indirect
|
||||
@ -214,6 +214,7 @@ require (
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/ns1/ns1-go.v2 v2.7.6 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
gvisor.dev/gvisor v0.0.0-20220901235040-6ca97ef2ce1c // indirect
|
||||
lukechampine.com/blake3 v1.2.1 // indirect
|
||||
)
|
||||
|
2
go.sum
2
go.sum
@ -1134,6 +1134,8 @@ gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||
gopkg.in/ns1/ns1-go.v2 v2.7.6 h1:mCPl7q0jbIGACXvGBljAuuApmKZo3rRi4tlRIEbMvjA=
|
||||
gopkg.in/ns1/ns1-go.v2 v2.7.6/go.mod h1:GMnKY+ZuoJ+lVLL+78uSTjwTz2jMazq6AfGKQOYhsPk=
|
||||
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
||||
|
Loading…
Reference in New Issue
Block a user