kaiyou
078946dbdd
Use localNode to store the local node name
...
Also rename setupDelegate to SetLocalNode, so that
main can call SetLocalNode then Update().
2020-05-13 13:52:54 +02:00
kaiyou
f715cfa787
Remove the unneeded writeToEtcHosts function
2020-05-13 13:52:54 +02:00
kaiyou
61104a9272
Add some comments to the main function
2020-05-13 13:52:54 +02:00
kaiyou
b0e41d5c35
Rename WgState to State and NewWgState to New
...
This also caused renaming local variables to avoid
conflicting with the wg package name itself.
2020-05-13 13:52:54 +02:00
kaiyou
3a882eb112
Generate the local node directly in main.go
...
Instead of using a trivial function, simply generate the
local node from main.go, manually assign fields from the
nodeMeta struct.
2020-05-13 13:52:54 +02:00
kaiyou
46da51b7aa
Implement node function as type functions
...
This means nodeMeta can be private again, and also makes it
easier to pass a Node object to the cluster for local meta,
instead of a generic byte[] function.
For later updating, that node is passed using Update() instead
of New().
2020-05-13 13:52:54 +02:00
kaiyou
dadfbee083
Split the application into modules
...
Splitting into modules will help keep concerns separate,
at the cost of a slightly more verbose code.
2020-05-13 13:52:54 +02:00
kaiyou
bce8a0451a
Move the bindAddress computation to config parsing
2020-05-13 13:52:54 +02:00
kaiyou
9fdab65237
Revert "Move the metadata parsing code to node.go"
...
This reverts commit ac6289b5bf95e8903ea90ddf807832a2358371b0.
2020-05-13 13:52:54 +02:00
kaiyou
b0bfeb1f8e
Move the metadata parsing code to node.go
2020-05-13 13:52:54 +02:00
kaiyou
0e799d6074
Parse metadata outside of cluster.go
...
Move the calls for metadata decoding from the cluster
membership management loop to the main loop. This task
was not directly related to the cluster, and was adding
complexity, including the need for multierr structures.
2020-05-13 13:52:54 +02:00
kaiyou
366f906d5d
Do not pass the config object to newCluster
...
Decouple the config structure from the cluster management and
stop passing the config object around.
2020-05-13 13:52:54 +02:00
kaiyou
97525f4b10
Stop using wireguard in cluster.go
...
The wireguard is mostly used to compute metadata.
Metadata is now computed by main.go and encoded in
node.go, the cluster only receives a function generating
the binary metadata.
2020-05-13 13:52:54 +02:00
Leo Antunes
709349d121
use structured logging
2020-01-31 19:36:18 +01:00
Leo Antunes
5427aa5e84
retry join instead of failing
...
this make it easier to bootstrap a cluster and also makes the cluster
more resilient to full-cluster failures or restarts
fixes #6
2019-08-06 21:53:38 +02:00
Leo Antunes
3a401a7942
try some cleanup if iface setup failed
2019-07-29 19:20:53 +02:00
Leo Antunes
f4e61df211
use wgctrl lib instead of wrapping wg-tools
...
fixes : #3
2019-07-12 11:08:14 +02:00
Leo Antunes
3559fcf3b3
also skip /etc/hosts on termination if disabled
2019-07-06 22:41:58 +02:00
Leo Antunes
c1a3cc33f4
also down iface on shutdown
2019-03-27 22:52:34 +01:00
Leo Antunes
407bfbfb7e
add version flag
2019-03-26 23:32:36 +01:00
Leo Antunes
e89a7141e5
add hosts file support
2019-03-26 23:32:36 +01:00
Leo Antunes
b1ff41c523
simplify option names
2019-03-26 23:32:36 +01:00
Leo Antunes
5e01de00c1
first working PoC
2019-03-26 23:32:36 +01:00