Browse Source

Chore: rename to fdbased

pull/133/head
xjasonlyu 3 years ago
parent
commit
cd5b9e8954
  1. 2
      core/device/fdbased/fd.go
  2. 2
      core/device/fdbased/fd_unix.go
  3. 2
      core/device/fdbased/fd_windows.go
  4. 7
      core/device/fdbased/open_linux.go
  5. 2
      core/device/fdbased/open_others.go
  6. 6
      engine/parse.go

2
core/device/fd/fd.go → core/device/fdbased/fd.go

@ -1,4 +1,4 @@
package fd
package fdbased
const Driver = "fd"

2
core/device/fd/fd_unix.go → core/device/fdbased/fd_unix.go

@ -1,6 +1,6 @@
//go:build !windows
package fd
package fdbased
import (
"fmt"

2
core/device/fd/fd_windows.go → core/device/fdbased/fd_windows.go

@ -1,4 +1,4 @@
package fd
package fdbased
import (
"errors"

7
core/device/fd/open_linux.go → core/device/fdbased/open_linux.go

@ -1,4 +1,4 @@
package fd
package fdbased
import (
"fmt"
@ -12,8 +12,9 @@ func open(fd int, mtu uint32) (device.Device, error) {
f := &FD{fd: fd, mtu: mtu}
ep, err := fdbased.New(&fdbased.Options{
MTU: mtu,
FDs: []int{fd},
FDs: []int{fd},
MTU: mtu,
// TUN only, ignore ethernet header.
EthernetHeader: false,
})
if err != nil {

2
core/device/fd/open_others.go → core/device/fdbased/open_others.go

@ -1,6 +1,6 @@
//go:build !linux && !windows
package fd
package fdbased
import (
"fmt"

6
engine/parse.go

@ -7,7 +7,7 @@ import (
"strings"
"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/proxy"
"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)
switch driver {
case fd.Driver:
return fd.Open(name, mtu)
case fdbased.Driver:
return fdbased.Open(name, mtu)
case tun.Driver:
return tun.Open(name, mtu)
default:

Loading…
Cancel
Save