diff --git a/app/tun/device/device.go b/app/tun/device/device.go index 6fb52d2e8..ec4cd0b21 100644 --- a/app/tun/device/device.go +++ b/app/tun/device/device.go @@ -16,4 +16,4 @@ type Options struct { MTU uint32 } -type NewTUNFunc func(Options) (Device, error) +type DeviceCreator func(Options) (Device, error) diff --git a/app/tun/stack.go b/app/tun/stack.go index 2d498d108..a95ed0607 100644 --- a/app/tun/stack.go +++ b/app/tun/stack.go @@ -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{ diff --git a/app/tun/tun.go b/app/tun/tun.go index 1ce8f79e4..6648aae72 100644 --- a/app/tun/tun.go +++ b/app/tun/tun.go @@ -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, })