aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 257278d47d7c7df3dc035de54421fd9b25331b31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Diplonat
========

## Feature set

 * [ ] (Re)Configure NAT via UPNP/IGD (prio: high)  
 * [ ] (Re)Configure nftable (prio: low)  
 * [ ] (Re)Configure DNS via ??? (prio: low)  

## Operate

```bash
cargo build
consul agent -dev # in a separate terminal

# adapt following values to your configuratio
export DIPLONAT_PRIVATE_IP="192.168.0.18"
export DIPLONAT_REFRESH_TIME="60"
export DIPLONAT_EXPIRATION_TIME="300"
export DIPLONAT_CONSUL_NODE_NAME="lheureduthe"
export RUST_LOG=debug
cargo run
```

## About Consul Catalog

  * We query the `/v1/catalog/node/<node>` endpoint
  * We can watch it thanks to [Blocking Queries](https://www.consul.io/api/features/blocking.html)

eg:

```bash
curl -vvv http://127.0.0.1:8500/v1/catalog/node/lheureduthe
# returns X-Consul-Index: 15
curl -vvv http://127.0.0.1:8500/v1/catalog/node/lheureduthe?index=15
```

Each time you do the request, the whole list of services bound to the node is returned.


To test the Consul Catalog part, you can do:

```bash
consul agent -dev #in a separate terminal, if not already running
consul services register -name=example -port=1337
consul services -id=example
```