Skip to content

Commit

Permalink
细化面板REALITY配置
Browse files Browse the repository at this point in the history
  • Loading branch information
wyx2685 committed Nov 18, 2023
1 parent 02852ee commit 5998358
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions api/panel/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ type VAllssNode struct {

type TlsSettings struct {
ServerName string `json:"server_name"`
Dest string `json:"dest"`
ServerPort string `json:"server_port"`
ShortId string `json:"short_id"`
PrivateKey string `json:"private_key"`
Expand Down
13 changes: 10 additions & 3 deletions core/sing/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,23 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
tls.Enabled = true
v := info.VAllss
tls.ServerName = v.TlsSettings.ServerName
dest, _ := strconv.Atoi(v.TlsSettings.ServerPort)
port, _ := strconv.Atoi(v.TlsSettings.ServerPort)
var dest string
if v.TlsSettings.Dest != "" {
dest = v.TlsSettings.Dest
} else {
dest = tls.ServerName
}

mtd, _ := time.ParseDuration(v.RealityConfig.MaxTimeDiff)
tls.Reality = &option.InboundRealityOptions{
Enabled: true,
ShortID: []string{v.TlsSettings.ShortId},
PrivateKey: v.TlsSettings.PrivateKey,
Handshake: option.InboundRealityHandshakeOptions{
ServerOptions: option.ServerOptions{
Server: tls.ServerName,
ServerPort: uint16(dest),
Server: dest,
ServerPort: uint16(port),
},
},
MaxTimeDifference: option.Duration(mtd),
Expand Down

0 comments on commit 5998358

Please sign in to comment.