{"id":16190638,"url":"https://github.com/tiagocoutinho/modbus-proxy-rs","last_synced_at":"2025-03-16T10:32:15.760Z","repository":{"id":57639735,"uuid":"443024286","full_name":"tiagocoutinho/modbus-proxy-rs","owner":"tiagocoutinho","description":"Rust version of python https://github.com/tiagocoutinho/modbus-proxy server","archived":false,"fork":false,"pushed_at":"2024-05-14T10:15:37.000Z","size":63,"stargazers_count":14,"open_issues_count":1,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-11T07:43:46.400Z","etag":null,"topics":["modbus","modbus-tcp","rust","server"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tiagocoutinho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-12-30T09:13:23.000Z","updated_at":"2024-05-14T10:15:42.000Z","dependencies_parsed_at":"2023-12-12T18:26:23.253Z","dependency_job_id":"28f18773-3cc1-4dc8-b4ac-660573e47d32","html_url":"https://github.com/tiagocoutinho/modbus-proxy-rs","commit_stats":{"total_commits":52,"total_committers":1,"mean_commits":52.0,"dds":0.0,"last_synced_commit":"f3108bed756ba61bf9acd1ac0c4a134593853f35"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagocoutinho%2Fmodbus-proxy-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagocoutinho%2Fmodbus-proxy-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagocoutinho%2Fmodbus-proxy-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagocoutinho%2Fmodbus-proxy-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiagocoutinho","download_url":"https://codeload.github.com/tiagocoutinho/modbus-proxy-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221663071,"owners_count":16859779,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["modbus","modbus-tcp","rust","server"],"created_at":"2024-10-10T07:43:50.003Z","updated_at":"2024-10-27T10:27:22.397Z","avatar_url":"https://github.com/tiagocoutinho.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Modbus TCP proxy\n\nMany modbus devices support only one or very few clients. This proxy acts as a\nbridge between the client and the modbus device. It can be seen as a layer 7\nreverse proxy.\nThis allows multiple clients to communicate with the same modbus device.\n\nWhen multiple clients are connected, cross messages are avoided by serializing\ncommunication on a first come first served REQ/REP basis.\n\nThis project is the [Rust][rust] version of the [Python][python] based\n[modbus-proxy][modbus-proxy-py] project.\n\nI did it because it fitted my personal goal of exercising with the [Rust][rust]\nprogramming language and it's async based [tokio] library.\n\nThe goal was to produce a robust, highly concurrent server with a low\nmemory footprint.\n\n## Installation\n\n```bash\n$ cargo install modbus-proxy-rs\n```\n\n## Running the server\n\nFirst, you will need write a configuration file where you specify for each\nmodbus device you which to control:\n\n* modbus connection (the modbus device url)\n* listen interface (to which url your clients should connect)\n\nConfiguration files can be written in YAML (*.yml* or *.yaml*) or\nTOML (*.toml*).\n\nSuppose you have a PLC modbus device listening on *plc1.acme.org:502* and\nyou want your clients to connect to your machine on port 9000. A YAML\nconfiguration would look like this:\n\n```yaml\ndevices:\n- modbus:\n    url: plc1.acme.org:502     # device url (mandatory)\n  listen:\n    bind: 0:9000               # listening address (mandatory)\n```\n\nAssuming you saved this file as `modbus-config.yml`, start the server with:\n\n```bash\n$ modbus-proxy-rs -c ./modbus-config.yml\n```\n\nNow, instead of connecting your client(s) to `plc1.acme.org:502` you just need to\ntell them to connect to `*machine*:9000` (where *machine* is the host where\nmodbus-proxy is running).\n\nNote that the server is capable of handling multiple modbus devices. Here is a\nconfiguration example for 2 devices:\n\n```yaml\ndevices:\n- modbus:\n    url: plc1.acme.org:502\n  listen:\n    bind: 0:9000\n- modbus:\n    url: plc2.acme.org:502\n  listen:\n    bind: 0:9001\n```\n\n## Logging\n\nLog levels can be adjusted by setting the `RUST_LOG` environment variable (default is `warn`):\n\n```bash\n$ RUST_LOG=debug modbus-proxy-rs -c ./modbus-config.yml\n```\n\n## Docker\n\nThis project ships with a [Dockerfile](./Dockerfile) which you can use as a\nbase to launch modbus-proxy inside a docker container.\n\nFirst, build the docker image with:\n\n```bash\n$ docker build -t modbus-proxy .\n```\n\nAssuming you have prepared a `config.yml` in the current directory:\n\n```yaml\ndevices:\n- modbus:\n    url: plc1.acme.org:502\n  listen:\n    bind: 0:502\n```\n\nThe supplied docker image by default runs the command `/modbus-proxy-rs -c /etc/modbus-proxy.yml`.\nTherefore, running launching a container is as simple as:\n\n```bash\ndocker run --init --rm -p 5020:502 -v $PWD/config.yml:/etc/modbus-proxy.yml modbus-proxy\n```\n\nYou can supply a different configuration path (ex: `/config.yml`):\n\n```bash\ndocker run --init --rm -p 5020:502 -v $PWD/config.yml:/config.yml modbus-proxy -c /config.yml\n```\n\nNow you should be able to access your modbus device through the modbus-proxy by\nconnecting your client(s) to `\u003cyour-hostname/ip\u003e:5020`.\n\nNote that for each modbus device you add in the configuration file you need\nto publish the corresponding bind port on the host\n(`-p \u003chost port\u003e:\u003ccontainer port\u003e` argument).\n\n## Credits\n\n### Development Lead\n\n* Tiago Coutinho \u003ccoutinhotiago@gmail.com\u003e\n\n### Contributors\n\nNone yet. Why not be the first?\n\n[rust]: https://www.rust-lang.org/\n[python]: https://python.org/\n[modbus-proxy-py]: https://github.com/tiagocoutinho/modbus-proxy\n[tokio]: https://tokio.rs/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiagocoutinho%2Fmodbus-proxy-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiagocoutinho%2Fmodbus-proxy-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiagocoutinho%2Fmodbus-proxy-rs/lists"}