mirror of
https://github.com/luscis/openlan.git
synced 2025-10-22 08:29:44 +08:00
22 lines
397 B
Go
22 lines
397 B
Go
// +build !windows
|
|
|
|
package network
|
|
|
|
import (
|
|
"github.com/songgao/water"
|
|
)
|
|
|
|
func WaterNew(c TapConfig) (*water.Interface, error) {
|
|
deviceType := water.DeviceType(water.TAP)
|
|
if c.Type == TUN {
|
|
deviceType = water.TUN
|
|
}
|
|
cfg := water.Config{DeviceType: deviceType}
|
|
if c.Name != "" {
|
|
cfg.PlatformSpecificParams = water.PlatformSpecificParams{
|
|
Name: c.Name,
|
|
}
|
|
}
|
|
return water.New(cfg)
|
|
}
|