package masque

import (
	"context"
	"net/netip"
	"time"

	"github.com/sagernet/sing-tun"
	"github.com/sagernet/sing/common/logger"
	N "github.com/sagernet/sing/common/network"
	wgTun "github.com/sagernet/wireguard-go/tun"
)

type Device interface {
	wgTun.Device
	N.Dialer
	Start() error
}

type DeviceOptions struct {
	Context      context.Context
	Logger       logger.ContextLogger
	Handler      tun.Handler
	UDPTimeout   time.Duration
	CreateDialer func(interfaceName string) N.Dialer
	Name         string
	MTU          uint32
	Address      []netip.Prefix
}

func NewDevice(options DeviceOptions) (Device, error) {
	return newStackDevice(options)
}
