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
kaiyou
740a9c44c6
Update dependencies
2020-05-13 13:52:54 +02:00
kaiyou
a5a55e9447
Properly wrap errors from config.go
...
Co-authored-by: Leo Antunes <leo@costela.net>
2020-05-13 13:52:54 +02:00
kaiyou
7adb944f92
Properly wrap errors from config.go
...
Co-authored-by: Leo Antunes <leo@costela.net>
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
beae4f2044
Restore comment about a "showkey" subcommand
2020-05-13 13:52:54 +02:00
kaiyou
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
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
kaiyou
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
kaiyou
5772640cf9
Fix a simple typo
2020-05-13 13:52:54 +02:00
kaiyou
f2e53dd869
Lower the complexity of newCluster()
...
Move the computation of clusterKey and bindAddress
to separate functions.
2020-05-13 13:52:54 +02:00
kaiyou
7c398181a7
Remove unused go-windows-terminal-sequences
2020-05-13 13:52:54 +02:00
Leo Antunes
249456e19f
ci: fix format for multiple env vars
2020-05-10 13:27:49 +02:00
Leo Antunes
61a20848f3
ci: ensure disabled CGO; simplify cache path
2020-05-10 13:24:07 +02:00
Leo Antunes
f51493ad73
ci: bump dist to bionic
2020-05-10 13:19:27 +02:00
Leo Antunes
a9626edc74
ci: fix jobs vs matrix
2020-05-10 13:15:24 +02:00
Leo Antunes
9d057e93f5
ci: bump go to 1.14
2020-05-10 13:15:24 +02:00
Leo Antunes
4f169bc270
etchosts: also use errors.Wrap as rest of project
2020-05-10 13:15:24 +02:00
Leo Antunes
20888b1a9b
migrate to travis-ci.com
2020-05-10 13:15:24 +02:00
dependabot-preview[bot]
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
Leo Antunes
d45b8321a0
bump wgctrl; switch to multierr
2020-04-19 13:37:49 +02:00
dependabot-preview[bot]
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
dependabot-preview[bot]
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
dependabot-preview[bot]
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
dependabot-preview[bot]
823d370cae
Bump github.com/hashicorp/memberlist from 0.1.6 to 0.1.7
...
Bumps [github.com/hashicorp/memberlist](https://github.com/hashicorp/memberlist ) from 0.1.6 to 0.1.7.
- [Release notes](https://github.com/hashicorp/memberlist/releases )
- [Commits](https://github.com/hashicorp/memberlist/compare/v0.1.6...v0.1.7 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-17 13:46:03 +01:00
dependabot-preview[bot]
c95303fbd0
Bump github.com/hashicorp/memberlist from 0.1.5 to 0.1.6
...
Bumps [github.com/hashicorp/memberlist](https://github.com/hashicorp/memberlist ) from 0.1.5 to 0.1.6.
- [Release notes](https://github.com/hashicorp/memberlist/releases )
- [Commits](https://github.com/hashicorp/memberlist/compare/v0.1.5...v0.1.6 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-04 10:37:34 +01:00
Leo Antunes
709349d121
use structured logging
2020-01-31 19:36:18 +01:00
dependabot-preview[bot]
4419ccb3c3
Bump github.com/pkg/errors from 0.8.1 to 0.9.1
...
Bumps [github.com/pkg/errors](https://github.com/pkg/errors ) from 0.8.1 to 0.9.1.
- [Release notes](https://github.com/pkg/errors/releases )
- [Commits](https://github.com/pkg/errors/compare/v0.8.1...v0.9.1 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-27 10:17:29 +01:00
dependabot-preview[bot]
103b2830d9
Bump github.com/vishvananda/netlink from 1.0.0 to 1.1.0
...
Bumps [github.com/vishvananda/netlink](https://github.com/vishvananda/netlink ) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/vishvananda/netlink/releases )
- [Commits](https://github.com/vishvananda/netlink/compare/v1.0.0...v1.1.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-27 10:16:18 +01:00
dependabot-preview[bot]
5d0926069e
Bump github.com/mattn/go-isatty from 0.0.11 to 0.0.12
...
Bumps [github.com/mattn/go-isatty](https://github.com/mattn/go-isatty ) from 0.0.11 to 0.0.12.
- [Release notes](https://github.com/mattn/go-isatty/releases )
- [Commits](https://github.com/mattn/go-isatty/compare/v0.0.11...v0.0.12 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-27 10:06:06 +01:00
Leo Antunes
f0f3267133
README: clarify quick-start
...
fixes #16
2020-01-12 19:55:25 +01:00
Leo Antunes
563224d9db
README: fix mention of assumed install path
...
fixes #17
2020-01-12 19:29:06 +01:00