Commit Graph

2700 Commits

Author SHA1 Message Date
Kristoffer Dalby b210858dc5 Remove unused dep 2021-11-08 18:28:06 +00:00
Kristoffer Dalby e1f45f9d07 Remove unused dep 2021-11-08 18:27:57 +00:00
Kristoffer Dalby dce6b8d72e Add test case and fix nil pointer in preauthkeys command without expiration 2021-11-08 08:02:01 +00:00
Alessandro (Ale) Segala 67953bfe2f
Fixed integration tests 2021-11-07 19:09:51 +00:00
Alessandro (Ale) Segala 6076656373 Updated docs 2021-11-07 18:57:37 +00:00
Kristoffer Dalby 9a26fa7989 Ensure logging is off for integration test commands 2021-11-07 10:40:05 +00:00
Kristoffer Dalby d47b83f80b Unwrap grpc errors to make nicer user facing errors 2021-11-07 10:15:32 +00:00
Kristoffer Dalby b11acad1c9 Fix typo 2021-11-07 09:57:39 +00:00
Kristoffer Dalby b15efb5201 Ensure unix socket is removed before we startup 2021-11-07 09:55:32 +00:00
Kristoffer Dalby 2dfd42f80c Attempt to dry up CLI client, add proepr config
This commit is trying to DRY up the initiation of the gRPC client in
each command:

It renames the function to CLI instead of GRPC as it actually set up a
CLI client, not a generic grpc client

It also moves the configuration of address, timeout (which is now
consistent) and api to use Viper, allowing users to set it via env vars
and configuration file
2021-11-07 09:41:14 +00:00
Kristoffer Dalby ce3f79a3bf Add yaml to output help 2021-11-07 08:58:45 +00:00
Kristoffer Dalby a249d3fe39 Fix color for current namespace in nodes command 2021-11-07 08:58:03 +00:00
Alessandro (Ale) Segala a6d487de00 Using debian11-based distroless image 2021-11-06 23:19:56 +00:00
Alessandro (Ale) Segala 3720da6386 Using distroless base image for Docker 2021-11-06 23:18:13 +00:00
Kristoffer Dalby 26718e8308 Revert gorm upgrade 2021-11-06 20:23:04 +00:00
Kristoffer Dalby f5a196088a
Merge branch 'main' into cli-grpc 2021-11-06 20:12:19 +00:00
Kristoffer Dalby 74f0d08f50
Merge pull request #199 from rcursaru/patch-1
update Running.md
2021-11-06 20:05:27 +00:00
Kristoffer Dalby 046681f4ef
Merge branch 'main' into patch-1 2021-11-06 19:46:06 +00:00
Kristoffer Dalby 29531a5e90
Merge branch 'main' into cli-grpc 2021-11-06 19:29:00 +00:00
Ward Vandewege 137a9d6333
Merge pull request #213 from aberoham/patch-1
Typo in golang URL
2021-11-06 14:23:17 -04:00
Abraham Ingersoll 8115f50d03
Typo in golang URL 2021-11-06 07:43:41 +00:00
Kristoffer Dalby b75e8ae2bd
Merge branch 'main' into patch-1 2021-11-05 18:27:55 +00:00
Kristoffer Dalby 3ad2350c79 Fix new version of hujson 2021-11-05 07:24:00 +00:00
Kristoffer Dalby 204f99dd51 Add CLI integration tests
This PR adds a new part to the integration test suite which spins up a
new headscale and runs through a scenario of test cases for each
command.

The intent is to check that all commands work as intended and produce
the expected output.

I think they have been pretty well covered, but would appreciate
additional test cases if I have missed some.

