Commit Graph

696 Commits

Author SHA1 Message Date
Kristoffer Dalby 434fac52b7 Fix lint error 2021-10-30 14:29:03 +00:00
Kristoffer Dalby 6aacada852 Switch from gRPC localhost to socket
This commit changes the way CLI and grpc-gateway communicates with the
gRPC backend to socket, instead of localhost. Unauthenticated access now
goes on the socket, while the network interface will require API key (in
the future).
2021-10-30 14:08:16 +00:00
Kristoffer Dalby 72fd2a2780 Fix lint error 2021-10-29 17:36:11 +00:00
Kristoffer Dalby 9ef031f0f8 Port create, delete and list of namespace to grpc 2021-10-29 17:16:54 +00:00
Kristoffer Dalby 81b8610dff Add helper function to setup grpc client for cli 2021-10-29 17:15:52 +00:00
Kristoffer Dalby eefd82a574 Move config loading out of the headscale app setup 2021-10-29 17:09:06 +00:00
Kristoffer Dalby 002b5c1dad Add grpc token auth struct 2021-10-29 17:08:21 +00:00
Kristoffer Dalby 68dab0fe7b Move localhost check to utils 2021-10-29 17:04:58 +00:00
Kristoffer Dalby 6d10be8fff Change order of print/nil check in integration test 2021-10-29 16:49:44 +00:00
Kristoffer Dalby a23d82e33a Setup API and prepare for API keys
This commit sets up the API and gRPC endpoints and adds authentication
to them. Currently there is no actual authentication implemented but it
has been prepared for API keys.

In addition, there is a allow put in place for gRPC traffic over
localhost. This has two purposes:

1. grpc-gateway, which is the base of the API, connects to the gRPC
   service over localhost.
2. We do not want to break current "on server" behaviour which allows
   users to use the cli on the server without any fuzz
2021-10-29 16:45:06 +00:00
Kristoffer Dalby c7fa9b6e4a Setup create, delete and list namespace over grpc 2021-10-29 16:44:32 +00:00
Kristoffer Dalby 07bbeafa3b Fix lint errors, add initial namespace rpc 2021-10-29 16:43:10 +00:00
Kristoffer Dalby 06700c1dc4 Setup proto linting 2021-10-29 16:42:56 +00:00
Kristoffer Dalby 2c071a8a2d
Merge pull request #204 from kradalby/api-playground 2021-10-28 20:17:20 +01:00
Kristoffer Dalby 5054ed41ac Make ci lint fix if it can 2021-10-27 07:10:32 +00:00
Kristoffer Dalby e91174e83f Add gen explicitly to skip list 2021-10-27 07:08:24 +00:00
Kristoffer Dalby c9bd25d05c Remove golint from github actions 2021-10-27 07:07:44 +00:00
Kristoffer Dalby f779372154 Add golangcilint config 2021-10-27 07:07:19 +00:00
Kristoffer Dalby acd9ebbdf8 Let lint ignore grpcv1.go as it is placeholder 2021-10-27 07:06:39 +00:00
Kristoffer Dalby 6369cea10e Remove golint, its deprecated
This commit removed `golint`, its deprecated:
https://github.com/golang/lint

and golangci-lint has overlapping features.
2021-10-27 06:58:16 +00:00
Kristoffer Dalby 2d92719095 Dont try to generate code on every make build 2021-10-27 06:48:30 +00:00
Kristoffer Dalby d4265779ef Check in generated code
This does not have to be reviewed, here is some reasoning:

Go (and go mod) is designed for having code available and we need to
check in the generated code to make sure it is "go gettable". If we dont
we give ourselves a headache trying to setup all the ci, tests etc to
install and generate the code before it runs.

Because the code isnt there, the plugins needed to generate the code
fail to install...

I didnt find any good documentation for this, but there is this github
comment:
https://github.com/golang/go/issues/34514#issuecomment-535406759
2021-10-27 06:44:04 +00:00
Kristoffer Dalby 8f2ef6a57d Prepare for checking in generated code 2021-10-27 06:40:39 +00:00
Kristoffer Dalby 6e764942a2 Add grpc step to dockerfile 2021-10-26 21:35:18 +00:00
Kristoffer Dalby 11d987549f Ignore generated files for docker 2021-10-26 21:34:51 +00:00
Kristoffer Dalby b8c89cd63c Add readme and makefile entry about code generation 2021-10-26 20:53:10 +00:00
Kristoffer Dalby 2f045b20fb Refactor tls and wire up grpc, grpc gateway/api
This commit moves the TLS configuration into a seperate function.

It also wires up the gRPC interface and prepares handing the API
endpoints to the grpc gateway.
2021-10-26 20:42:56 +00:00
Kristoffer Dalby caa4d33cbd Add an initial grpcv1 service (implementing the proto generated service) 2021-10-26 20:42:20 +00:00
Kristoffer Dalby a9da7c8fd9 Update go.mod 2021-10-26 20:41:35 +00:00
Kristoffer Dalby b096a2e7e5 Create an initial gRPC service
This commit adds protobuf files and tooling surrounding generating APIs
and datatypes.
2021-10-26 20:37:37 +00:00
Kristoffer Dalby e8277595f5
Merge pull request #202 from juanfont/kradalby-patch-1
Add note about main containing unreleased  changes
2021-10-25 20:14:36 +01:00
Kristoffer Dalby 4d3b638a3d
Add note about main containing unreleased changes
#201
2021-10-25 19:38:11 +01:00
Kristoffer Dalby 6d162eeff9
Merge pull request #197 from kradalby/config-simplification 2021-10-24 22:27:18 +01:00
Kristoffer Dalby 746d4037da
Fix config and tests 2021-10-24 21:30:51 +01:00
Kristoffer Dalby 1237e02f7c Merge branch 'config-simplification' of github.com:kradalby/headscale into config-simplification 2021-10-24 21:21:08 +01:00
Kristoffer Dalby 7da3d4ba50
Resolve merge conflict 2021-10-24 21:21:01 +01:00
Kristoffer Dalby 8853315dcc
Update config-example.yaml
Co-authored-by: Juan Font <juanfontalonso@gmail.com>
2021-10-23 10:40:15 +01:00
Kristoffer Dalby 5aaffaaecb
Merge pull request #196 from kradalby/derp-improvements
Add ability to fetch DERP from url and file
2021-10-23 09:20:27 +01:00
Kristoffer Dalby 389a8d47a3
Merge branch 'main' into derp-improvements 2021-10-22 23:58:48 +01:00
Kristoffer Dalby a355769416
Update derp-example.yaml
Co-authored-by: Juan Font <juanfontalonso@gmail.com>
2021-10-22 23:58:27 +01:00
Juan Font 1a8c9216d6
Merge pull request #194 from juanfont/update-contributors
docs(README): update contributors
2021-10-23 00:11:22 +02:00
Juan Font 81316ef644
Merge branch 'main' into update-contributors 2021-10-22 21:28:27 +02:00
Kristoffer Dalby 4d4d0de356
Start adding comments to config 2021-10-22 18:27:11 +01:00
Kristoffer Dalby b85adbc40a
Remove the need for multiple config files
This commit removes the almost a 100% redundant tests (two fields were
checked differently) and makes a single example configuration for users.
2021-10-22 18:14:29 +01:00
Kristoffer Dalby aefbd66317 Remove derpmap volume from integration tests 2021-10-22 16:57:51 +00:00
Kristoffer Dalby d875cca69d move integration to yaml, add new derp configuration 2021-10-22 16:57:01 +00:00
Kristoffer Dalby 0e902fe949 Add certificates to docker image so we can get derpmap from tailscale 2021-10-22 16:56:23 +00:00
Kristoffer Dalby 582eb57a09 Use the new derp map 2021-10-22 16:56:00 +00:00
Kristoffer Dalby 177f1eca06 Add helper functions for building derp maps from urls and file 2021-10-22 16:55:35 +00:00
Kristoffer Dalby 57f46ded83 Split derp into its own config struct 2021-10-22 16:55:14 +00:00