Skip to content

[Request] Add TUN inbound as env variable for iOS #112

@fwx

Description

@fwx

Xray-core added TUN inbound support for iOS in this PR:
XTLS/Xray-core#5612

Readme states that:

Set the environment variable xray.tun.fd (or XRAY_TUN_FD) to the fd number before starting Xray. This can be done from Swift/Objective-C or by exposing a Go function via gomobile bindings.

I think we could add this into xray_wrapper.go when xray-core gets a new stable release because lots of iOS clients probably use libXray.

Something like this:

# import few more things:
"os"
"strconv"

...

// SetTunFd sets the TUN file descriptor for iOS.
// Call this BEFORE RunXray/RunXrayFromJSON.
func SetTunFd(fd int32) {
	os.Setenv("XRAY_TUN_FD", strconv.Itoa(int(fd)))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions