This is a Python project designed for RoboCup's 2D soccer simulation. The project creates a proxy for the soccer monitor, enabling it to send and receive data from UDP, RabbitMQ, and WebSocket. The proxy can be controlled using FastAPI.
flowchart LR
subgraph Manager
ProxyManager
Proxy1
Proxy2
Proxy3
ProxyN
end
subgraph IController
AddProxy
RemoveProxy
GetProxies
RestartProxy
end
IController -.-> FastAPI & RabbitMQ & gRpc
ProxyManager --> Proxy1 & Proxy2 & Proxy3 & ProxyN
AddProxy & RemoveProxy & GetProxies & RestartProxy --> ProxyManager
flowchart LR
subgraph Manager
Initializer
Proxy1
Proxy2
Proxy3
ProxyN
end
Database & JSONFile & PythonFile --> Initializer --> Proxy1 & Proxy2 & Proxy3 & ProxyN
To install the required packages, use pipenv
:
pipenv install
To run the project, execute the following command:
python monitor_proxy.py
The project is Dockerized. To build and run the Docker container, use the following commands:
docker build . -t proxy
docker run -it --network host proxy
The project uses a data.json
file located at the root of the project to initialize the proxies.
{
"type": "UDP",
"host": "localhost",
"port": 6000
}
{
"type": "RMQ",
"queue": "test3"
}
{
"type": "UDP",
"host": "localhost",
"port": 6900
}
{
"type": "RMQ",
"queue": "test3"
}
{
"type": "DELAYED",
"delay": 50
}
{
"type": "SIMPLE"
}
Below is an example of the data.json
file encompassing various configurations:
{
"proxies": [
{
"input": {
"type": "UDP",
"host": "localhost",
"port": 6000
},
"output": [
{
"type": "UDP",
"host": "localhost",
"port": 6900
}
],
"queue": {
"type": "DELAYED",
"delay": 50
}
},
{
"input": {
"type": "RMQ",
"queue": "test3"
},
"output": [
{
"type": "UDP",
"host": "localhost",
"port": 6700
}
],
"queue": {
"type": "SIMPLE"
}
},
{
"input": {
"type": "UDP",
"host": "localhost",
"port": 6000
},
"output": [
{
"type": "RMQ",
"queue": "test3"
}
],
"queue": {
"type": "DELAYED",
"delay": 50
}
},
{
"input": {
"type": "RMQ",
"queue": "test3"
},
"output": [
{
"type": "UDP",
"host": "localhost",
"port": 6800
}
],
"queue": {
"type": "SIMPLE"
}
},
{
"input": {
"type": "UDP",
"host": "localhost",
"port": 6000
},
"output": [
{
"type": "RMQ",
"queue": "test3"
}
],
"queue": {
"type": "DELAYED",
"delay": 50
}
},
{
"input": {
"type": "RMQ",
"queue": "test3"
},
"output": [
{
"type": "UDP",
"host": "localhost",
"port": 6700
}
],
"queue": {
"type": "SIMPLE"
}
},
{
"input": {
"type": "UDP",
"host": "localhost",
"port": 6000
},
"output": [
{
"type": "RMQ",
"queue": "test3"
}
],
"queue": {
"type": "DELAYED",
"delay": 50
}
},
{
"input": {
"type": "RMQ",
"queue": "test3"
},
"output": [
{
"type": "UDP",
"host": "localhost",
"port": 6900
}
],
"queue": {
"type": "SIMPLE"
}
}
]
}
This project is licensed under the AGPL-3.0 License.