mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 14:15:06 +03:00
changed NetworkDomain.Prefix format from []byte to string for more conveniant input
This commit is contained in:
parent
f84f0a5f19
commit
3e72a57ec5
9 changed files with 34 additions and 27 deletions
|
@ -43,15 +43,15 @@ type NodeConfig struct {
|
|||
}
|
||||
|
||||
type MulticastInterfaceConfig struct {
|
||||
Regex string
|
||||
Beacon bool
|
||||
Listen bool
|
||||
Port uint16
|
||||
Regex string
|
||||
Beacon bool
|
||||
Listen bool
|
||||
Port uint16
|
||||
Priority uint64 // really uint8, but gobind won't export it
|
||||
}
|
||||
|
||||
type NetworkDomainConfig struct {
|
||||
Prefix [1]byte
|
||||
Prefix string
|
||||
}
|
||||
|
||||
// NewSigningKeys replaces the signing keypair in the NodeConfig with a new
|
||||
|
|
|
@ -4,6 +4,7 @@ package core
|
|||
|
||||
import (
|
||||
"crypto/ed25519"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
// Address represents an IPv6 address in the mesh address range.
|
||||
|
@ -17,7 +18,13 @@ type Subnet [8]byte
|
|||
// The 8th bit of the last byte is used to signal nodes (0) or /64 prefixes (1).
|
||||
// Nodes that configure this differently will be unable to communicate with each other using IP packets, though routing and the DHT machinery *should* still work.
|
||||
func (c *Core) GetPrefix() [1]byte {
|
||||
return c.config.networkdomain.Prefix
|
||||
p, err := hex.DecodeString(c.config.networkdomain.Prefix)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
var prefix [1]byte
|
||||
copy(prefix[:], p[:1])
|
||||
return prefix
|
||||
}
|
||||
|
||||
// IsValid returns true if an address falls within the range used by nodes in the network.
|
||||
|
|
|
@ -35,7 +35,7 @@ type Peer struct {
|
|||
type NodeInfo map[string]interface{}
|
||||
type NodeInfoPrivacy bool
|
||||
type NetworkDomain struct {
|
||||
Prefix [1]byte
|
||||
Prefix string
|
||||
}
|
||||
type AllowedPublicKey ed25519.PublicKey
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ func getDefaults() platformDefaultParameters {
|
|||
},
|
||||
|
||||
// Network domain
|
||||
DefaultNetworkDomain: NetworkDomainConfig{
|
||||
Prefix: [...]byte{0xfc},
|
||||
},
|
||||
DefaultNetworkDomain: NetworkDomainConfig{
|
||||
Prefix: "fc",
|
||||
},
|
||||
|
||||
// TUN
|
||||
MaximumIfMTU: 65535,
|
||||
|
|
|
@ -18,10 +18,10 @@ func getDefaults() platformDefaultParameters {
|
|||
{Regex: ".*", Beacon: true, Listen: true},
|
||||
},
|
||||
|
||||
// Network domain
|
||||
DefaultNetworkDomain: NetworkDomainConfig{
|
||||
Prefix: [...]byte{0xfc},
|
||||
},
|
||||
// Network domain
|
||||
DefaultNetworkDomain: NetworkDomainConfig{
|
||||
Prefix: "fc",
|
||||
},
|
||||
|
||||
// TUN
|
||||
MaximumIfMTU: 32767,
|
||||
|
|
|
@ -18,10 +18,10 @@ func getDefaults() platformDefaultParameters {
|
|||
{Regex: ".*", Beacon: true, Listen: true},
|
||||
},
|
||||
|
||||
// Network domain
|
||||
DefaultNetworkDomain: NetworkDomainConfig{
|
||||
Prefix: [...]byte{0xfc},
|
||||
},
|
||||
// Network domain
|
||||
DefaultNetworkDomain: NetworkDomainConfig{
|
||||
Prefix: "fc",
|
||||
},
|
||||
|
||||
// TUN
|
||||
MaximumIfMTU: 65535,
|
||||
|
|
|
@ -18,10 +18,10 @@ func getDefaults() platformDefaultParameters {
|
|||
{Regex: ".*", Beacon: true, Listen: true},
|
||||
},
|
||||
|
||||
// Network domain
|
||||
DefaultNetworkDomain: NetworkDomainConfig{
|
||||
Prefix: [...]byte{0xfc},
|
||||
},
|
||||
// Network domain
|
||||
DefaultNetworkDomain: NetworkDomainConfig{
|
||||
Prefix: "fc",
|
||||
},
|
||||
|
||||
// TUN
|
||||
MaximumIfMTU: 16384,
|
||||
|
|
|
@ -18,10 +18,10 @@ func getDefaults() platformDefaultParameters {
|
|||
{Regex: ".*", Beacon: true, Listen: true},
|
||||
},
|
||||
|
||||
// Network domain
|
||||
DefaultNetworkDomain: NetworkDomainConfig{
|
||||
Prefix: [...]byte{0xfc},
|
||||
},
|
||||
// Network domain
|
||||
DefaultNetworkDomain: NetworkDomainConfig{
|
||||
Prefix: "fc",
|
||||
},
|
||||
|
||||
// TUN
|
||||
MaximumIfMTU: 65535,
|
||||
|
|
|
@ -20,7 +20,7 @@ func getDefaults() platformDefaultParameters {
|
|||
|
||||
// Network domain
|
||||
DefaultNetworkDomain: NetworkDomainConfig{
|
||||
Prefix: [...]byte{0xfc},
|
||||
Prefix: "fc",
|
||||
},
|
||||
|
||||
// TUN
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue