Python bindings for hysteria, a feature-packed proxy & relay tool.
Project description
hysteria-python
Python bindings for hysteria, a feature-packed proxy & relay tool. This package provides a bridge to start hysteria client directly from Python on any platform.
Looking for Xray-core bindings? Check Xray-core-python.
See the real-world production GUI client that takes advantage of the Python binding: Furious.
Start
To use this binding, please first make sure that:
- You are a Python developer, or your application is associated with this package.
- You are building a client application. There is no point to use binding on the server side.
- You want to provide additional abstraction for your client. The core(i.e. hysteria) will be shipped with your application as dynamic link library, not an executable.
- This bridge provides functionality to start hysteria directly from Python string(see the API below). What that means is that the client config stays in memory all the time, and cannot(or very hard to) be inspected. So you can, for example, get a configuration template from a remote server and edit it for a group of specific client and start the service.
Install
Core Building Tools
You have to install the following tools to be able to install this package successfully.
-
go in your PATH. go 1.20.0 and above is recommended. To check go is ready, type
go version
. Also, if google service is blocked in your region(such as Mainland China), you have to configure your GOPROXY to be able to pull go packages. For Chinese users, refer to goproxy.cn for more information. -
cmake in your PATH. To check cmake is ready, type
cmake --version
. -
A working GNU C++ compiler(i.e. GNU C++ toolchains). To check GNU C++ compiler is ready, type
g++ --version
. These tools should have been installed in Linux or macOS by default. If you don't have GNU C++ toolchains(especially for Windows users) anyway:
Install Package
pip install hysteria
API
>>> import hysteria
>>> help(hysteria)
Help on package hysteria:
NAME
hysteria
PACKAGE CONTENTS
hysteria
FUNCTIONS
startFromJSON(...) method of builtins.PyCapsule instance
startFromJSON(json: str, rule: str = '', mmdb: str = '') -> None
Start Hysteria client with JSON, ACL rule and MMDB
VERSION
1.3.5
Source Code Modification
This repository, including the package that distributes to pypi, contains hysteria source code that's been modified to build the binding and specific API. If without explicitly remark, the version of this package corresponds to the version of the origin source code tag, so the binding will have full features as the original go distribution will have. And due to its backward compatibility, there's no plan to generate bindings for older release of hysteria.
To make installation of this package easier, I didn't add the original hysteria source code as a submodule. To track what modifications have been made to the source code, you can compare it with the same version under Python binding and corresponding go repository.
Tested Platform
hysteria-python works on all major platform with all Python version(Python 3).
Below are tested build in github actions.
Platform | Python 3.7-Python 3.11 |
---|---|
ubuntu 20.04 | :heavy_check_mark: |
ubuntu 22.04 | :heavy_check_mark: |
windows-2019 | :heavy_check_mark: |
windows-2022 | :heavy_check_mark: |
macos-11 | :heavy_check_mark: |
macos-12 | :heavy_check_mark: |
macos-13 | :heavy_check_mark: |
License
The license for this project follows its original go repository hysteria and is under MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file hysteria-1.3.5.1.tar.gz
.
File metadata
- Download URL: hysteria-1.3.5.1.tar.gz
- Upload date:
- Size: 740.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5206d9457f0994716d17b66e9c304e9042bda70b36351daa7d74f441fe78235 |
|
MD5 | 5aebc7d7c7a3d77ebdb15812aa0f3cd2 |
|
BLAKE2b-256 | 82d670e1e2a56e7af24d1d6f0eaa4ff48db8aa94382a5eb5a08225e8704ace57 |