-
Notifications
You must be signed in to change notification settings - Fork 104
Description
Feature Request: Add RunXrayFromJSON for launching Xray with in-memory config
Currently, the RunXray
function requires a file path to config.json
:
func RunXray(datDir string, configPath string) (err error)
However, for many applications—especially those handling sensitive or dynamic configurations—writing config.json to disk introduces security risks and potential for configuration leakage.
I propose adding a new function with the following signature:
func RunXrayFromJSON(datDir string, configJSON string) (err error)
This function would accept the raw JSON config as a string, allowing applications to launch Xray directly from memory, without needing to write a temporary file. This is particularly useful for applications that receive multiple encrypted configurations from a server, where avoiding disk I/O helps ensure security and flexibility.
Having both options in xray_wrapper:
– RunXray (with configPath)
– RunXrayFromJSON (with configJSON)
would provide a more flexible solution. Offering both will be a great solution that accommodates a wider range of use cases.