X Tutup
Skip to content

feat: httpadmin protocol for external control#175

Merged
qwj merged 1 commit intoqwj:masterfrom
vforvideo:admin
Nov 16, 2024
Merged

feat: httpadmin protocol for external control#175
qwj merged 1 commit intoqwj:masterfrom
vforvideo:admin

Conversation

@vforvideo
Copy link
Contributor

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
@qwj qwj marked this pull request as ready for review November 16, 2024 11:46
@qwj qwj merged commit f512359 into qwj:master Nov 16, 2024
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

X Tutup