Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (22 sloc) 479 Bytes
package network
import (
"sync"
)
const NO_CHANNEL = -1
var (
currChannels = make(map[string]int)
currChannelLock = sync.Mutex{}
)
func GetInterfaceChannel(iface string) int {
currChannelLock.Lock()
defer currChannelLock.Unlock()
if curr, found := currChannels[iface]; found {
return curr
}
return NO_CHANNEL
}
func SetInterfaceCurrentChannel(iface string, channel int) {
currChannelLock.Lock()
defer currChannelLock.Unlock()
currChannels[iface] = channel
}
You can’t perform that action at this time.