Skip to content

Xray : Add new api to get xray state. #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2025

Conversation

codewithtamim
Copy link
Contributor

@codewithtamim codewithtamim commented Jun 6, 2025

So in this pr I have added a new api for getting the core state running or not. I looked into the Instance struct in the Xray-Core core/xray.go file and found there is a running bool which returns if its running or not. So the issue was it was not exporting runnning. So first I did a contribution in main Xray core to add that feature which is now merged #4775 and then I added the same thing here in the client wrapper. and it looks like this

// Get Xray State
func GetXrayState() bool {
	return coreServer.IsRunning()
}

So in this pr I have added a new api for getting the core state running or not. I looked into the `Instance` struct in the `Xray-Core` core/xray.go file and found there is a running bool which returns if its running or not. So the issue was it was not exporting runnning. So first I did a contribution in main Xray core to add that feature which is now merged [#447](XTLS/Xray-core#4775) and then I added the same thing here in the client wrapper. and it looks like this

```go
// Get Xray State
func GetXrayState() bool {
	return coreServer.IsRunning()
}
```
@yiguodev yiguodev merged commit 020b8db into XTLS:main Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants