mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-06 17:26:58 +08:00
Feature: support fd device
Experimental support for file descriptor based device, may be used like `fd://3`
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/xjasonlyu/tun2socks/core/device"
|
||||
"github.com/xjasonlyu/tun2socks/core/device/fd"
|
||||
"github.com/xjasonlyu/tun2socks/core/device/tun"
|
||||
"github.com/xjasonlyu/tun2socks/proxy"
|
||||
"github.com/xjasonlyu/tun2socks/proxy/proto"
|
||||
@@ -28,6 +29,8 @@ func parseDevice(s string, mtu uint32) (device.Device, error) {
|
||||
switch driver {
|
||||
case tun.Driver:
|
||||
return tun.Open(name, mtu)
|
||||
case fd.Driver:
|
||||
return fd.Open(name, mtu)
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported driver: %s", driver)
|
||||
}
|
||||
|
Reference in New Issue
Block a user