Chore: rename to iobased

This commit is contained in:
xjasonlyu
2022-01-28 21:10:10 +08:00
parent 3b82a085d7
commit 59f682dfab
3 changed files with 7 additions and 7 deletions

View File

@@ -7,13 +7,13 @@ import (
"os"
"github.com/xjasonlyu/tun2socks/v2/core/device"
"github.com/xjasonlyu/tun2socks/v2/core/device/rwbased"
"github.com/xjasonlyu/tun2socks/v2/core/device/iobased"
)
func open(fd int, mtu uint32) (device.Device, error) {
f := &FD{fd: fd, mtu: mtu}
ep, err := rwbased.New(os.NewFile(uintptr(fd), f.Name()), mtu)
ep, err := iobased.New(os.NewFile(uintptr(fd), f.Name()), mtu)
if err != nil {
return nil, fmt.Errorf("create endpoint: %w", err)
}

View File

@@ -1,6 +1,6 @@
// Package rwbased provides the implementation of io.ReadWriter
// Package iobased provides the implementation of io.ReadWriter
// based data-link layer endpoints.
package rwbased
package iobased
import (
"errors"

View File

@@ -6,13 +6,13 @@ import (
"fmt"
"github.com/xjasonlyu/tun2socks/v2/core/device"
"github.com/xjasonlyu/tun2socks/v2/core/device/rwbased"
"github.com/xjasonlyu/tun2socks/v2/core/device/iobased"
"golang.zx2c4.com/wireguard/tun"
)
type TUN struct {
*rwbased.Endpoint
*iobased.Endpoint
nt *tun.NativeTun
mtu uint32
@@ -39,7 +39,7 @@ func Open(name string, mtu uint32) (device.Device, error) {
}
t.mtu = uint32(_mtu)
ep, err := rwbased.New(t, t.mtu)
ep, err := iobased.New(t, t.mtu)
if err != nil {
return nil, fmt.Errorf("create endpoint: %w", err)
}