1. added NetworkDomain and default values

This commit is contained in:
vadym 2022-10-30 22:22:56 +02:00
parent 6319d6231b
commit 09d4564282
8 changed files with 40 additions and 0 deletions

View file

@ -39,6 +39,7 @@ type NodeConfig struct {
IfMTU uint64 `comment:"Maximum Transmission Unit (MTU) size for your local TUN interface.\nDefault is the largest supported size for your platform. The lowest\npossible value is 1280."` IfMTU uint64 `comment:"Maximum Transmission Unit (MTU) size for your local TUN interface.\nDefault is the largest supported size for your platform. The lowest\npossible value is 1280."`
NodeInfoPrivacy bool `comment:"By default, nodeinfo contains some defaults including the platform,\narchitecture and RiV-mesh version. These can help when surveying\nthe network and diagnosing network routing problems. Enabling\nnodeinfo privacy prevents this, so that only items specified in\n\"NodeInfo\" are sent back if specified."` NodeInfoPrivacy bool `comment:"By default, nodeinfo contains some defaults including the platform,\narchitecture and RiV-mesh version. These can help when surveying\nthe network and diagnosing network routing problems. Enabling\nnodeinfo privacy prevents this, so that only items specified in\n\"NodeInfo\" are sent back if specified."`
NodeInfo map[string]interface{} `comment:"Optional node info. This must be a { \"key\": \"value\", ... } map\nor set as null. This is entirely optional but, if set, is visible\nto the whole network on request."` NodeInfo map[string]interface{} `comment:"Optional node info. This must be a { \"key\": \"value\", ... } map\nor set as null. This is entirely optional but, if set, is visible\nto the whole network on request."`
NetworkDomain NetworkDomainConfig `comment:"Address prefix used by mesh.\nThe current implementation requires this to be a multiple of 8 bits + 7 bits.4\nNodes that configure this differently will be unable to communicate with each other using IP packets."`
} }
type MulticastInterfaceConfig struct { type MulticastInterfaceConfig struct {
@ -49,6 +50,10 @@ type MulticastInterfaceConfig struct {
Priority uint8 Priority uint8
} }
type NetworkDomainConfig struct {
Prefix [1]byte
}
// NewSigningKeys replaces the signing keypair in the NodeConfig with a new // NewSigningKeys replaces the signing keypair in the NodeConfig with a new
// signing keypair. The signing keys are used by the switch to derive the // signing keypair. The signing keys are used by the switch to derive the
// structure of the spanning tree. // structure of the spanning tree.

View file

@ -3,6 +3,7 @@ package defaults
import "github.com/RiV-chain/RiV-mesh/src/config" import "github.com/RiV-chain/RiV-mesh/src/config"
type MulticastInterfaceConfig = config.MulticastInterfaceConfig type MulticastInterfaceConfig = config.MulticastInterfaceConfig
type NetworkDomainConfig = config.NetworkDomainConfig
var defaultConfig = "" // LDFLAGS='-X github.com/yggdrasil-network/yggdrasil-go/src/defaults.defaultConfig=/path/to/config var defaultConfig = "" // LDFLAGS='-X github.com/yggdrasil-network/yggdrasil-go/src/defaults.defaultConfig=/path/to/config
var defaultAdminListen = "" // LDFLAGS='-X github.com/yggdrasil-network/yggdrasil-go/src/defaults.defaultAdminListen=unix://path/to/sock' var defaultAdminListen = "" // LDFLAGS='-X github.com/yggdrasil-network/yggdrasil-go/src/defaults.defaultAdminListen=unix://path/to/sock'
@ -20,6 +21,9 @@ type platformDefaultParameters struct {
// Multicast interfaces // Multicast interfaces
DefaultMulticastInterfaces []MulticastInterfaceConfig DefaultMulticastInterfaces []MulticastInterfaceConfig
//Network domain
DefaultNetworkDomain NetworkDomainConfig
// TUN // TUN
MaximumIfMTU uint64 MaximumIfMTU uint64
DefaultIfMTU uint64 DefaultIfMTU uint64
@ -52,6 +56,7 @@ func GenerateConfig() *config.NodeConfig {
cfg.InterfacePeers = map[string][]string{} cfg.InterfacePeers = map[string][]string{}
cfg.AllowedPublicKeys = []string{} cfg.AllowedPublicKeys = []string{}
cfg.MulticastInterfaces = defaults.DefaultMulticastInterfaces cfg.MulticastInterfaces = defaults.DefaultMulticastInterfaces
cfg.NetworkDomain = defaults.DefaultNetworkDomain
cfg.IfName = defaults.DefaultIfName cfg.IfName = defaults.DefaultIfName
cfg.IfMTU = defaults.DefaultIfMTU cfg.IfMTU = defaults.DefaultIfMTU
cfg.NodeInfoPrivacy = false cfg.NodeInfoPrivacy = false

View file

@ -19,6 +19,11 @@ func getDefaults() platformDefaultParameters {
{Regex: "bridge.*", Beacon: true, Listen: true}, {Regex: "bridge.*", Beacon: true, Listen: true},
}, },
// Network domain
DefaultNetworkDomain: NetworkDomainConfig{
Prefix: [...]byte{0xfc},
},
// TUN // TUN
MaximumIfMTU: 65535, MaximumIfMTU: 65535,
DefaultIfMTU: 65535, DefaultIfMTU: 65535,

View file

@ -18,6 +18,11 @@ func getDefaults() platformDefaultParameters {
{Regex: ".*", Beacon: true, Listen: true}, {Regex: ".*", Beacon: true, Listen: true},
}, },
// Network domain
DefaultNetworkDomain: NetworkDomainConfig{
Prefix: [...]byte{0xfc},
},
// TUN // TUN
MaximumIfMTU: 32767, MaximumIfMTU: 32767,
DefaultIfMTU: 32767, DefaultIfMTU: 32767,

View file

@ -18,6 +18,11 @@ func getDefaults() platformDefaultParameters {
{Regex: ".*", Beacon: true, Listen: true}, {Regex: ".*", Beacon: true, Listen: true},
}, },
// Network domain
DefaultNetworkDomain: NetworkDomainConfig{
Prefix: [...]byte{0xfc},
},
// TUN // TUN
MaximumIfMTU: 65535, MaximumIfMTU: 65535,
DefaultIfMTU: 65535, DefaultIfMTU: 65535,

