2fe308cd1d
tests: fix e2e image build
2020-05-19 23:00:54 +02:00
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
66b0321bf7
Fail more explicitely in cluster state tests
...
Co-authored-by: Leo Antunes <leo@costela.net >
2020-05-13 13:52:54 +02:00
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
a0aa0bcc0e
Fix unit tests due to unexported assignOverlayAddr
2020-05-13 13:52:54 +02:00
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
c50011bc36
Use errors.Wrap instead of manual formatting
2020-05-13 13:52:54 +02:00
32a300ffeb
Rename node.Decode and node.Encode
...
EncodeMeta and DecodeMeta are more explicit.
2020-05-13 13:52:54 +02:00
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
28a31efc1f
Rename saveState to state.save
2020-05-13 13:52:54 +02:00
d85fb84398
Unexport state from the cluster package
2020-05-13 13:52:54 +02:00
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
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
f715cfa787
Remove the unneeded writeToEtcHosts function
2020-05-13 13:52:54 +02:00
61104a9272
Add some comments to the main function
2020-05-13 13:52:54 +02:00
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
5d1acc1fab
Add documentation to public functions and types
2020-05-13 13:52:54 +02:00
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
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
13e1515f7d
Split cluster into multiple files
2020-05-13 13:52:54 +02:00
622cfce1ad
Add unit tests for node encoding/decoding
2020-05-13 13:52:54 +02:00
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
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
740a9c44c6
Update dependencies
2020-05-13 13:52:54 +02:00
a5a55e9447
Properly wrap errors from config.go
...
Co-authored-by: Leo Antunes <leo@costela.net >
2020-05-13 13:52:54 +02:00
7adb944f92
Properly wrap errors from config.go
...
Co-authored-by: Leo Antunes <leo@costela.net >
2020-05-13 13:52:54 +02:00
bce8a0451a
Move the bindAddress computation to config parsing
2020-05-13 13:52:54 +02:00
9fdab65237
Revert "Move the metadata parsing code to node.go"
...
This reverts commit ac6289b5bf95e8903ea90ddf807832a2358371b0.
2020-05-13 13:52:54 +02:00
beae4f2044
Restore comment about a "showkey" subcommand
2020-05-13 13:52:54 +02:00
00c9d5ec76
Create the node slice with the proper length
...
Co-authored-by: Leo Antunes <leo@costela.net >
2020-05-13 13:52:54 +02:00
b0bfeb1f8e
Move the metadata parsing code to node.go
2020-05-13 13:52:54 +02:00
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
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
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
0d93439d0d
Move node related stuff to node.go
...
The cornerstone for exchanging data is the node
structure and associated metadata. Moving it to a
separate file (maybe later a separate module) will help
decoupling.
2020-05-13 13:52:54 +02:00
5772640cf9
Fix a simple typo
2020-05-13 13:52:54 +02:00
f2e53dd869
Lower the complexity of newCluster()
...
Move the computation of clusterKey and bindAddress
to separate functions.
2020-05-13 13:52:54 +02:00
7c398181a7
Remove unused go-windows-terminal-sequences
2020-05-13 13:52:54 +02:00
249456e19f
ci: fix format for multiple env vars
2020-05-10 13:27:49 +02:00
61a20848f3
ci: ensure disabled CGO; simplify cache path
2020-05-10 13:24:07 +02:00
f51493ad73
ci: bump dist to bionic
2020-05-10 13:19:27 +02:00
a9626edc74
ci: fix jobs vs matrix
2020-05-10 13:15:24 +02:00
9d057e93f5
ci: bump go to 1.14
2020-05-10 13:15:24 +02:00
4f169bc270
etchosts: also use errors.Wrap as rest of project
2020-05-10 13:15:24 +02:00
20888b1a9b
migrate to travis-ci.com
2020-05-10 13:15:24 +02:00
7c9067667d
Bump github.com/sirupsen/logrus from 1.5.0 to 1.6.0
...
Bumps [github.com/sirupsen/logrus](https://github.com/sirupsen/logrus ) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/sirupsen/logrus/releases )
- [Changelog](https://github.com/sirupsen/logrus/blob/master/CHANGELOG.md )
- [Commits](https://github.com/sirupsen/logrus/compare/v1.5.0...v1.6.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2020-05-04 21:36:45 +02:00
d45b8321a0
bump wgctrl; switch to multierr
2020-04-19 13:37:49 +02:00
b07537e773
Bump github.com/stevenroose/gonfig from 0.1.4 to 0.1.5
...
Bumps [github.com/stevenroose/gonfig](https://github.com/stevenroose/gonfig ) from 0.1.4 to 0.1.5.
- [Release notes](https://github.com/stevenroose/gonfig/releases )
- [Changelog](https://github.com/stevenroose/gonfig/blob/master/CHANGELOG.md )
- [Commits](https://github.com/stevenroose/gonfig/compare/v0.1.4...v0.1.5 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2020-04-13 21:11:02 +02:00
d0dc6e9aa9
Bump github.com/sirupsen/logrus from 1.4.2 to 1.5.0
...
Bumps [github.com/sirupsen/logrus](https://github.com/sirupsen/logrus ) from 1.4.2 to 1.5.0.
- [Release notes](https://github.com/sirupsen/logrus/releases )
- [Changelog](https://github.com/sirupsen/logrus/blob/master/CHANGELOG.md )
- [Commits](https://github.com/sirupsen/logrus/compare/v1.4.2...v1.5.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2020-03-30 09:29:40 +02:00
69bea42aad
Bump github.com/hashicorp/memberlist from 0.1.7 to 0.2.0
...
Bumps [github.com/hashicorp/memberlist](https://github.com/hashicorp/memberlist ) from 0.1.7 to 0.2.0.
- [Release notes](https://github.com/hashicorp/memberlist/releases )
- [Commits](https://github.com/hashicorp/memberlist/compare/v0.1.7...v0.2.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
2020-03-16 11:48:32 +01:00