Skip to content
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

feat: httpadmin protocol for external control #175

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vforvideo
Copy link

idea

clash-core has external control that support restful api for external control. That makes it easy for third part GUI to manipulate it. So I think it's a good idea for python proxy.

This pr is draft for this idea. I'd like to hear your suggestions about it. :)

usage

Add a new protocol called httpadmin, which handle http request. So user can add admin port:

% pproxy -l http://localhost:8080 -l httpadmin://localhost:8081

At beginning stage, two api entries are added.

Show server status

% curl 'localhost:8081/status'

Show server configs (list argv)

% curl 'localhost:8081/configs'

Modify server configs (use new argv)

% curl 'localhost:8081/configs' -X POST -d '-l http://localhost:8082 -l httpadmin://localhost:8081'

known issues (todo)

  • it's dangerous to expose admin port, auth is necessary
  • hot reload uses raise KeyInterrupt, maybe there's more elegant way

@vforvideo vforvideo marked this pull request as draft January 21, 2024 09:24
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.

None yet

1 participant