Awesome
chumak
What is chumak?
chumak
is a library written in Erlang. It implements the ZeroMQ Message Transport Protocol (ZMTP). chumak
supports ZMTP version 3.1.
Goal
The goal of chumak
application is to provide up-to-date native Erlang implementation of ZMTP.
Features
- Resource Property (NEW in 3.1!)
- Request-Reply pattern
- Publish-Subscribe pattern
- Pipeline Pattern
- Exclusive Pair Pattern
- Version Negotiation
- NULL Security Mechanism
- CURVE Security Mechanism
- Error Handling
- Framing
- Socket-Type Property & Identity Property
- Backwards Interoperability with ZMTP 3.0
Install
You can install chumak
from hex.pm by including the following in your rebar.config
:
{deps,[
{chumak, "X.Y.Z"}
]}.
where X.Y.Z is one of the release versions.
For more info on rebar3 dependencies see the rebar3 docs.
Usage
See examples. Otherwise use just like a regular Erlang/OTP application.
If you would like to use python tests to try language interop, you need to have pyzmq installed.
Build
$ rebar3 compile
By default, this will try to build a version of the application that does not include support for the CURVE security model.
The environment variable CHUMAK_CURVE_LIB
can be used to specify a
NIF that implements the encryption functions that are required to support
the CURVE security model.
The following values for CHUMAK_CURVE_LIB
are supported:
-
nacerl - this is the minimal variant using the tweetnacl C library. By default it is fetched and built from https://github.com/willemdj/NaCerl.
Compilation of nacerl requires gcc and make. Since these tools may not be available on windows systems, a check on the availability of these tools will be done. If they are not available the dependency will not be fetched and there will be no support for the CURVE security model.
-
nacl - this is similar to nacerl, but it depends on libsodium. The repository for this is https://github.com/tonyg/erlang-nacl. The the build process for Chumak will not automatically fetch and build it, but if
CHUMAK_CURVE_LIB
is set to "nacl", it will be assumed that this library is available and it will be used. -
enacl - this also depends on libsodium, but it also requires an Erlang VM that supports dirty schedulers. The repository is https://github.com/jlouis/enacl. The build process for Chumak will not automatically fetch and build it, but if
CHUMAK_CURVE_LIB
is set to "enacl", it will be assumed that this library is available and it will be used.
Test
$ rebar3 eunit -c
The -c
will allow you to see the test coverage by running the command below.
Coverage
$ rebar3 cover
Generate Docs
$ rebar3 edoc
Architecture
Architecture describes the system structure.
Help Wanted
Would you like to help with the project? Pick any of the issues tagged help wanted and contribute!
Contributing
See Contributing.
FAQ
-
Why another Erlang implementation?
Because the existing Erlang implementations and bindings are out of date.
-
Can I use
chumak
for free?Yes, as long as you abide by the terms of the MPLv2 license. In short, you can include this code as a part of a larger work, even commercial. It is only when you modify
chumak
source code itself that you have to make that change available. Please read the license, as this description is not complete by any means. -
Do I have to sign over my copyright when contributing?
No. Everyone owns the piece of code they contribute. Please see Contributing for details.
License
This project is licensed under Mozilla Public License Version 2.0. See license for complete license terms.
Etymology
From Wikipedia:
Chumak (Ukrainian: чумак) is a historic occupation on the territory of the modern Ukraine as merchants or traders, primarily known for the trade in salt.
How to publish new Hex.pm version
To update a hex.pm version, you simply need to bump the version of erlang package and the github action will publish a new version on Hex.pm:
- Adjust the version of the package in
src/chumak.app.src
- Commit & Push
- Done
How to publish to Hex.pm manually (Note: this is now superceeded by automatic github action above)
This info is here for maintainers - since I keep forgetting how to do this.
- Adjust the version of the package in
src/chumak.app.src
- Login to hex.pm:
rebar3 hex user auth
- Put in your hex.pm username and your password (ignore the warning) - enter it 2 more times! (weird)
- Publish:
rebar3 hex publish