# os-aio-pod-channel
[![Build Status](https://www.travis-ci.org/cfhamlet/os-aio-pod-channel.svg?branch=master)](https://www.travis-ci.org/cfhamlet/os-aio-pod-channel)
[![codecov](https://codecov.io/gh/cfhamlet/os-aio-pod-channel/branch/master/graph/badge.svg)](https://codecov.io/gh/cfhamlet/os-aio-pod-channel)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/os-aio-pod-channel.svg)](https://pypi.python.org/pypi/os-aio-pod-channel)
[![PyPI](https://img.shields.io/pypi/v/os-aio-pod-channel.svg)](https://pypi.python.org/pypi/os-aio-pod-channel)
A os-aio-pod component for transporting.
This lib is designed as a component of [os-aio-pod](https://github.com/cfhamlet/os-aio-pod) framework. It is mainly used for transporting data between TCP endpoints. The os-aio-pod built-in TCP server is used as background drive engine. With the middleware/extension mechanism, you can easily build aio programs like Proxy or MITM server.
## Install
```
pip install os-aio-pod-channel
```
## Conception
* **Engine**: Used to adapt with os-aio-pod framework, drive the whole event loop. It is also an access point for the components communicate with each other.
* **Endpoint**: Each incoming or outgoing connection is called endpoint. typically, just engine use it's APIs to read, write data or close connection.
* **Channel**: When incoming and outgoing endpoints all connected, a channel between them established. The engine is in charge of it's inner transporting status.
* **Middleware**: Used to communicate with channel and handle data.
* **Extension**: Used for functional expansion. Can be accessed from engine instance.
## Usage
This lib is used with [os-aio-pod](https://github.com/cfhamlet/os-aio-pod). Typically, you should define a configure file and run with os-aio-pod command line tool.
A minimal configure file (do nothing, just accept TCP connection, read and drop):
```
# config.py
BEANS = [
{
'core' : 'os_aio_pod.contrib.tcp_server.TCPServerAdapter',
'server': 'os_aio_pod_channel.engine.Engine',
'MIDDLEWARES': [],
'EXTENSIONS': [],
}
]
```
```
os-aio-pod run -c config.py --debug
```
### Middleware
When data transporting or channel closed the corresponding method of middlewares will be invoked in specific order. You should inherit from ``os_aio_pod_channel.middleware.Middleware`` and configure class, id and other parameters of each middleware in ``MIDDLEWARES`` list.
### Extension
You shold inherit from ``os_aio_pod_channel.extension.Extension`` and config class, name and other parameters of each extension in ``EXTENSIONS`` list. You can get extension by ``engine.extension_manager.get_extension(extension_name)``
### Unit Tests
```
tox
```
### License
MIT licensed.
Raw data
{
"_id": null,
"home_page": "https://github.com/cfhamlet/os-aio-pod-channel",
"name": "os-aio-pod-channel",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Ozzy",
"author_email": "cfhamlet@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c0/fe/9eedb41fbb22e0bccd8d5291050478393c3ded00f2f98d8e2eb23c44e537/os-aio-pod-channel-0.1.13.tar.gz",
"platform": null,
"description": "# os-aio-pod-channel\n[![Build Status](https://www.travis-ci.org/cfhamlet/os-aio-pod-channel.svg?branch=master)](https://www.travis-ci.org/cfhamlet/os-aio-pod-channel)\n[![codecov](https://codecov.io/gh/cfhamlet/os-aio-pod-channel/branch/master/graph/badge.svg)](https://codecov.io/gh/cfhamlet/os-aio-pod-channel)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/os-aio-pod-channel.svg)](https://pypi.python.org/pypi/os-aio-pod-channel)\n[![PyPI](https://img.shields.io/pypi/v/os-aio-pod-channel.svg)](https://pypi.python.org/pypi/os-aio-pod-channel)\n\nA os-aio-pod component for transporting.\n\nThis lib is designed as a component of [os-aio-pod](https://github.com/cfhamlet/os-aio-pod) framework. It is mainly used for transporting data between TCP endpoints. The os-aio-pod built-in TCP server is used as background drive engine. With the middleware/extension mechanism, you can easily build aio programs like Proxy or MITM server.\n\n## Install\n\n```\npip install os-aio-pod-channel\n```\n\n\n## Conception\n\n* **Engine**: Used to adapt with os-aio-pod framework, drive the whole event loop. It is also an access point for the components communicate with each other.\n* **Endpoint**: Each incoming or outgoing connection is called endpoint. typically, just engine use it's APIs to read, write data or close connection.\n* **Channel**: When incoming and outgoing endpoints all connected, a channel between them established. The engine is in charge of it's inner transporting status. \n* **Middleware**: Used to communicate with channel and handle data.\n* **Extension**: Used for functional expansion. Can be accessed from engine instance. \n\n\n\n## Usage\n\nThis lib is used with [os-aio-pod](https://github.com/cfhamlet/os-aio-pod). Typically, you should define a configure file and run with os-aio-pod command line tool.\n\nA minimal configure file (do nothing, just accept TCP connection, read and drop):\n\n```\n# config.py\nBEANS = [\n {\n 'core' : 'os_aio_pod.contrib.tcp_server.TCPServerAdapter',\n 'server': 'os_aio_pod_channel.engine.Engine',\n 'MIDDLEWARES': [],\n 'EXTENSIONS': [],\n }\n]\n```\n\n```\nos-aio-pod run -c config.py --debug\n```\n\n\n\n### Middleware\n\nWhen data transporting or channel closed the corresponding method of middlewares will be invoked in specific order. You should inherit from ``os_aio_pod_channel.middleware.Middleware`` and configure class, id and other parameters of each middleware in ``MIDDLEWARES`` list.\n\n### Extension\n\nYou shold inherit from ``os_aio_pod_channel.extension.Extension`` and config class, name and other parameters of each extension in ``EXTENSIONS`` list. You can get extension by ``engine.extension_manager.get_extension(extension_name)``\n\n\n### Unit Tests\n\n```\ntox\n```\n\n### License\n\nMIT licensed.\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "A os-aio-pod component for transporting.",
"version": "0.1.13",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "20b724c337b9f6086f71a6e3950f8dd1d3c56cf7cf34712fc603bc009f6b4ed9",
"md5": "57452e08361bf0e6af8a508de7c0b406",
"sha256": "f30b170dbfc1150246d8e0acca689ca90edc24e8a8a6c67d0c655f9e920bda4b"
},
"downloads": -1,
"filename": "os_aio_pod_channel-0.1.13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "57452e08361bf0e6af8a508de7c0b406",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 11669,
"upload_time": "2023-02-11T16:47:01",
"upload_time_iso_8601": "2023-02-11T16:47:01.016497Z",
"url": "https://files.pythonhosted.org/packages/20/b7/24c337b9f6086f71a6e3950f8dd1d3c56cf7cf34712fc603bc009f6b4ed9/os_aio_pod_channel-0.1.13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c0fe9eedb41fbb22e0bccd8d5291050478393c3ded00f2f98d8e2eb23c44e537",
"md5": "0af905ff86a9d7b4f7b55be3b4d6109a",
"sha256": "ab95656757100365953087180bb3a55c8c8f5f446eab37006df08441cdb299bc"
},
"downloads": -1,
"filename": "os-aio-pod-channel-0.1.13.tar.gz",
"has_sig": false,
"md5_digest": "0af905ff86a9d7b4f7b55be3b4d6109a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 11682,
"upload_time": "2023-02-11T16:47:03",
"upload_time_iso_8601": "2023-02-11T16:47:03.228897Z",
"url": "https://files.pythonhosted.org/packages/c0/fe/9eedb41fbb22e0bccd8d5291050478393c3ded00f2f98d8e2eb23c44e537/os-aio-pod-channel-0.1.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-11 16:47:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "cfhamlet",
"github_project": "os-aio-pod-channel",
"travis_ci": true,
"coveralls": true,
"github_actions": false,
"tox": true,
"lcname": "os-aio-pod-channel"
}