Move native extension under muxer package

This commit is contained in:
glomatico
2026-07-08 12:32:06 -03:00
parent bad60eeb6a
commit 268a2cf492
6 changed files with 24 additions and 13 deletions
View File
+1 -13
View File
@@ -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(())
}
+9
View File
@@ -0,0 +1,9 @@
mod decrypt;
mod python;
use pyo3::prelude::*;
#[pymodule]
fn _amdecrypt(module: &Bound<'_, PyModule>) -> PyResult<()> {
python::register(module)
}
+13
View File
@@ -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(())
}
+1
View File
@@ -39,6 +39,7 @@ dev = [
]
[tool.maturin]
manifest-path = "gamdl/muxer/Cargo.toml"
module-name = "gamdl._amdecrypt"
python-source = "."
features = ["pyo3/extension-module"]