//go:build android
// +build android

package tun

import (
	"github.com/qtgolang/SunnyNet/src/ProcessDrv/tun/Android"
	n2 "net"
)

var dev = Android.NewTun{}

func IsRun() bool {
	return dev.IsRunning
}

func Install() bool {
	return true
}

func SetHandle(Handle func(conn n2.Conn), udpSendReceiveFunc func(Type int, Theoni int64, pid uint32, LocalAddress string, RemoteAddress string, data []byte) []byte, SunnyNetPort int) bool {
	dev.ProxyPort = uint16(SunnyNetPort)
	dev.SetHandle(Handle, udpSendReceiveFunc)
	return true
}
func Run() bool {
	dev.IsRunning = true
	return true
}
func Close() bool {
	dev.IsRunning = false
	return true
}
func Name() string {
	return "tun0"
}

func UnInstall() bool {
	return true
}
func SetFd(fd int) bool {
	go dev.OnTunCreated(fd)
	return true
}
