trojanpanel / install-script

Multi-user web administration panel supporting Xray/Trojan-Go/Hysteria/NaiveProxy
https://trojanpanel.github.io
1.82k stars 468 forks source link

which api trojan-panel-core calls i need to recode it #352

Open netsupcloud opened 10 months ago

netsupcloud commented 10 months ago

which api trojan-panel-core calls i need to recode it just give me logic and interfaces that core with call them

i will rewrite it for myself

infact i mean creating child processes with xray how it calls to redis and db to writing quota usage

jonssonyan commented 10 months ago

This is what trojan-panel-core does. Its function is to call the api interface of xray or hysteria, such as querying users, querying quotas, and storing the results in MariaDB and Redis.

netsupcloud commented 10 months ago

This is what trojan-panel-core does. Its function is to call the api interface of xray or hysteria, such as querying users, querying quotas, and storing the results in MariaDB and Redis.

ok i think its easy in container run a script.py that will run single trojan-panel-core and will handle its exit code and will restart it instead restart all of container or xray cores as children. infact xray cores should not be run as children of trojan-panel-core

and another script.py will run xray cores and handle exit code of them and will restart them if was need instead restarting all of container

jonssonyan commented 10 months ago

xray/hysteria/naiveproxy runs in the trojan-panel-core container through coroutines. Restarting the container will restart all programs in the container. And for hysteria/hysteria2, it is authenticated through HTTP authentication. If there is no trojan-panel -core, they will not make sense.

netsupcloud commented 10 months ago

yes it right but its not a good idea when trojan-panel-core can be under pressure when some one will create 200 nodes best schematic: ............................................------------tp-core-runner.py.js.sh.go-------trojan-panel-core ..........................................| tp-core-container--- ..........................................| ............................................------------cores-handler.py.js.sh.go-----------(xray)(xray)(xray)(xray)(xray)(xray)(xray)(hysteria)(trojan-go)

and (trojan-panel-core) must use coroutines for calling to (core-handler.py.js.sh.go) instead directly creating nodes and ### you must use (tp-core-runner.py.js.sh.go) for capturing exit codes of (trojan-panel-core) instead passing them to container.###

netsupcloud commented 10 months ago

and of course you must handle recovery of trojan-panel-core after crash and getting it back to working. you can store last state of (trojan-panel-core) inside (tp-core-runner.py.js.sh.go) if it is necessary and when restart after crash is done at first it must check cores are running and if they was running so avoid to run them again and if they was dead must rerun them.

netsupcloud commented 10 months ago

or if you want avoid using (core-handler.py.js.sh.go) ------------------ you must find a way to run xray cores as non-children of trojan-panel-core and when restart after crash is done at first it must check cores are running and if they was running so avoid to run them again and if they was dead must rerun them.

and anyway you must use (tp-core-runner.py.js.sh.go) for both type of structures to avoid passing exit codes of (trojan-panel-core) to container