diff --git a/cmd/headscale/headscale.go b/cmd/headscale/headscale.go index 600b186e..dde1c2e7 100644 --- a/cmd/headscale/headscale.go +++ b/cmd/headscale/headscale.go @@ -7,6 +7,7 @@ import ( "time" "github.com/efekarakus/termcolor" + "github.com/juanfont/headscale" "github.com/juanfont/headscale/cmd/headscale/cli" "github.com/rs/zerolog" "github.com/rs/zerolog/log" @@ -43,7 +44,7 @@ func main() { NoColor: !colors, }) - if err := cli.LoadConfig(""); err != nil { + if err := headscale.LoadConfig(""); err != nil { log.Fatal().Caller().Err(err) } diff --git a/cmd/headscale/headscale_test.go b/cmd/headscale/headscale_test.go index faf55f4c..9ca4a2c3 100644 --- a/cmd/headscale/headscale_test.go +++ b/cmd/headscale/headscale_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/juanfont/headscale/cmd/headscale/cli" + "github.com/juanfont/headscale" "github.com/spf13/viper" "gopkg.in/check.v1" ) @@ -49,7 +49,7 @@ func (*Suite) TestConfigLoading(c *check.C) { } // Load example config, it should load without validation errors - err = cli.LoadConfig(tmpDir) + err = headscale.LoadConfig(tmpDir) c.Assert(err, check.IsNil) // Test that config file was interpreted correctly @@ -63,7 +63,7 @@ func (*Suite) TestConfigLoading(c *check.C) { c.Assert(viper.GetString("tls_letsencrypt_challenge_type"), check.Equals, "HTTP-01") c.Assert(viper.GetStringSlice("dns_config.nameservers")[0], check.Equals, "1.1.1.1") c.Assert( - cli.GetFileMode("unix_socket_permission"), + headscale.GetFileMode("unix_socket_permission"), check.Equals, fs.FileMode(0o770), ) @@ -92,10 +92,10 @@ func (*Suite) TestDNSConfigLoading(c *check.C) { } // Load example config, it should load without validation errors - err = cli.LoadConfig(tmpDir) + err = headscale.LoadConfig(tmpDir) c.Assert(err, check.IsNil) - dnsConfig, baseDomain := cli.GetDNSConfig() + dnsConfig, baseDomain := headscale.GetDNSConfig() c.Assert(dnsConfig.Nameservers[0].String(), check.Equals, "1.1.1.1") c.Assert(dnsConfig.Resolvers[0].Addr, check.Equals, "1.1.1.1") @@ -125,7 +125,7 @@ func (*Suite) TestTLSConfigValidation(c *check.C) { writeConfig(c, tmpDir, configYaml) // Check configuration validation errors (1) - err = cli.LoadConfig(tmpDir) + err = headscale.LoadConfig(tmpDir) c.Assert(err, check.NotNil) // check.Matches can not handle multiline strings tmp := strings.ReplaceAll(err.Error(), "\n", "***") @@ -150,6 +150,6 @@ func (*Suite) TestTLSConfigValidation(c *check.C) { "---\nserver_url: \"http://127.0.0.1:8080\"\ntls_letsencrypt_hostname: \"example.com\"\ntls_letsencrypt_challenge_type: \"TLS-ALPN-01\"", ) writeConfig(c, tmpDir, configYaml) - err = cli.LoadConfig(tmpDir) + err = headscale.LoadConfig(tmpDir) c.Assert(err, check.IsNil) }