Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix-bug-in-excludecor…
Browse files Browse the repository at this point in the history
…rectlytaggednodes
  • Loading branch information
restanrm committed Aug 11, 2022
2 parents 0bb205d + dbf0e20 commit 110b01b
Show file tree
Hide file tree
Showing 27 changed files with 544 additions and 472 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bufbuild/buf-setup-action@v0.7.0
- uses: bufbuild/buf-setup-action@v1.7.0
- uses: bufbuild/buf-lint-action@v1
with:
input: "proto"
27 changes: 25 additions & 2 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ jobs:
with:
fetch-depth: 2

- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 10

- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]
Expand All @@ -25,11 +30,29 @@ jobs:
- uses: cachix/install-nix-action@v16
if: steps.changed-files.outputs.any_changed == 'true'

- name: Run Integration tests
- name: Run CLI integration tests
if: steps.changed-files.outputs.any_changed == 'true'
uses: nick-fields/retry@v2
with:
timeout_minutes: 240
max_attempts: 5
retry_on: error
command: nix develop --command -- make test_integration_cli

- name: Run Embedded DERP server integration tests
if: steps.changed-files.outputs.any_changed == 'true'
uses: nick-fields/retry@v2
with:
timeout_minutes: 240
max_attempts: 5
retry_on: error
command: nix develop --command -- make test_integration_derp

- name: Run general integration tests
if: steps.changed-files.outputs.any_changed == 'true'
uses: nick-fields/retry@v2
with:
timeout_minutes: 240
max_attempts: 5
retry_on: error
command: nix develop --command -- make test_integration
command: nix develop --command -- make test_integration_general
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

## 0.17.0 (2022-xx-xx)

### Changes

