mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-07 01:33:15 +08:00
Chore: rename to iobased
This commit is contained in:
@@ -7,13 +7,13 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
"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) {
|
func open(fd int, mtu uint32) (device.Device, error) {
|
||||||
f := &FD{fd: fd, mtu: mtu}
|
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 {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("create endpoint: %w", err)
|
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.
|
// based data-link layer endpoints.
|
||||||
package rwbased
|
package iobased
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
@@ -6,13 +6,13 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core/device"
|
"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"
|
"golang.zx2c4.com/wireguard/tun"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TUN struct {
|
type TUN struct {
|
||||||
*rwbased.Endpoint
|
*iobased.Endpoint
|
||||||
|
|
||||||
nt *tun.NativeTun
|
nt *tun.NativeTun
|
||||||
mtu uint32
|
mtu uint32
|
||||||
@@ -39,7 +39,7 @@ func Open(name string, mtu uint32) (device.Device, error) {
|
|||||||
}
|
}
|
||||||
t.mtu = uint32(_mtu)
|
t.mtu = uint32(_mtu)
|
||||||
|
|
||||||
ep, err := rwbased.New(t, t.mtu)
|
ep, err := iobased.New(t, t.mtu)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("create endpoint: %w", err)
|
return nil, fmt.Errorf("create endpoint: %w", err)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user