File: net_interface.go

package info (click to toggle)
golang-github-jackpal-gateway 1.0.16-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 276 kB
  • sloc: sh: 38; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 546 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package gateway

import "net"

// Wrapper for calls into the go "net" library that can be mocked for tests
type interfaceGetter interface {
	InterfaceByName(name string) (*net.Interface, error)
	Addrs(iface *net.Interface) ([]net.Addr, error)
}

// Concrete implementation of above interface
type intefaceGetterImpl struct{}

func (*intefaceGetterImpl) InterfaceByName(name string) (*net.Interface, error) {
	return net.InterfaceByName(name)
}

func (*intefaceGetterImpl) Addrs(iface *net.Interface) ([]net.Addr, error) {
	return iface.Addrs()
}