xjasonlyu / tun2socks

tun2socks - powered by gVisor TCP/IP stack
https://github.com/xjasonlyu/tun2socks/wiki
GNU General Public License v3.0
2.85k stars 404 forks source link

[Bug] Maybe not a bug: on the ios device, the memory has reached the system limit of 50m #276

Closed swpter closed 11 months ago

swpter commented 11 months ago

Verify steps

Version

2.5.1

What OS are you seeing the problem on?

Other

Description

I compiled a framework with gomobile, and then communicated through fd mode. It runs normally on the machine with the m2 chip, but when it runs on the iPhone and ipad, the system console prompts that the maximum memory of 50m has reached the system limit. This may not be a bug. I just want to ask if there is a solution

CLI or Config

TCPSendBufferSize set to 16k

Logs

the console.app shows the network extension reached the limit of 50m

How to Reproduce

cd engine then gomobile bind -target ios/amd64 -v -o tun2socks.xcframework then use the framework in ios project .

xjasonlyu commented 11 months ago

Yeah, it's not a bug. It's common for using go lib/program on iOS devices.

swpter commented 11 months ago

So, there is no solution on ios devices, right? I will close this issue. By the way, is there a stable solution like this library suitable for ios devices?

xjasonlyu commented 11 months ago

So, there is no solution on ios devices, right? I will close this issue. By the way, is there a stable solution like this library suitable for ios devices?

I guess there are some rust-based alternatives.

swpter commented 11 months ago

Thanks,the good thing is that it runs normally and stably on macos devices with m2 chips. Perhaps in the future, Apple will expand the maximum memory usage of the network extension to a larger or no limit, then this library can be used. looking forward to this day!

xjasonlyu commented 11 months ago

Apple just increased the limit from 15M to 50M last year (or the year before last). So I guess it’s gonna take a while. :-P

swpter commented 11 months ago

15m is too small for network processing. After all, network processing is a high-IO processing process. At the OS level, the memory required by the kernel to process the network is more than 15m. For user mode protocol processing, generally speaking, space is exchanged for time to improve efficiency, and 50m is not enough. It's kind of confusing for Apple to do this