Go! Go! Go! - Moby

This commit is contained in:
Adam Ierymenko 2019-09-20 20:34:31 -07:00
parent 02a6b15e6b
commit b540181990
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
5 changed files with 89 additions and 14 deletions

View file

@ -106,15 +106,26 @@ type NetworkConfig struct {
// Network is a currently joined network
type Network struct {
id NetworkID
config NetworkConfig
configLock sync.RWMutex
tap *Tap
tap Tap
tapLock sync.Mutex
}
// ID gets this network's unique ID
func (n *Network) ID() NetworkID { return n.id }
// Config returns a copy of this network's current configuration
func (n *Network) Config() NetworkConfig {
n.configLock.RLock()
defer n.configLock.RUnlock()
return n.config
}
// Tap gets this network's tap device
func (n *Network) Tap() Tap {
n.tapLock.Lock()
defer n.tapLock.Unlock()
return n.tap
}