Crates.io | delix |
lib.rs | delix |
version | 0.2.4 |
source | src |
created_at | 2016-01-30 12:15:02.136643 |
updated_at | 2016-04-03 11:17:50.895005 |
description | Decentral HTTP proxy / load balancer |
homepage | https://github.com/simia-tech/rust-delix |
repository | https://github.com/simia-tech/rust-delix |
max_upload_size | |
id | 4017 |
size | 438,485 |
The idea behind delix is the create an overlay network that connects microservices. It uses semantic addressing and takes care of encryption, fail-over and load balancing.
cargo install delix
Run three delix nodes in three different terminals.
delix -c example/one.conf.toml
delix -c example/two.conf.toml
delix -c example/three.conf.toml
The node one
opens an interface at 127.0.0.1:4200
which take http requests. All nodes have the service slashdot
configured. In order to request a response from the service run...
curl -H 'Host: slashdot.org' -H 'X-Delix-Service: slashdot' http://127.0.0.1:4200
Let's dive into the config file of node one.
[log]
type = "console"
level = "debug"
[metric]
type = "terminal"
refresh_interval_ms = 100
[cipher]
type = "symmetric"
key = "000102030405060708090a0b0c0d0e0f"
[discovery]
type = "constant"
addresses = [ ]
[transport]
type = "direct"
local_address = "localhost:4001"
request_timeout_ms = 5000
balancer = { type = "dynamic_round_robin" }
[[relay]]
type = "http"
address = "localhost:4200"
header_field = "X-Delix-Service"
[[relay.service]]
name = "slashdot"
address = "slashdot.org:80"
The discovery
section contains the field addresses
which holds a list of IPs (with ports) that is used during
the node's boot up to search for other nodes. Since node one
is the first, the list is empty here.
In the cipher
section is the key
defined for the encryption and authentication of the traffic between nodes.
The key can be 16, 24 or 32 bytes (hex encoded) long and will issue a AES-{128, 192 or 256}-GCM encryption. All nodes
in the network must share the same key.
In order to bind a node to an interface, local_address
in the transport
section must be set. If the interface
differs from the interface visible to other nodes, the field public_address
can be set.
The relay
section at the end, defines here a http
relay that opens a port at address
that takes HTTP
requests. The header_field
in the request tells delix to which service the request should be routed to. The services
are defined in the relay.service
section and define a name and an address which defines the endpoint where the
request is send. In this example it's the slashdot server.
The code is licensed under Apache 2.0.