add new interface for init configuration (#15)

This commit is contained in:
Song Gao 2017-01-08 19:29:40 -08:00 committed by GitHub
parent 98078a8ac5
commit 37d6645a51
5 changed files with 109 additions and 0 deletions

16
if_unix.go Normal file
View file

@ -0,0 +1,16 @@
// +build linux darwin
package water
import "errors"
func newDev(config Config) (ifce *Interface, err error) {
switch config.DeviceType {
case TUN:
return newTUN(config.Name)
case TAP:
return newTAP(config.Name)
default:
return nil, errors.New("unknown device type")
}
}