From b804cfc5157fe222517ed7f15f16e5d180bf28f2 Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Wed, 9 Jan 2019 11:23:04 +0200 Subject: [PATCH] Spelling fixes for config.go --- src/config/config.go | 54 +------------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/src/config/config.go b/src/config/config.go index 192b94e5..2c76027e 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -1,16 +1,6 @@ package config -import ( - "encoding/hex" - "fmt" - "math/rand" - "time" - - "github.com/yggdrasil-network/yggdrasil-go/src/crypto" - "github.com/yggdrasil-network/yggdrasil-go/src/defaults" -) - -// NodeConfig defines all configuration values needed to run a signle yggdrasil node +// NodeConfig defines all configuration values needed to run a single yggdrasil node type NodeConfig struct { Listen string `comment:"Listen address for peer connections. Default is to listen for all\nTCP connections over IPv4 and IPv6 with a random port."` AdminListen string `comment:"Listen address for admin connections. Default is to listen for local\nconnections either on TCP/9001 or a UNIX socket depending on your\nplatform. Use this value for yggdrasilctl -endpoint=X. To disable\nthe admin socket, use the value \"none\" instead."` @@ -63,45 +53,3 @@ type TunnelRouting struct { type SwitchOptions struct { MaxTotalQueueSize uint64 `comment:"Maximum size of all switch queues combined (in bytes)."` } - -// Generates default configuration. This is used when outputting the -genconf -// parameter and also when using -autoconf. The isAutoconf flag is used to -// determine whether the operating system should select a free port by itself -// (which guarantees that there will not be a conflict with any other services) -// or whether to generate a random port number. The only side effect of setting -// isAutoconf is that the TCP and UDP ports will likely end up with different -// port numbers. -func GenerateConfig(isAutoconf bool) *NodeConfig { - // Create a new core. - //core := Core{} - // Generate encryption keys. - bpub, bpriv := crypto.NewBoxKeys() - spub, spriv := crypto.NewSigKeys() - // Create a node configuration and populate it. - cfg := NodeConfig{} - if isAutoconf { - cfg.Listen = "[::]:0" - } else { - r1 := rand.New(rand.NewSource(time.Now().UnixNano())) - cfg.Listen = fmt.Sprintf("[::]:%d", r1.Intn(65534-32768)+32768) - } - cfg.AdminListen = defaults.GetDefaults().DefaultAdminListen - cfg.EncryptionPublicKey = hex.EncodeToString(bpub[:]) - cfg.EncryptionPrivateKey = hex.EncodeToString(bpriv[:]) - cfg.SigningPublicKey = hex.EncodeToString(spub[:]) - cfg.SigningPrivateKey = hex.EncodeToString(spriv[:]) - cfg.Peers = []string{} - cfg.InterfacePeers = map[string][]string{} - cfg.AllowedEncryptionPublicKeys = []string{} - cfg.MulticastInterfaces = []string{".*"} - cfg.IfName = defaults.GetDefaults().DefaultIfName - cfg.IfMTU = defaults.GetDefaults().DefaultIfMTU - cfg.IfTAPMode = defaults.GetDefaults().DefaultIfTAPMode - cfg.SessionFirewall.Enable = false - cfg.SessionFirewall.AllowFromDirect = true - cfg.SessionFirewall.AllowFromRemote = true - cfg.SwitchOptions.MaxTotalQueueSize = 4 * 1024 * 1024 - cfg.NodeInfoPrivacy = false - - return &cfg -}