Feature: windows tun more params support

Supported params:

- Name
- MTU
- ComponentID
- Network
This commit is contained in:
xjasonlyu
2021-02-06 16:20:45 +08:00
parent 38b9357469
commit b1700c62f4
3 changed files with 50 additions and 5 deletions

View File

@@ -7,7 +7,6 @@ import (
"strings"
"github.com/xjasonlyu/tun2socks/device"
"github.com/xjasonlyu/tun2socks/device/tun"
"github.com/xjasonlyu/tun2socks/proxy"
)
@@ -22,14 +21,12 @@ func parseDevice(s string, mtu uint32) (device.Device, error) {
return nil, err
}
name := u.Host
driver := u.Scheme
var d device.Device
driver := strings.ToLower(u.Scheme)
switch driver {
case "tun":
d, err = tun.Open(tun.WithName(name), tun.WithMTU(mtu))
d, err = openTUN(u, mtu)
default:
err = fmt.Errorf("unsupported driver: %s", driver)
}