mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-06 01:07:03 +08:00
Chore: rename to fdbased
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package fd
|
package fdbased
|
||||||
|
|
||||||
const Driver = "fd"
|
const Driver = "fd"
|
||||||
|
|
@@ -1,6 +1,6 @@
|
|||||||
//go:build !windows
|
//go:build !windows
|
||||||
|
|
||||||
package fd
|
package fdbased
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
@@ -1,4 +1,4 @@
|
|||||||
package fd
|
package fdbased
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
@@ -1,4 +1,4 @@
|
|||||||
package fd
|
package fdbased
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -12,8 +12,9 @@ func open(fd int, mtu uint32) (device.Device, error) {
|
|||||||
f := &FD{fd: fd, mtu: mtu}
|
f := &FD{fd: fd, mtu: mtu}
|
||||||
|
|
||||||
ep, err := fdbased.New(&fdbased.Options{
|
ep, err := fdbased.New(&fdbased.Options{
|
||||||
MTU: mtu,
|
|
||||||
FDs: []int{fd},
|
FDs: []int{fd},
|
||||||
|
MTU: mtu,
|
||||||
|
// TUN only, ignore ethernet header.
|
||||||
EthernetHeader: false,
|
EthernetHeader: false,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
@@ -1,6 +1,6 @@
|
|||||||
//go:build !linux && !windows
|
//go:build !linux && !windows
|
||||||
|
|
||||||
package fd
|
package fdbased
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
@@ -7,7 +7,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/device/fd"
|
"github.com/xjasonlyu/tun2socks/v2/core/device/fdbased"
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/device/tun"
|
"github.com/xjasonlyu/tun2socks/v2/core/device/tun"
|
||||||
"github.com/xjasonlyu/tun2socks/v2/proxy"
|
"github.com/xjasonlyu/tun2socks/v2/proxy"
|
||||||
"github.com/xjasonlyu/tun2socks/v2/proxy/proto"
|
"github.com/xjasonlyu/tun2socks/v2/proxy/proto"
|
||||||
@@ -27,8 +27,8 @@ func parseDevice(s string, mtu uint32) (device.Device, error) {
|
|||||||
driver := strings.ToLower(u.Scheme)
|
driver := strings.ToLower(u.Scheme)
|
||||||
|
|
||||||
switch driver {
|
switch driver {
|
||||||
case fd.Driver:
|
case fdbased.Driver:
|
||||||
return fd.Open(name, mtu)
|
return fdbased.Open(name, mtu)
|
||||||
case tun.Driver:
|
case tun.Driver:
|
||||||
return tun.Open(name, mtu)
|
return tun.Open(name, mtu)
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user