mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-19 23:24:44 +08:00
Linux: add option to persist TUN device
This commit is contained in:
@@ -8,11 +8,12 @@ import (
|
||||
"github.com/songgao/water"
|
||||
)
|
||||
|
||||
func OpenTunDevice(name, addr, gw, mask string, dnsServers []string) (io.ReadWriteCloser, error) {
|
||||
func OpenTunDevice(name, addr, gw, mask string, dnsServers []string, persist bool) (io.ReadWriteCloser, error) {
|
||||
cfg := water.Config{
|
||||
DeviceType: water.TUN,
|
||||
}
|
||||
cfg.Name = name
|
||||
cfg.Persist = persist
|
||||
tunDev, err := water.New(cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user