mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Wrap the metadata with a mutex to guarantee thread safety across core/router/sessions
This commit is contained in:
parent
97464feba9
commit
042a3400fe
4 changed files with 40 additions and 14 deletions
|
@ -80,11 +80,6 @@ func GetBuildVersion() string {
|
|||
return buildVersion
|
||||
}
|
||||
|
||||
// Gets the friendly name of this node, as specified in the NodeConfig.
|
||||
func (c *Core) GetMeta() metadata {
|
||||
return c.sessions.myMetadata
|
||||
}
|
||||
|
||||
// Starts up Yggdrasil using the provided NodeConfig, and outputs debug logging
|
||||
// through the provided log.Logger. The started stack will include TCP and UDP
|
||||
// sockets, a multicast discovery socket, an admin socket, router, switch and
|
||||
|
@ -245,6 +240,16 @@ func (c *Core) GetSubnet() *net.IPNet {
|
|||
return &net.IPNet{IP: subnet, Mask: net.CIDRMask(64, 128)}
|
||||
}
|
||||
|
||||
// Gets the node metadata.
|
||||
func (c *Core) GetMetadata() metadata {
|
||||
return c.sessions.getMetadata()
|
||||
}
|
||||
|
||||
// Sets the node metadata.
|
||||
func (c *Core) SetMetadata(meta metadata) {
|
||||
c.sessions.setMetadata(meta)
|
||||
}
|
||||
|
||||
// Sets the output logger of the Yggdrasil node after startup. This may be
|
||||
// useful if you want to redirect the output later.
|
||||
func (c *Core) SetLogger(log *log.Logger) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue