Kristoffer Dalby
c4ecc4db91
Simplify control flow in RegistrationHandler
...
This commits tries to dismantle the complicated "if and or" in the
RegistrationHandler by factoring out the "is Registrated" into a root
if.
This, together with some new comments, should hopefully make it a bit
easier to follow what is happening in all the different cases that needs
to be handled when a Node contacts the registration endpoint.
2021-11-21 13:59:24 +00:00
Kristoffer Dalby
8ccc51ae57
Remove special case for authkey
...
We no longer have weird expire behaviour, so we dont need this case
2021-11-21 13:45:19 +00:00
Kristoffer Dalby
9aac1fb255
Remove expiry logic, this needs to be redone
2021-11-19 09:02:29 +00:00
Kristoffer Dalby
106b1e7e8d
Create constants for other reg methods
2021-11-18 17:51:54 +00:00
Kristoffer Dalby
58d1255357
Remove unneeded returns
2021-11-18 08:51:33 +00:00
Kristoffer Dalby
981f712660
Remove unused param
2021-11-18 08:51:21 +00:00
Kristoffer Dalby
50dcb8bb75
Use valid handler for registered authkey machines
2021-11-18 08:50:53 +00:00
Kristoffer Dalby
a8a8f01429
Make "authKey" a constant
2021-11-18 08:49:55 +00:00
Kristoffer Dalby
35c3fe9608
Move registration workflow into functions
2021-11-17 22:39:41 +00:00
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
2634215f12
golangci-lint --fix
2021-11-13 08:39:04 +00:00
Kristoffer Dalby
03b7ec62ca
Go format with shorter lines
2021-11-13 08:36:45 +00:00
Kristoffer Dalby
c2eb3f4d36
Use long command in example and remove pointerlist
2021-11-04 22:18:06 +00:00
Kristoffer Dalby
cbf3f5d640
Resolve merge conflict
2021-10-30 15:33:01 +00:00
Raal Goff
2d252da221
suggested documentation and comments
2021-10-29 21:35:07 +08: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
Kristoffer Dalby
582eb57a09
Use the new derp map
2021-10-22 16:56:00 +00:00
Kristoffer Dalby
da14750396
Merge branch 'main' into main
2021-10-19 15:26:18 +01:00
Kristoffer Dalby
677bd9b657
Implement namespace matching
2021-10-18 19:27:52 +00:00
Juan Font Alonso
01a5fe3c51
Added tests, solved some bugs, and code reorg
2021-10-17 23:58:09 +02:00
Juan Font Alonso
687e8d12be
Do not use the full application for getMapResponseDNSConfig
2021-10-17 12:10:03 +02:00
Juan Font Alonso
01f755ecf9
Send UserProfile info for the peers' namespaces
2021-10-17 12:07:01 +02:00
Juan Font Alonso
061efa1822
Do not include BaseDomain as full route in DNSConfig + code reorg
2021-10-17 11:57:53 +02:00
unreality
afbfc1d370
Merge branch 'main' into main
2021-10-16 22:31:37 +08:00
Raal Goff
0603e29c46
add login details to RegisterResponse so GUI clients show login display name
2021-10-15 23:09:55 +08:00
Juan Font
93517aa6f8
Apply suggestions from code review
...
Renamed AlreadyUsed to Used
Co-authored-by: Kristoffer Dalby <kradalby@kradalby.no>
2021-10-13 22:51:55 +02:00
Juan Font Alonso
30788e1a70
Add AlreadyUsed field to Auth Keys ( fixes #157 and #158 )
2021-10-13 18:13:26 +02:00
Raal Goff
74e6c1479e
updates from code review
2021-10-10 17:22:42 +08:00
Juan Font
c4487b73c4
Merge branch 'main' into magic-dns-support
2021-10-09 12:24:07 +02:00
Kristoffer Dalby
2997f4d251
Merge branch 'main' into main
2021-10-08 22:21:41 +01:00
Raal Goff
e407d423d4
updates from code review
2021-10-08 17:43:52 +08:00
unreality
35795c79c3
Handle trailing slash on uris
...
Co-authored-by: Kristoffer Dalby <kradalby@kradalby.no>
2021-10-08 15:26:31 +08:00
Raal Goff
c487591437
use go-oidc instead of verifying and extracting tokens ourselves, rename oidc_endpoint to oidc_issuer to be more inline with spec
2021-10-06 17:19:15 +08:00
Juan Font
6981543db6
Only search domain from current namespace in MapResponse
2021-10-05 19:00:40 +02:00
Kristoffer Dalby
722084fbd3
Comment out aggressive logging
2021-10-05 16:51:42 +00:00
Juan Font Alonso
a0fa652449
MagicDNS changes merged back
2021-10-04 23:49:16 +02:00
Juan Font Alonso
2eef535b4b
Merged main
2021-10-04 23:43:42 +02:00
Kristoffer Dalby
2eb57e6288
Clean up pointer usage consistency.
...
This tries to make the same functions emit and consume the same type of
data all over the application.
If a function transform data, it should emit new data, not a pointer.
2021-10-04 17:39:01 +00:00
Kristoffer Dalby
1d5b090579
Initial work on Prometheus metrics
...
This commit adds some Prometheus metrics to /metrics in headscale.
It will add the standard go metrics, some automatic gin metrics and some
initial headscale specific ones.
Some of them has been added to aid debugging #97 (loop bug)
In the future, we can use the metrics to get rid of the sleep in the
integration tests by checking that our expected number of nodes has been
registered:
```
headscale_machine_registrations_total
```
2021-10-04 16:28:07 +00:00
Juan Font Alonso
e60ceefea9
Fixing nil issue
2021-10-04 18:03:44 +02:00
Kristoffer Dalby
3c3189caa6
Move toNode, add type helpers, split peers and shared
...
This commit moves toNode to the bottom of the file, and adds a helper
function for lists of Machines to be converted.
It also adds string helpers for Machines and lists of machines.
Lastly it splits getPeers into getDirectPeers, which exist in the same
namespace, and getShared, which is nodes shared with the namespace.
getPeers is kept as a function putting together the two lists for
convenience.
2021-10-02 22:03:34 +01:00
Kristoffer Dalby
0d4a006536
Consitently use Machine pointers
...
This commit rewrites a bunch of the code to always use *Machine instead
of a mix of both, and a mix of tailcfg.Node and Machine.
Now we use *Machine, and if tailcfg.Node is needed, it is converted just
before needed.
2021-10-02 22:00:09 +01:00
Kristoffer Dalby
0475eb6ef7
Move DB call of pollmap to Machine inside a function
2021-10-02 21:58:28 +01:00
Juan Font Alonso
19492650d4
Fixed error on assign
2021-10-02 13:03:08 +02:00
Juan Font Alonso
36ae14bccf
Send search domains
2021-10-02 12:13:19 +02:00
Juan Font Alonso
656237e167
Propagate dns config vales across Headscale
2021-10-02 11:20:42 +02:00