Skip to content
This repository has been archived by the owner on May 8, 2023. It is now read-only.

Commit

Permalink
Removed some extra code
Browse files Browse the repository at this point in the history
  • Loading branch information
regner committed Aug 21, 2017
1 parent ebd23ad commit 55af87d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 44 deletions.
8 changes: 1 addition & 7 deletions client/albion_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (apw *albionProcessWatcher) run() {
if ConfigGlobal.ListenDevices != "" {
apw.devices = strings.Split(ConfigGlobal.ListenDevices, ",")
} else {
apw.devices = apw.getDevices()
apw.devices = getAllPhysicalInterface()
log.Debugf("Will listen to these devices: %v", apw.devices)
}
go apw.r.run()
Expand Down Expand Up @@ -95,9 +95,3 @@ func (apw *albionProcessWatcher) updateListeners() {

apw.known = current
}

func (apw *albionProcessWatcher) getDevices() []string {
nIfaces := GetAllPhysicalInterface()

return nIfaces
}
20 changes: 1 addition & 19 deletions client/net_interface_filter_nix_darw.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,8 @@ import (
"github.com/regner/albionmarket-client/log"
)

// Gets the first physical interface based on filter results, ignoring all VM, Loopback and Tunnel interfaces
func GetFirstPhysicalInterface() string {
ifaces, err := net.Interfaces()

if err != nil {
log.Fatal(err)
return ""
}

for _, element := range ifaces {
if element.Flags&net.FlagLoopback == 0 && element.Flags&net.FlagUp == 1 && isPhysicalInterface(element.HardwareAddr.String()) {
return element.Name
}
}

return ""
}

// Gets all physical interfaces based on filter results, ignoring all VM, Loopback and Tunnel interfaces.
func GetAllPhysicalInterface() []string {
func getAllPhysicalInterface() []string {
ifaces, err := net.Interfaces()

if err != nil {
Expand Down
19 changes: 1 addition & 18 deletions client/net_interface_filter_win.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,8 @@ func physicalAddrToString(physAddr [8]byte) string {
return string(buf)
}

// Gets the first physical interface based on filter results, ignoring all VM, Loopback and Tunnel interfaces
func GetFirstPhysicalInterface() string {
aa, _ := adapterAddresses()

for _, pa := range aa {
mac := physicalAddrToString(pa.PhysicalAddress)
name := "\\Device\\NPF_" + bytePtrToString(pa.AdapterName)
var flags uint32 = pa.Flags

if flags&uint32(IF_TYPE_SOFTWARE_LOOPBACK) == 0 && flags&uint32(IfOperStatusUp) == 1 && isPhysicalInterface(mac) {
return name
}
}

return ""
}

// Gets all physical interfaces based on filter results, ignoring all VM, Loopback and Tunnel interfaces.
func GetAllPhysicalInterface() []string {
func getAllPhysicalInterface() []string {
aa, _ := adapterAddresses()

var outInterfaces []string
Expand Down

0 comments on commit 55af87d

Please sign in to comment.