Please note: headscale is set up, and teared down for _each_ "test
function" in this file, this means that its more suitable for specific
cases.
2021-11-04 22:45:15 +00:00
Kristoffer Dalby 8df41b069f Formatting 2021-11-04 22:45:08 +00:00
Kristoffer Dalby be4256b1d0 Convert routes command to use gRPC 2021-11-04 22:44:59 +00:00
Kristoffer Dalby 77a973878c Convert preauthkeys command to use gRPC 2021-11-04 22:44:49 +00:00
Kristoffer Dalby 7b0d2dfb4a Convert nodes command to use gRPC 2021-11-04 22:44:35 +00:00
Kristoffer Dalby 79871d2463 Make namespace command use gRPC
This commit is a first in a series of commits migrating the command
interfaces to use the new gRPC client.

As a part of this commit, they have been streamlined and each command
_should_ be a bit more similar and use consistent output.

By using the new output function, we now make sure its always json
(errors and everything) if the user asks for JSON.
2021-11-04 22:42:21 +00:00
Kristoffer Dalby dce82f4323 Use new json wrapper for version command 2021-11-04 22:41:55 +00:00
Kristoffer Dalby 9e9049307e Simplify loglevel parser, turn off logs when machine output is set 2021-11-04 22:32:13 +00:00
Kristoffer Dalby cd34a5d6f3 Expand json output to support yaml, make more generic 2021-11-04 22:31:47 +00:00
Kristoffer Dalby 319237910b Resolve new dependencies 2021-11-04 22:28:35 +00:00
Kristoffer Dalby 3eed356d70 Implement rpc calls with new helper functions, implementing the proto spec 2021-11-04 22:19:27 +00:00
Kristoffer Dalby 706ff59d70 Clean pointer list in app.go, add grpc logging and simplify naming 2021-11-04 22:18:55 +00:00
Kristoffer Dalby c2eb3f4d36 Use long command in example and remove pointerlist 2021-11-04 22:18:06 +00:00
Kristoffer Dalby 9acc3e0e73 Add a set of ip prefix convert helpers 2021-11-04 22:17:44 +00:00
Kristoffer Dalby 94dbaa6822 Clean up the return of "pointer list"
This commit is getting rid of a bunch of returned list pointers.
2021-11-04 22:16:56 +00:00
Kristoffer Dalby 5526ccc696 Namespaces are no longer a pointer 2021-11-04 22:15:46 +00:00
Kristoffer Dalby 95690e614e Simplify and streamline namespace functions for new cli/rpc/api 2021-11-04 22:15:17 +00:00
Kristoffer Dalby 77f5f8bd1c Simplify and streamline preauth commands for new cli/rpc/api 2021-11-04 22:14:39 +00:00
Kristoffer Dalby 787814ea89 Consolidate machine related lookups
This commit moves the routes lookup functions to be subcommands of
Machine, making them a lot simpler and more specific/composable.

It also moves the register command from cli.go into machine, so we can
clear out the extra file.

Finally a toProto function has been added to convert between the machine
database model and the proto/rpc model.
2021-11-04 22:11:38 +00:00
Kristoffer Dalby 67adea5cab Move common integration test commands into common file 2021-11-04 22:10:57 +00:00
Kristoffer Dalby 4226da3d6b Add "debug" command
This commit adds a debug command tree, intended to host commands used
for debugging and testing.

It adds a create node/machine command which will be used later to create
machines that can be used to test the registration command.
2021-11-04 22:08:45 +00:00
Kristoffer Dalby 5270361989 Add generated files from protobuf 2021-11-04 22:07:59 +00:00
Kristoffer Dalby a6aa6a4f7b Add proto rpc interface for cli
This commit adds proto rpc definitions for the communication needed for
the CLI interface.
This will allow us to move the rest of the CLI interface over to gRPC
and in the future allow remote access
2021-11-04 22:02:10 +00:00
Kristoffer Dalby 1c530be66c
Merge pull request #206 from kradalby/initial-api-cli-work 2021-11-04 14:09:06 +00:00
Kristoffer Dalby 7c774bc547
Remove flag that cant be trapped 2021-11-02 21:49:19 +00:00
Kristoffer Dalby 9954a3c599
Add handling for closing the socket 2021-11-02 21:46:15 +00:00
Kristoffer Dalby b91c115ade
Remove "auth skip" for socket traffic 2021-10-31 19:57:42 +00:00