- Updated dependencies (including the library that lacked armhf support) [#722](https://github.com/juanfont/headscale/pull/722)
- Fix missing group expansion in function `excludeCorretlyTaggedNodes` [#563](https://github.com/juanfont/headscale/issues/563)

## 0.16.0 (2022-07-25)
Expand Down
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ dev: lint test build
test:
@go test -coverprofile=coverage.out ./...

test_integration:
go test -failfast -tags integration -timeout 30m -count=1 ./...
test_integration: test_integration_cli test_integration_derp test_integration_general

test_integration_cli:
go test -tags integration -v integration_cli_test.go integration_common_test.go
go test -failfast -tags integration_cli,integration -timeout 30m -count=1 ./...

test_integration_derp:
go test -tags integration -v integration_embedded_derp_test.go integration_common_test.go
go test -failfast -tags integration_derp,integration -timeout 30m -count=1 ./...

test_integration_general:
go test -failfast -tags integration_general,integration -timeout 30m -count=1 ./...

coverprofile_func:
go tool cover -func=coverage.out
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ one of the maintainers.

## Client OS support

| OS | Supports headscale |
| ------- | ----------------------------------------------------------------------------------------------------------------- |
| Linux | Yes |
| OpenBSD | Yes |
| FreeBSD | Yes |
| macOS | Yes (see `/apple` on your headscale for more information) |
| Windows | Yes [docs](./docs/windows-client.md) |
| Android | [You need to compile the client yourself](https://github.com/juanfont/headscale/issues/58#issuecomment-885255270) |
| iOS | Not yet |
| OS | Supports headscale |
| ------- | --------------------------------------------------------- |
| Linux | Yes |
| OpenBSD | Yes |
| FreeBSD | Yes |
| macOS | Yes (see `/apple` on your headscale for more information) |
| Windows | Yes [docs](./docs/windows-client.md) |
| Android | Yes [docs](./docs/android-client.md) |
| iOS | Not yet |

## Running headscale

Expand Down
4 changes: 2 additions & 2 deletions api_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const (
apiPrefixLength = 7
apiKeyLength = 32

errAPIKeyFailedToParse = Error("Failed to parse ApiKey")
ErrAPIKeyFailedToParse = Error("Failed to parse ApiKey")
)

// APIKey describes the datamodel for API keys used to remotely authenticate with
Expand Down Expand Up @@ -116,7 +116,7 @@ func (h *Headscale) ExpireAPIKey(key *APIKey) error {
func (h *Headscale) ValidateAPIKey(keyStr string) (bool, error) {
prefix, hash, found := strings.Cut(keyStr, ".")
if !found {
return false, errAPIKeyFailedToParse
return false, ErrAPIKeyFailedToParse
}

key, err := h.GetAPIKey(prefix)
Expand Down
3 changes: 1 addition & 2 deletions app_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package headscale

import (
"io/ioutil"
"os"
"testing"

Expand Down Expand Up @@ -35,7 +34,7 @@ func (s *Suite) ResetDB(c *check.C) {
os.RemoveAll(tmpDir)
}
var err error
tmpDir, err = ioutil.TempDir("", "autoygg-client-test")
tmpDir, err = os.MkdirTemp("", "autoygg-client-test")
if err != nil {
c.Fatal(err)
}
Expand Down
11 changes: 5 additions & 6 deletions cmd/headscale/headscale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"io/fs"
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand All @@ -28,7 +27,7 @@ func (s *Suite) TearDownSuite(c *check.C) {
}

func (*Suite) TestConfigFileLoading(c *check.C) {
tmpDir, err := ioutil.TempDir("", "headscale")
tmpDir, err := os.MkdirTemp("", "headscale")
if err != nil {
c.Fatal(err)
}
Expand Down Expand Up @@ -73,7 +72,7 @@ func (*Suite) TestConfigFileLoading(c *check.C) {
}

func (*Suite) TestConfigLoading(c *check.C) {
tmpDir, err := ioutil.TempDir("", "headscale")
tmpDir, err := os.MkdirTemp("", "headscale")
if err != nil {
c.Fatal(err)
}
Expand Down Expand Up @@ -117,7 +116,7 @@ func (*Suite) TestConfigLoading(c *check.C) {
}

func (*Suite) TestDNSConfigLoading(c *check.C) {
tmpDir, err := ioutil.TempDir("", "headscale")
tmpDir, err := os.MkdirTemp("", "headscale")
if err != nil {
c.Fatal(err)
}
Expand Down Expand Up @@ -152,14 +151,14 @@ func (*Suite) TestDNSConfigLoading(c *check.C) {
func writeConfig(c *check.C, tmpDir string, configYaml []byte) {
// Populate a custom config file
configFile := filepath.Join(tmpDir, "config.yaml")
err := ioutil.WriteFile(configFile, configYaml, 0o600)
err := os.WriteFile(configFile, configYaml, 0o600)
if err != nil {
c.Fatalf("Couldn't write file %s", configFile)
}
}

func (*Suite) TestTLSConfigValidation(c *check.C) {
tmpDir, err := ioutil.TempDir("", "headscale")
tmpDir, err := os.MkdirTemp("", "headscale")
if err != nil {
c.Fatal(err)
}
Expand Down
6 changes: 3 additions & 3 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func (hi *HostInfo) Scan(destination interface{}) error {
return json.Unmarshal([]byte(value), hi)

default:
return fmt.Errorf("%w: unexpected data type %T", errMachineAddressesInvalid, destination)
return fmt.Errorf("%w: unexpected data type %T", ErrMachineAddressesInvalid, destination)
}
}

Expand All @@ -270,7 +270,7 @@ func (i *IPPrefixes) Scan(destination interface{}) error {
return json.Unmarshal([]byte(value), i)

default:
return fmt.Errorf("%w: unexpected data type %T", errMachineAddressesInvalid, destination)
return fmt.Errorf("%w: unexpected data type %T", ErrMachineAddressesInvalid, destination)
}
}

Expand All @@ -292,7 +292,7 @@ func (i *StringList) Scan(destination interface{}) error {
return json.Unmarshal([]byte(value), i)

default:
return fmt.Errorf("%w: unexpected data type %T", errMachineAddressesInvalid, destination)
return fmt.Errorf("%w: unexpected data type %T", ErrMachineAddressesInvalid, destination)
}
}

Expand Down
3 changes: 1 addition & 2 deletions derp.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -50,7 +49,7 @@ func loadDERPMapFromURL(addr url.URL) (*tailcfg.DERPMap, error) {
}

defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion docs/acls.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ACLs could be written either on [huJSON](https://github.com/tailscale/hujson)
or YAML. Check the [test ACLs](../tests/acls) for further information.

When registering the servers we will need to add the flag
`--advertised-tags=tag:<tag1>,tag:<tag2>`, and the user (namespace) that is
`--advertise-tags=tag:<tag1>,tag:<tag2>`, and the user (namespace) that is
registering the server should be allowed to do it. Since anyone can add tags to
a server they can register, the check of the tags is done on headscale server
and only valid tags are applied. A tag is valid if the namespace that is
Expand Down
19 changes: 19 additions & 0 deletions docs/android-client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Connecting an Android client

## Goal

This documentation has the goal of showing how a user can use the official Android [Tailscale](https://tailscale.com) client with `headscale`.

## Installation

Install the official Tailscale Android client from the [Google Play Store](https://play.google.com/store/apps/details?id=com.tailscale.ipn) or [F-Droid](https://f-droid.org/packages/com.tailscale.ipn/).

Ensure that the installed version is at least 1.30.0, as that is the first release to support custom URLs.

## Configuring the headscale URL

After opening the app, the kebab menu icon (three dots) on the top bar on the right must be repeatedly opened and closed until the _Change server_ option appears in the menu. This is where you can enter your headscale URL.

A screen recording of this process can be seen in the `tailscale-android` PR which implemented this functionality: <https://github.com/tailscale/tailscale-android/pull/55>

After saving and restarting the app, selecting the regular _Sign in_ option (non-SSO) should open up the headscale authentication page.
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

# When updating go.mod or go.sum, a new sha will need to be calculated,
# update this if you have a mismatch after doing a change to thos files.
vendorSha256 = "sha256-2o78hsi0B9U5NOcYXRqkBmg34p71J/R8FibXsgwEcSo=";
vendorSha256 = "sha256-RzmnAh81BN4tbzAGzJbb6CMuws8kuPJDw7aPkRRnSS8=";

ldflags = [ "-s" "-w" "-X github.com/juanfont/headscale/cmd/headscale/cli.Version=v${version}" ];
};
Expand Down
Loading

0 comments on commit 110b01b

Please sign in to comment.