mirror of
https://github.com/glomatico/gamdl.git
synced 2026-08-03 13:27:13 +03:00
Move native extension under muxer package
This commit is contained in:
Generated
@@ -11,11 +11,6 @@ const DECRYPT_KIND_OK: u16 = 2;
|
||||
const DECRYPT_KIND_ERROR: u16 = 3;
|
||||
const DECRYPT_KIND_CLOSE: u16 = 9;
|
||||
|
||||
#[pyfunction]
|
||||
fn native_available() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
type BatchItem = (Vec<u8>, Vec<u8>, Vec<u8>, Vec<(usize, usize)>);
|
||||
|
||||
fn value_error(message: impl Into<String>) -> PyErr {
|
||||
@@ -256,7 +251,7 @@ fn write_frame(stream: &mut TcpStream, kind: u16, request_id: u32, payload: &[u8
|
||||
}
|
||||
|
||||
#[pyclass]
|
||||
struct WrapperDecryptSession {
|
||||
pub struct WrapperDecryptSession {
|
||||
stream: Option<TcpStream>,
|
||||
next_request_id: u32,
|
||||
}
|
||||
@@ -350,10 +345,3 @@ impl Drop for WrapperDecryptSession {
|
||||
let _ = self.close();
|
||||
}
|
||||
}
|
||||
|
||||
#[pymodule]
|
||||
fn _amdecrypt(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
||||
m.add_function(wrap_pyfunction!(native_available, m)?)?;
|
||||
m.add_class::<WrapperDecryptSession>()?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
mod decrypt;
|
||||
mod python;
|
||||
|
||||
use pyo3::prelude::*;
|
||||
|
||||
#[pymodule]
|
||||
fn _amdecrypt(module: &Bound<'_, PyModule>) -> PyResult<()> {
|
||||
python::register(module)
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
use crate::decrypt::WrapperDecryptSession;
|
||||
use pyo3::prelude::*;
|
||||
|
||||
#[pyfunction]
|
||||
fn native_available() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
pub fn register(module: &Bound<'_, PyModule>) -> PyResult<()> {
|
||||
module.add_function(wrap_pyfunction!(native_available, module)?)?;
|
||||
module.add_class::<WrapperDecryptSession>()?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -39,6 +39,7 @@ dev = [
|
||||
]
|
||||
|
||||
[tool.maturin]
|
||||
manifest-path = "gamdl/muxer/Cargo.toml"
|
||||
module-name = "gamdl._amdecrypt"
|
||||
python-source = "."
|
||||
features = ["pyo3/extension-module"]
|
||||
|
||||
Reference in New Issue
Block a user