mirror of
https://github.com/fumiama/water.git
synced 2026-06-25 06:20:29 +08:00
Simplifies Platform Specific Interface Creation
The interface `Config` object is now passed directly into each creation function in order to more easily use additional options. In addition, the linux and darwin parameters were split to better capture different options for each platform.
This commit is contained in:
@@ -289,14 +289,10 @@ func openDev(config Config) (ifce *Interface, err error) {
|
||||
return nil, errIfceNameNotFound
|
||||
}
|
||||
|
||||
func newTAP(ifName string) (ifce *Interface, err error) {
|
||||
config := defaultConfig()
|
||||
config.DeviceType = TAP
|
||||
func newTAP(config Config) (ifce *Interface, err error) {
|
||||
return openDev(config)
|
||||
}
|
||||
|
||||
func newTUN(ifName string) (ifce *Interface, err error) {
|
||||
config := defaultConfig()
|
||||
config.DeviceType = TUN
|
||||
func newTUN(config Config) (ifce *Interface, err error) {
|
||||
return openDev(config)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user