1
0
mirror of https://github.com/juanfont/headscale.git synced 2024-10-17 20:05:55 +02:00
Commit Graph

48 Commits

Author SHA1 Message Date
Kristoffer Dalby
715542ac1c
Add and fix stylecheck (golint replacement) 2021-11-15 17:24:24 +00:00
Kristoffer Dalby
471c0b4993
Initial work eliminating one/two letter variables 2021-11-14 20:32:03 +01:00
Kristoffer Dalby
85f28a3f4a
Remove all instances of undefined numbers (gonmd) 2021-11-14 18:31:51 +01:00
Kristoffer Dalby
c9c16c7fb8
Remove unused params or returns 2021-11-14 18:03:21 +01:00
Kristoffer Dalby
89eb13c6cb
Add and fix nlreturn (new line return) 2021-11-14 16:46:09 +01:00
Kristoffer Dalby
03b7ec62ca Go format with shorter lines 2021-11-13 08:36:45 +00:00
Kristoffer Dalby
0803c407a9 Fix Reusable typo, add tests for Augustines scenario 2021-11-08 20:49:03 +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
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
a249d3fe39 Fix color for current namespace in nodes command 2021-11-07 08:58:03 +00:00
Kristoffer Dalby
7b0d2dfb4a Convert nodes command to use gRPC 2021-11-04 22:44:35 +00:00
Ward Vandewege
f9187bdfc4 Switch to named arguments for all nodes subcommands. Update docs
accordingly. Fix integration test failure.
2021-10-28 09:31:15 -04:00
Ward Vandewege
b00a2729e3
Update cmd/headscale/cli/nodes.go
Co-authored-by: Kristoffer Dalby <kradalby@kradalby.no>
2021-10-28 08:39:42 -04:00
Ward Vandewege
6c01b86e4c
Update cmd/headscale/cli/nodes.go
Co-authored-by: Kristoffer Dalby <kradalby@kradalby.no>
2021-10-28 08:39:27 -04:00
Ward Vandewege
d086cf4691 Move the namespace argument back to a flag for the share and unshare
commands.
2021-10-27 17:51:42 -04:00
Ward Vandewege
f9ece0087d Make the cli help a little more explicit for the nodes subcommand. 2021-10-26 08:50:25 -04:00
Ward Vandewege
dd7557850e cli changes for the nodes subcommand:
* when listing nodes, a namespace is now optional, when it is not
  provided, all nodes are shown
* when deleting, and sharing a node, remove the `namespace` flag, it was
  superfluous and unused
* when unsharing a node, specify the namespace as an argument not a
  flag, making the UX the same as for sharing.

Also refactor the share/unshare code to reuse the shared bits.
2021-10-24 17:50:28 -04:00
Ward Vandewege
9e3339b4f1 Add cli support for unsharing a node from a namespace. 2021-10-17 16:29:46 -04:00
Juan Font Alonso
be3a379d10 Added --force flag on node delete (fixes #164) 2021-10-16 12:30:52 +02:00
Juan Font Alonso
6924b7bf4c Output json when deleting node (fixes #152) 2021-10-12 23:48:08 +02:00
Juan Font
c4e6ad1ec7 Fixed some typos 2021-09-10 00:52:08 +02:00
Juan Font
263a3f1983
Merge branch 'main' into shared-nodes 2021-09-10 00:49:50 +02:00
Juan Font
bd6adfaec6 Changes a few more variables 2021-09-10 00:37:01 +02:00
Juan Font
55f3e07bd4
Apply suggestions from code review
Removed one letter variables

Co-authored-by: Kristoffer Dalby <kradalby@kradalby.no>
2021-09-10 00:26:46 +02:00
Juan Font
729cd54401 Renamed sharing function 2021-09-06 14:39:52 +02:00
Juan Font
7edd0cd14c Added add node cli 2021-09-03 10:23:45 +02:00
Juan Font
d86de68b40 Show namespace in node list table 2021-09-02 17:06:47 +02:00
Silver Bullet
e4ef65be76 fix: check last seen time without possible null pointer 2021-09-02 05:44:42 +08:00
Juan Font
bc2574680d Linting 2021-08-15 23:35:03 +02:00
Juan Font
55fe5b0b41 Use pterm table in node list 2021-08-15 23:10:39 +02:00
Juan Font
6c903d4a2f Fixed missing nodes cmd 2021-07-31 23:14:24 +02:00
ohdearaugustin
ea3043cdcb cmd: Add error check for Persistent Flags 2021-07-25 16:26:15 +02:00
ohdearaugustin
2862c2034b Refactor nodes cmd 2021-07-25 15:04:06 +02:00
Juan Font Alonso
57c115e60a Fix linting error: 2021-07-17 11:17:42 +02:00
Juan Font Alonso
0f649aae8b Ask for confirmation before deleting 2021-07-17 11:09:42 +02:00
Juan Font Alonso
9ca2ae7fc5 Implemented delete nodes (#52) 2021-07-17 00:23:12 +02:00
Juan Font Alonso
f5b8a3f710 Make all commands a plural word 2021-06-28 20:04:05 +02:00
Casey Marshall
fdcd3bb574
Fix nil dereference in nodes list command.
Fixes a nil pointer dereference observed when listing nodes that have
not yet connected.

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xb931a4]

goroutine 1 [running]:
github.com/juanfont/headscale/cmd/headscale/cli.glob..func8(0x13c93e0, 0xc0004c4220, 0x0, 0x2)
	/go/src/headscale/cmd/headscale/cli/nodes.go:74 +0x364
github.com/spf13/cobra.(*Command).execute(0x13c93e0, 0xc0004c41e0, 0x2, 0x2, 0x13c93e0, 0xc0004c41e0)
	/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:856 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0x13ca2e0, 0xc000497110, 0xe76416, 0x6)
	/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
	/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
main.main()
	/go/src/headscale/cmd/headscale/headscale.go:89 +0x805
command terminated with exit code 2
```
2021-06-19 18:20:27 -05:00
Ward Vandewege
d1c3faae5f Remove superfluous test support code. Fix bug in node list cli command.
Add tests.
2021-05-23 09:55:15 -04:00
Ward Vandewege
41f6740ddd Add support for ephemeral nodes via a special type of pre-auth key. Add
tests for that feature.

Other fixes: clean up a few typos in comments. Fix a bug that caused the
tests to run four times each. Be more consistent in the use of log
rather than fmt to print errors and notices.
2021-05-22 20:18:29 -04:00
Juan Font Alonso
8ad366f977 Use JsonOutput in version too 2021-05-08 17:06:36 +02:00
Juan Font Alonso
abde7dddb7 More json output 2021-05-08 13:58:51 +02:00
Juan Font Alonso
3b34f715ce Adding support for JSON-formatted output 1/n 2021-05-08 13:28:22 +02:00
Juan Font Alonso
c71c13366f Minor fix 2021-05-01 20:04:03 +02:00
Juan Font Alonso
404fee8361 Added list node functionality 2021-05-01 20:00:25 +02:00
Juan Font Alonso
b83318bfb3 Namespace is now a flag for all the commands 2021-04-30 00:23:26 +02:00
Juan Font Alonso
77e5255fdd Move the CLI functiontionality to the CLI package 2021-04-28 16:15:45 +02:00