mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-06 17:26:58 +08:00
Chore: rename to iobased
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
@@ -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"
|
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user