mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-22 16:07:34 +00:00
Remove unused func, comment out configobject way
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
947e961a3a
commit
96fe6aa3a1
@ -1,16 +1,7 @@
|
|||||||
package hsic
|
package hsic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/netip"
|
|
||||||
"net/url"
|
|
||||||
"os"
|
|
||||||
"path"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/juanfont/headscale"
|
|
||||||
"github.com/rs/zerolog"
|
|
||||||
"tailscale.com/tailcfg"
|
|
||||||
"tailscale.com/types/dnstype"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -18,57 +9,59 @@ const (
|
|||||||
defaultNodeUpdateCheckInterval = time.Second * 10
|
defaultNodeUpdateCheckInterval = time.Second * 10
|
||||||
)
|
)
|
||||||
|
|
||||||
func DefaultConfig() headscale.Config {
|
// TODO(kradalby): This approach doesnt work because we cannot
|
||||||
derpMap, _ := url.Parse("https://controlplane.tailscale.com/derpmap/default")
|
// serialise our config object to YAML or JSON.
|
||||||
|
// func DefaultConfig() headscale.Config {
|
||||||
config := headscale.Config{
|
// derpMap, _ := url.Parse("https://controlplane.tailscale.com/derpmap/default")
|
||||||
Log: headscale.LogConfig{
|
//
|
||||||
Level: zerolog.TraceLevel,
|
// config := headscale.Config{
|
||||||
},
|
// Log: headscale.LogConfig{
|
||||||
ACL: headscale.GetACLConfig(),
|
// Level: zerolog.TraceLevel,
|
||||||
DBtype: "sqlite3",
|
// },
|
||||||
EphemeralNodeInactivityTimeout: defaultEphemeralNodeInactivityTimeout,
|
// ACL: headscale.GetACLConfig(),
|
||||||
NodeUpdateCheckInterval: defaultNodeUpdateCheckInterval,
|
// DBtype: "sqlite3",
|
||||||
IPPrefixes: []netip.Prefix{
|
// EphemeralNodeInactivityTimeout: defaultEphemeralNodeInactivityTimeout,
|
||||||
netip.MustParsePrefix("fd7a:115c:a1e0::/48"),
|
// NodeUpdateCheckInterval: defaultNodeUpdateCheckInterval,
|
||||||
netip.MustParsePrefix("100.64.0.0/10"),
|
// IPPrefixes: []netip.Prefix{
|
||||||
},
|
// netip.MustParsePrefix("fd7a:115c:a1e0::/48"),
|
||||||
DNSConfig: &tailcfg.DNSConfig{
|
// netip.MustParsePrefix("100.64.0.0/10"),
|
||||||
Proxied: true,
|
// },
|
||||||
Nameservers: []netip.Addr{
|
// DNSConfig: &tailcfg.DNSConfig{
|
||||||
netip.MustParseAddr("127.0.0.11"),
|
// Proxied: true,
|
||||||
netip.MustParseAddr("1.1.1.1"),
|
// Nameservers: []netip.Addr{
|
||||||
},
|
// netip.MustParseAddr("127.0.0.11"),
|
||||||
Resolvers: []*dnstype.Resolver{
|
// netip.MustParseAddr("1.1.1.1"),
|
||||||
{
|
// },
|
||||||
Addr: "127.0.0.11",
|
// Resolvers: []*dnstype.Resolver{
|
||||||
},
|
// {
|
||||||
{
|
// Addr: "127.0.0.11",
|
||||||
Addr: "1.1.1.1",
|
// },
|
||||||
},
|
// {
|
||||||
},
|
// Addr: "1.1.1.1",
|
||||||
},
|
// },
|
||||||
BaseDomain: "headscale.net",
|
// },
|
||||||
|
// },
|
||||||
DBpath: "/tmp/integration_test_db.sqlite3",
|
// BaseDomain: "headscale.net",
|
||||||
|
//
|
||||||
PrivateKeyPath: "/tmp/integration_private.key",
|
// DBpath: "/tmp/integration_test_db.sqlite3",
|
||||||
NoisePrivateKeyPath: "/tmp/noise_integration_private.key",
|
//
|
||||||
Addr: "0.0.0.0:8080",
|
// PrivateKeyPath: "/tmp/integration_private.key",
|
||||||
MetricsAddr: "127.0.0.1:9090",
|
// NoisePrivateKeyPath: "/tmp/noise_integration_private.key",
|
||||||
ServerURL: "http://headscale:8080",
|
// Addr: "0.0.0.0:8080",
|
||||||
|
// MetricsAddr: "127.0.0.1:9090",
|
||||||
DERP: headscale.DERPConfig{
|
// ServerURL: "http://headscale:8080",
|
||||||
URLs: []url.URL{
|
//
|
||||||
*derpMap,
|
// DERP: headscale.DERPConfig{
|
||||||
},
|
// URLs: []url.URL{
|
||||||
AutoUpdate: false,
|
// *derpMap,
|
||||||
UpdateFrequency: 1 * time.Minute,
|
// },
|
||||||
},
|
// AutoUpdate: false,
|
||||||
}
|
// UpdateFrequency: 1 * time.Minute,
|
||||||
|
// },
|
||||||
return config
|
// }
|
||||||
}
|
//
|
||||||
|
// return config
|
||||||
|
// }
|
||||||
|
|
||||||
// TODO: Reuse the actual configuration object above.
|
// TODO: Reuse the actual configuration object above.
|
||||||
func DefaultConfigYAML() string {
|
func DefaultConfigYAML() string {
|
||||||
@ -106,17 +99,3 @@ derp:
|
|||||||
|
|
||||||
return yaml
|
return yaml
|
||||||
}
|
}
|
||||||
|
|
||||||
func TempConfigPath(name string, config string) (string, error) {
|
|
||||||
tempDir, err := os.CreateTemp("", name)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = os.WriteFile(path.Join(tempDir.Name(), "config.yaml"), []byte(config), 0644)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
return tempDir.Name(), nil
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user