chore: rename DeviceCreator

This commit is contained in:
AkinoKaede
2023-10-22 22:44:27 +01:00
committed by Shelikhoo
parent a3728b6abc
commit 4276ee9464
3 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -16,4 +16,4 @@ type Options struct {
MTU uint32
}
type NewTUNFunc func(Options) (Device, error)
type DeviceCreator func(Options) (Device, error)
+2
View File
@@ -9,6 +9,8 @@ import (
"gvisor.dev/gvisor/pkg/tcpip/transport/udp"
)
type StackOption func(*stack.Stack) error
func CreateStack(_ stack.LinkEndpoint) (*stack.Stack, error) {
s := stack.New(stack.Options{
NetworkProtocols: []stack.NetworkProtocolFactory{
+2 -3
View File
@@ -31,9 +31,8 @@ func (t *TUN) Type() interface{} {
}
func (t *TUN) Start() error {
var newDeviceFunc device.NewTUNFunc
newDeviceFunc = tun.New
device, err := newDeviceFunc(device.Options{
DeviceCreator := tun.New
device, err := DeviceCreator(device.Options{
Name: t.config.Name,
MTU: t.config.Mtu,
})