Commit Graph

152 Commits

Author SHA1 Message Date
Leo Antunes 7184f7e3d7 readme: minor rewording on wireguard installation
fixes #51
2020-11-29 09:31:54 +01:00
kaiyou a420769bd4 Add e2e test for fixe IP address 2020-06-22 18:29:17 +02:00
kaiyou a52d693f56 Allow specific address to be specified 2020-06-22 18:29:03 +02:00
kaiyou f8fc765936 Remove the entrypoint 2020-06-22 17:36:29 +02:00
kaiyou ba59b0ab34 Replace binary build with a Docker build 2020-06-17 15:35:02 +02:00
kaiyou 7045b23ed3 Announce only local dev routes 2020-06-16 10:46:52 +02:00
kaiyou eae21ef5d7 Add rejoin e2e test 2020-06-16 10:46:52 +02: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 62d9c44c11 Refactor cluster.Join to prepare for rejoin
Now cluster.Join will resolve hostnames itself, then
will avoid trying to join hosts that
are already cluster members.
2020-06-16 10:46:52 +02:00
kaiyou 0ab363f218 Add Gitlab build file 2020-06-16 10:46:52 +02:00
kaiyou ddef84c573 Protect against rogue routes by adversarial nodes
Do not blindly trust routes announced by other nodes.
This first step simply checks that announced routes are
inside the configured routed network.
2020-06-16 10:37:55 +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
Leo Antunes e9aae4dc3b fix and reword README [skip ci] 2020-05-28 18:44:46 +02:00
kaiyou b154851d40 Use docker exec -d to detach test commands 2020-05-27 23:26:29 +02:00
kaiyou fbd48468c4 Use the new tests entrypoint in e2e.sh 2020-05-27 23:26:29 +02:00
kaiyou e788b3eaef Update README.md
Co-authored-by: Leo Antunes <leo@costela.net>
2020-05-27 23:26:29 +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 ca3064f6a7 Add documentation about cluster-name setting 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 404b332e6a Fix the state tests using custom statePath 2020-05-27 23:26:29 +02:00
kaiyou 5930f332b8 Add an e2e test running two clusters 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 f1de2def7f Add Banner and StatePath settings
Banner is used to carry a custom etc/hosts banner while StatePath holds
the path to cluster state storage.
2020-05-27 23:26:29 +02:00
Leo Antunes 7910b5c379 ci: add MIPS* arches to releases; bump go 1.14.3
refs #47
2020-05-27 17:49:10 +02:00
kaiyou 61988692a1 Parse arguments in the tests entrypoint
Add an argument parsing routine to the tests entrypoint, and use it
to parse the interface name, passed to
wireguard-go.
2020-05-21 10:17:48 +02:00
Leo Antunes 2fe308cd1d tests: fix e2e image build 2020-05-19 23:00:54 +02:00
kaiyou 49c0d7f802 Make statePath a variable (temporary)
This is a temporary fix until the state path is made
configurable.
2020-05-13 13:52:54 +02:00
kaiyou 66b0321bf7 Fail more explicitely in cluster state tests
Co-authored-by: Leo Antunes <leo@costela.net>
2020-05-13 13:52:54 +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 a0aa0bcc0e Fix unit tests due to unexported assignOverlayAddr 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 c50011bc36 Use errors.Wrap instead of manual formatting 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 28a31efc1f Rename saveState to state.save 2020-05-13 13:52:54 +02:00
kaiyou d85fb84398 Unexport state from the cluster package 2020-05-13 13:52:54 +02:00
kaiyou 9ddcbb7914 Apply suggestions from code review
Review suggestions in the documentation

Co-authored-by: Leo Antunes <leo@costela.net>
2020-05-13 13:52:54 +02:00
kaiyou faf1c35d96 Implement the delegate interface on Node
Implementing on Node makes a bit more sense than implementing on Cluster
even if the difference in code is insignificant.
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 5d1acc1fab Add documentation to public functions and types 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 0162f9da2c Add unit tests for state functions
Currently unit tests only succeed if the state path
is writeable, since it is hardcoded.
2020-05-13 13:52:54 +02:00
kaiyou 13e1515f7d Split cluster into multiple files 2020-05-13 13:52:54 +02:00
kaiyou 622cfce1ad Add unit tests for node encoding/decoding 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