py-mihomo-trojan-interface
Generate a mihomo YAML config from a trojan:// share URL, relaunch with
administrator privileges through py-admin-launch, and start mihomo with the
generated config.
Install
python -m pip install -e .
Usage
Prefer passing the Trojan URL through stdin, an environment variable, or a file so the full URL does not stay in shell history.
printf '%s' 'trojan://<secret>@<host>:<port>?type=tcp&sni=<sni>#<name>' | \
mihomo-trojan \
--mihomo /path/to/mihomo \
--country-mmdb /path/to/Country.mmdb \
--trojan-url-stdin
PowerShell example:
$env:MIHOMO_TROJAN_URL = 'trojan://<secret>@<host>:<port>?type=tcp&sni=<sni>#<name>'
mihomo-trojan `
--mihomo C:\path\to\mihomo.exe `
--country-mmdb C:\path\to\Country.mmdb `
--trojan-url-env MIHOMO_TROJAN_URL
You can also pass the URL directly when needed:
mihomo-trojan \
--mihomo /path/to/mihomo \
--country-mmdb /path/to/Country.mmdb \
--trojan-url 'trojan://<secret>@<host>:<port>?type=tcp&sni=<sni>#<name>'
The launcher passes the mihomo data directory with -d and the generated YAML
with -f. If --data-dir is not provided and the mmdb file is named
Country.mmdb, the file's parent directory is used as the mihomo data
directory.
On Linux and macOS, the launcher automatically marks the mihomo binary as
executable before starting it, equivalent to running chmod +x on the path
provided with --mihomo.
Useful options:
mihomo-trojan --help
mihomo-trojan --dry-run --log debug --mihomo /path/to/mihomo --country-mmdb /path/to/Country.mmdb --trojan-url-env MIHOMO_TROJAN_URL
Metadata
Release files for py-mihomo-trojan-interface 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_mihomo_trojan_interface-0.1.8.tar.gz | 12.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_mihomo_trojan_interface-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.8 kB
Release files / py_mihomo_trojan_interface-0.1.8.tar.gz
| Download URL | py_mihomo_trojan_interface-0.1.8.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d081a9c3ec002bf5f30f36f6390a83e5c2ac3ed47625a202f16e8c3ff0b2b61
|
|
BLAKE2b-256 checksum How to use checksums |
0020071a8cb9fcc5b5517831c3bba8ae73800b0187439caff905ba752889e0df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.11.15 Windows/10
|
Release files / py_mihomo_trojan_interface-0.1.8-py3-none-any.whl
| Download URL | py_mihomo_trojan_interface-0.1.8-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92041bdc8f3d524da4350a33e481af047fafba3a26b97614f98ecf68ea67722a
|
|
BLAKE2b-256 checksum How to use checksums |
4db8b23e028f963e82bbfbe81ebdf16f2a60dae6522e032fa7823caac7d164af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.11.15 Windows/10
|