Commit Graph

36 Commits

Author SHA1 Message Date
Steve Fan c9afa9f5ef add initial advertise(Addr|Port) support
(cherry picked from commit 2a0b4f335eb54caa19ad908cdc441d73b57d68ca)
2022-02-11 16:08:56 +01:00
Jacob McSwain 480cbb45f5 Add keepalive to wesher
(cherry picked from commit 982cac3b1a69d5759eaf477785301a564b551bc5)
2022-02-08 10:59:20 +01:00
kaiyou fd8b63c291 Make the MTU configurable 2020-11-29 09:31:54 +01:00
kaiyou da04afe24b Rejoin join nodes automatically
This adds a --rejoin setting for rejoining
cluter nodes automatically when gone.
2020-06-16 10:46:52 +02:00
kaiyou 8637377cec Implement networks routed through wesher
This adds an option for specifying a routed network. Every node route
that belongs to that routed network will be announced to the cluster and
every other node will direct traffic to that node for said route.
2020-06-16 10:37:55 +02:00
kaiyou 129291e848 Use interface name instead of cluster name
The cluster name option is not required anymore and
removed, the interface name is used to name the cluster
directly. For backward compatibility, the old path for storing
cluster state is tried as a fallback when loading.
2020-05-27 23:26:29 +02:00
kaiyou adc7a807df Expose ClusterName instead of Banner/StatePath 2020-05-27 23:26:29 +02:00
kaiyou b9df078538 Fix a typo in the etc/hosts banner
Co-authored-by: Leo Antunes <leo@costela.net>
2020-05-27 23:26:29 +02:00
kaiyou 31b8263e96 Use the StatePath to config when loading the state 2020-05-27 23:26:29 +02:00
kaiyou a0882dad49 Use the custom etc/hosts banner 2020-05-27 23:26:29 +02:00
kaiyou e9b9239eae Reinstante cluster.LocalNode
This makes for more straightforward calls. Also, generate
the localNode directly in wg.New.
2020-05-13 13:52:54 +02:00
kaiyou 5b6923c272 Unexporter AssignOverlayAddress
Instead, the overlay address is assigned upon creation.
Also, the wireguard state is responsible for populating
the local node object.
2020-05-13 13:52:54 +02:00
kaiyou 32a300ffeb Rename node.Decode and node.Encode
EncodeMeta and DecodeMeta are more explicit.
2020-05-13 13:52:54 +02:00
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