Migrate IP fields in database to dedicated columns (#1869)
This commit is contained in:
parent
85cef84e17
commit
2ce23df45a
39 changed files with 1885 additions and 1055 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"time"
|
||||
|
||||
v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
|
||||
"github.com/juanfont/headscale/hscontrol/types"
|
||||
"github.com/juanfont/headscale/integration/hsic"
|
||||
"github.com/juanfont/headscale/integration/tsic"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
@ -39,6 +40,7 @@ func TestPingAllByIP(t *testing.T) {
|
|||
hsic.WithEmbeddedDERPServerOnly(),
|
||||
hsic.WithTLS(),
|
||||
hsic.WithHostnameAsServerURL(),
|
||||
hsic.WithIPAllocationStrategy(types.IPAllocationStrategyRandom),
|
||||
)
|
||||
assertNoErrHeadscaleEnv(t, err)
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package hsic
|
||||
|
||||
import "github.com/juanfont/headscale/hscontrol/types"
|
||||
|
||||
// const (
|
||||
// defaultEphemeralNodeInactivityTimeout = time.Second * 30
|
||||
// defaultNodeUpdateCheckInterval = time.Second * 10
|
||||
|
@ -129,5 +131,9 @@ func DefaultConfigEnv() map[string]string {
|
|||
"HEADSCALE_DERP_URLS": "https://controlplane.tailscale.com/derpmap/default",
|
||||
"HEADSCALE_DERP_AUTO_UPDATE_ENABLED": "false",
|
||||
"HEADSCALE_DERP_UPDATE_FREQUENCY": "1m",
|
||||
|
||||
// a bunch of tests (ACL/Policy) rely on predicable IP alloc,
|
||||
// so ensure the sequential alloc is used by default.
|
||||
"HEADSCALE_PREFIXES_ALLOCATION": string(types.IPAllocationStrategySequential),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import (
|
|||
"github.com/davecgh/go-spew/spew"
|
||||
v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
|
||||
"github.com/juanfont/headscale/hscontrol/policy"
|
||||
"github.com/juanfont/headscale/hscontrol/types"
|
||||
"github.com/juanfont/headscale/hscontrol/util"
|
||||
"github.com/juanfont/headscale/integration/dockertestutil"
|
||||
"github.com/juanfont/headscale/integration/integrationutil"
|
||||
|
@ -173,6 +174,13 @@ func WithPostgres() Option {
|
|||
}
|
||||
}
|
||||
|
||||
// WithIPAllocationStrategy sets the tests IP Allocation strategy.
|
||||
func WithIPAllocationStrategy(strat types.IPAllocationStrategy) Option {
|
||||
return func(hsic *HeadscaleInContainer) {
|
||||
hsic.env["HEADSCALE_PREFIXES_ALLOCATION"] = string(strat)
|
||||
}
|
||||
}
|
||||
|
||||
// WithEmbeddedDERPServerOnly configures Headscale to start
|
||||
// and only use the embedded DERP server.
|
||||
// It requires WithTLS and WithHostnameAsServerURL to be
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue