mirror of
https://github.com/XrayR-project/XrayR.git
synced 2025-09-10 10:31:53 +00:00
V2RaySocks supports Reality (remote config) (#521)
This commit is contained in:
@@ -18,3 +18,14 @@ type NodeOnline struct {
|
|||||||
UID int `json:"uid"`
|
UID int `json:"uid"`
|
||||||
IP string `json:"ip"`
|
IP string `json:"ip"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type REALITYConfig struct {
|
||||||
|
Dest string `json:"dest,omitempty"`
|
||||||
|
ProxyProtocolVer uint64 `json:"proxy_protocol_ver,omitempty"`
|
||||||
|
ServerNames []string `json:"server_names,omitempty"`
|
||||||
|
PrivateKey string `json:"private_key,omitempty"`
|
||||||
|
MinClientVer string `json:"min_client_ver,omitempty"`
|
||||||
|
MaxClientVer string `json:"max_client_ver,omitempty"`
|
||||||
|
MaxTimeDiff uint64 `json:"max_time_diff,omitempty"`
|
||||||
|
ShortIds []string `json:"short_ids,omitempty"`
|
||||||
|
}
|
@@ -425,6 +425,8 @@ func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*
|
|||||||
var path, host, serviceName string
|
var path, host, serviceName string
|
||||||
var header json.RawMessage
|
var header json.RawMessage
|
||||||
var enableTLS bool
|
var enableTLS bool
|
||||||
|
var enableVless bool
|
||||||
|
var enableReality bool
|
||||||
var alterID uint16 = 0
|
var alterID uint16 = 0
|
||||||
|
|
||||||
tmpInboundInfo := nodeInfoResponse.Get("inbounds").MustArray()
|
tmpInboundInfo := nodeInfoResponse.Get("inbounds").MustArray()
|
||||||
@@ -452,10 +454,24 @@ func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if inboundInfo.Get("streamSettings").Get("security").MustString() == "tls" {
|
|
||||||
enableTLS = true
|
enableTLS = inboundInfo.Get("streamSettings").Get("security").MustString() == "tls"
|
||||||
} else {
|
enableVless = inboundInfo.Get("streamSettings").Get("security").MustString() == "reality"
|
||||||
enableTLS = false
|
enableReality = enableVless
|
||||||
|
|
||||||
|
realityConfig := new(api.REALITYConfig)
|
||||||
|
if enableVless {
|
||||||
|
// parse reality config
|
||||||
|
realityConfig = &api.REALITYConfig{
|
||||||
|
Dest: inboundInfo.Get("streamSettings").Get("realitySettings").Get("dest").MustString(),
|
||||||
|
ProxyProtocolVer: inboundInfo.Get("streamSettings").Get("realitySettings").Get("xver").MustUint64(),
|
||||||
|
ServerNames: inboundInfo.Get("streamSettings").Get("realitySettings").Get("serverNames").MustStringArray(),
|
||||||
|
PrivateKey: inboundInfo.Get("streamSettings").Get("realitySettings").Get("privateKey").MustString(),
|
||||||
|
MinClientVer: inboundInfo.Get("streamSettings").Get("realitySettings").Get("minClientVer").MustString(),
|
||||||
|
MaxClientVer: inboundInfo.Get("streamSettings").Get("realitySettings").Get("maxClientVer").MustString(),
|
||||||
|
MaxTimeDiff: inboundInfo.Get("streamSettings").Get("realitySettings").Get("maxTimeDiff").MustUint64(),
|
||||||
|
ShortIds: inboundInfo.Get("streamSettings").Get("realitySettings").Get("shortIds").MustStringArray(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create GeneralNodeInfo
|
// Create GeneralNodeInfo
|
||||||
@@ -469,10 +485,12 @@ func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*
|
|||||||
EnableTLS: enableTLS,
|
EnableTLS: enableTLS,
|
||||||
Path: path,
|
Path: path,
|
||||||
Host: host,
|
Host: host,
|
||||||
EnableVless: c.EnableVless,
|
EnableVless: enableVless,
|
||||||
VlessFlow: c.VlessFlow,
|
VlessFlow: c.VlessFlow,
|
||||||
ServiceName: serviceName,
|
ServiceName: serviceName,
|
||||||
Header: header,
|
Header: header,
|
||||||
|
EnableREALITY: enableReality,
|
||||||
|
REALITYConfig: realityConfig,
|
||||||
}
|
}
|
||||||
return nodeInfo, nil
|
return nodeInfo, nil
|
||||||
}
|
}
|
Reference in New Issue
Block a user