Update contrib/mobile for the latest iOS build

This commit is contained in:
Neil Alexander 2023-06-06 22:11:49 +01:00
parent 1420ea5662
commit db9b57c052
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
6 changed files with 73 additions and 13 deletions

View file

@ -15,6 +15,8 @@ void Log(const char *text) {
import "C"
import (
"unsafe"
"github.com/yggdrasil-network/yggdrasil-go/src/tun"
)
type MobileLogger struct {
@ -26,3 +28,13 @@ func (nsl MobileLogger) Write(p []byte) (n int, err error) {
C.Log(cstr)
return len(p), nil
}
func (m *Yggdrasil) TakeOverTUN(fd int32) error {
options := []tun.SetupOption{
tun.FileDescriptor(fd),
tun.InterfaceMTU(m.iprwc.MTU()),
}
var err error
m.tun, err = tun.New(m.iprwc, m.logger, options...)
return err
}