1
0
mirror of https://github.com/juanfont/headscale.git synced 2024-12-20 19:09:07 +01:00
Commit Graph

64 Commits

Author SHA1 Message Date
Kristoffer Dalby
582eb57a09 Use the new derp map 2021-10-22 16:56:00 +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
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
Juan Font
c4487b73c4
Merge branch 'main' into magic-dns-support 2021-10-09 12:24:07 +02: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
Juan Font
48b73fa12f Implement node sharing functionality 2021-09-02 16:59:03 +02:00
Kristoffer Dalby
01e781e546
Pass DNSConfig to nodes in MapResponse 2021-08-24 07:11:45 +01:00
Kristoffer Dalby
dd8c0d1e9e Move most "poll" functionality to poll.go
This function migrates more poll functions (including keepalive) to
poll.go to keep it somehow in the same file.

In addition it makes changes to improve the stability and ensure nodes
get the appropriate updates from the headscale control and are not left
in an inconsistent state.

Two new additions is:

omitpeers=true will now trigger an update if the clients are not already up
to date

keepalive has been extended with a timer that will check every 120s if
all nodes are up to date.
2021-08-18 23:24:22 +01:00
Kristoffer Dalby
9698abbfd5
Resolve merge conflict 2021-08-13 10:33:19 +01:00
Kristoffer Dalby
15b8c8f4c5
Remove lock from keepAlive 2021-08-06 20:08:51 +01:00
Kristoffer Dalby
4243885246
Rewrite old lock error msg 2021-08-06 20:03:25 +01:00
Juan Font
c95cf15731 Fixed log message 2021-08-06 00:21:34 +02:00
Kristoffer Dalby
1abc68ccf4 Removes locks causing deadlock
This commit removes most of the locks in the PollingMap handler as there
was combinations that caused deadlocks. Instead of doing a plain map and
doing the locking ourselves, we use sync.Map which handles it for us.
2021-08-05 22:14:37 +01:00
Kristoffer Dalby
575b15e5fa
Add more trace logging 2021-08-05 21:47:06 +01:00
Kristoffer Dalby
a8c8a358d0
Make log keys lowercase 2021-08-05 20:57:47 +01:00
Kristoffer Dalby
0bb2fabc6c
Convert missing from api.go 2021-08-05 18:16:21 +01:00
Kristoffer Dalby
ee704f8ef3
Initial port to zerologger 2021-08-05 18:11:26 +01:00
Kristoffer Dalby
eda6e560c3
debug logging 2021-08-02 22:51:50 +01:00
Juan Font Alonso
0159649d0a Send the namespace name as user to the clients 2021-07-11 16:39:19 +02:00
Juan Font Alonso
eabb1ce881 Fix minor typo on the register webpage 2021-07-11 15:05:32 +02:00
Juan Font Alonso
bff3d2d613 Added HTTP responses on errors 2021-07-11 11:37:17 +02:00
Juan Font Alonso
d4b27fd54b Merge branch 'main' into acls 2021-07-04 21:54:55 +02:00
Juan Font Alonso
ff9d99b9ea Use gorm connection pool 2021-07-04 21:40:46 +02:00
Juan Font
202d6b506f Load ACL policy on headscale startup 2021-07-04 13:24:05 +02:00
Juan Font Alonso
aa27709e60 Update code to Tailscale 1.10 2021-06-25 18:57:08 +02:00
Juan Font Alonso
69ba750b38 Update Headscale to depend on gorm v2 2021-06-24 15:44:19 +02:00
Juan Font Alonso
5db7716be2 Reduce the mutex size when the client closes the connection 2021-06-09 20:55:25 +02:00
Juan Font Alonso
cb1a81fe4c Close the update channel when the client actually closes the connection. Fixes #32. 2021-06-08 19:19:40 +02:00
Juan Font Alonso
aab0bfe2d5 Removed redundant statement 2021-06-05 12:21:49 +02:00
Juan Font Alonso
47b22f3950 Minor improvement on login 2021-06-05 12:19:48 +02:00
Juan Font Alonso
d4c2870d7e Handle client sending new NodeKey (fixes #32) 2021-06-05 12:13:55 +02:00
Juan Font Alonso
4be39f9b83 Improved log messages, and case That Should Never Happen 2021-05-26 21:39:57 +02:00
Juan Font Alonso
064e448d22 Improved tailnode start up handling 2021-05-24 21:59:03 +02: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