mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-29 06:35:07 +03:00
1. implemented network prefix load from config file
This commit is contained in:
parent
c7bca5d212
commit
ff860e71c3
4 changed files with 10 additions and 5 deletions
|
@ -17,7 +17,7 @@ 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 [...]byte{0xfc}
|
||||
return c.config.networkdomain.Prefix
|
||||
}
|
||||
|
||||
// IsValid returns true if an address falls within the range used by nodes in the network.
|
||||
|
|
|
@ -14,6 +14,8 @@ func (c *Core) _applyOption(opt SetupOption) {
|
|||
c.config.nodeinfo = v
|
||||
case NodeInfoPrivacy:
|
||||
c.config.nodeinfoPrivacy = v
|
||||
case NetworkDomain:
|
||||
c.config.networkdomain = v
|
||||
case AllowedPublicKey:
|
||||
pk := [32]byte{}
|
||||
copy(pk[:], v)
|
||||
|
@ -41,4 +43,5 @@ func (a ListenAddress) isSetupOption() {}
|
|||
func (a Peer) isSetupOption() {}
|
||||
func (a NodeInfo) isSetupOption() {}
|
||||
func (a NodeInfoPrivacy) isSetupOption() {}
|
||||
func (a NetworkDomain) isSetupOption() {}
|
||||
func (a AllowedPublicKey) isSetupOption() {}
|
||||
|
|
|
@ -91,9 +91,10 @@ func MaximumMTU() uint64 {
|
|||
|
||||
// Init initialises the TUN module. You must have acquired a Listener from
|
||||
// the Mesh core before this point and it must not be in use elsewhere.
|
||||
func New(rwc *ipv6rwc.ReadWriteCloser, log core.Logger, opts ...SetupOption) (*TunAdapter, error) {
|
||||
func New(core *core.Core, log core.Logger, opts ...SetupOption) (*TunAdapter, error) {
|
||||
tun := &TunAdapter{
|
||||
rwc: rwc,
|
||||
core: core,
|
||||
rwc: ipv6rwc.NewReadWriteCloser(core),
|
||||
log: log,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue