mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-21 05:43:59 -07:00
.
This commit is contained in:
parent
70d5da1e2a
commit
536bc59abb
5 changed files with 390 additions and 55 deletions
|
@ -130,6 +130,7 @@ type NetworkLocalSettings struct {
|
|||
type Network struct {
|
||||
node *Node
|
||||
id NetworkID
|
||||
mac MAC
|
||||
tap Tap
|
||||
config NetworkConfig
|
||||
settings NetworkLocalSettings // locked by configLock
|
||||
|
@ -143,6 +144,7 @@ func newNetwork(node *Node, id NetworkID, t Tap) (*Network, error) {
|
|||
n := &Network{
|
||||
node: node,
|
||||
id: id,
|
||||
mac: NewMACForNetworkMember(node.Identity().address, id),
|
||||
tap: t,
|
||||
config: NetworkConfig{
|
||||
ID: id,
|
||||
|
@ -172,6 +174,12 @@ func newNetwork(node *Node, id NetworkID, t Tap) (*Network, error) {
|
|||
// ID gets this network's unique ID
|
||||
func (n *Network) ID() NetworkID { return n.id }
|
||||
|
||||
// MAC returns the assigned MAC address of this network
|
||||
func (n *Network) MAC() MAC { return n.mac }
|
||||
|
||||
// Tap gets this network's tap device
|
||||
func (n *Network) Tap() Tap { return n.tap }
|
||||
|
||||
// Config returns a copy of this network's current configuration
|
||||
func (n *Network) Config() NetworkConfig {
|
||||
n.configLock.RLock()
|
||||
|
@ -179,9 +187,6 @@ func (n *Network) Config() NetworkConfig {
|
|||
return n.config
|
||||
}
|
||||
|
||||
// Tap gets this network's tap device
|
||||
func (n *Network) Tap() Tap { return n.tap }
|
||||
|
||||
// SetLocalSettings modifies this network's local settings
|
||||
func (n *Network) SetLocalSettings(ls *NetworkLocalSettings) { n.updateConfig(nil, ls) }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue