mirror of
https://github.com/luscis/openlan.git
synced 2025-12-24 11:10:54 +08:00
20 lines
388 B
Go
20 lines
388 B
Go
package network
|
|
|
|
import (
|
|
"github.com/luscis/openlan/pkg/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)
|
|
}
|