View file

@ -18,6 +18,11 @@ func getDefaults() platformDefaultParameters {
{Regex: ".*", Beacon: true, Listen: true}, {Regex: ".*", Beacon: true, Listen: true},
}, },
// Network domain
DefaultNetworkDomain: NetworkDomainConfig{
Prefix: [...]byte{0xfc},
},
// TUN // TUN
MaximumIfMTU: 16384, MaximumIfMTU: 16384,
DefaultIfMTU: 16384, DefaultIfMTU: 16384,

View file

@ -18,6 +18,11 @@ func getDefaults() platformDefaultParameters {
{Regex: ".*", Beacon: true, Listen: true}, {Regex: ".*", Beacon: true, Listen: true},
}, },
// Network domain
DefaultNetworkDomain: NetworkDomainConfig{
Prefix: [...]byte{0xfc},
},
// TUN // TUN
MaximumIfMTU: 65535, MaximumIfMTU: 65535,
DefaultIfMTU: 65535, DefaultIfMTU: 65535,

View file

@ -18,6 +18,11 @@ func getDefaults() platformDefaultParameters {
{Regex: ".*", Beacon: true, Listen: true}, {Regex: ".*", Beacon: true, Listen: true},
}, },
// Network domain
DefaultNetworkDomain: NetworkDomainConfig{
Prefix: [...]byte{0xfc},
},
// TUN // TUN
MaximumIfMTU: 65535, MaximumIfMTU: 65535,
DefaultIfMTU: 65535, DefaultIfMTU: 65535,