feat: 对接Python,暴露接口
This commit is contained in:
44
python/omnisocket/__init__.py
Normal file
44
python/omnisocket/__init__.py
Normal file
@@ -0,0 +1,44 @@
|
||||
try:
|
||||
from ._omnisocket import (
|
||||
MSG_TYPE_BINARY,
|
||||
MSG_TYPE_ERROR,
|
||||
MSG_TYPE_FILE,
|
||||
MSG_TYPE_REGISTER,
|
||||
MSG_TYPE_TEXT,
|
||||
Session,
|
||||
)
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"omnisocket extension is not built; run `make python-ext` on a Linux host first"
|
||||
) from exc
|
||||
|
||||
CONTROL_DEFAULTS = {
|
||||
"nodelay": 1,
|
||||
"interval_ms": 5,
|
||||
"resend": 2,
|
||||
"nc": 1,
|
||||
"sndwnd": 32,
|
||||
"rcvwnd": 32,
|
||||
"mtu": 1400,
|
||||
}
|
||||
|
||||
VIDEO_DEFAULTS = {
|
||||
"nodelay": 1,
|
||||
"interval_ms": 10,
|
||||
"resend": 2,
|
||||
"nc": 1,
|
||||
"sndwnd": 256,
|
||||
"rcvwnd": 256,
|
||||
"mtu": 1400,
|
||||
}
|
||||
|
||||
__all__ = [
|
||||
"CONTROL_DEFAULTS",
|
||||
"VIDEO_DEFAULTS",
|
||||
"MSG_TYPE_BINARY",
|
||||
"MSG_TYPE_ERROR",
|
||||
"MSG_TYPE_FILE",
|
||||
"MSG_TYPE_REGISTER",
|
||||
"MSG_TYPE_TEXT",
|
||||
"Session",
|
||||
]
|
||||
Reference in New Issue
Block a user