Closed chengziorange closed 2 years ago
Sounds great, I'll see what I can do.
@chengziorange The unix domain socket created by that API uses DATAGRAM type, right?
I'm not sure but I think it is SOCK_STREAM, because I've seen some code using sendmsg()
and recsmsg()
with the SOCK_STREAM type. Maybe you could look for some C examples of these two api.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days
Comment !
I suddenly realise that since tun2socks supports fd://
as the input device, which means for any socket-based scenarios including the unix domain socket, we can always open the socket and pass its file descriptor as the fd device.
So I don't think that add unix domain socket device support explicitly is necessary now.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days
Is your feature request related to a problem?
87 ,#71
Describe the solution you'd like As it is stated in #71 , unrooted Android device cannot create TUN devices directly, as a result reading from file descriptor is needed. However, subprocess created by JVM doesn't share file descriptor as well. So tun2socks can't read from the fd passed directly by the Android App.
Luckily Android Framework provided a way to share fd between processes. The API
LocalSocket.setFileDescriptorsForSend(fd)
does the job, by create a UNIX domain socket and then send fd through it, using the Linux APIsendmsg
(ref).So I wonder if tun2socks can accept a UNIX socket as parameter of
-device
, and then use the Linux APIrecvmsg
(ref) to get the really readable file descriptor. That would be a great help for Android developing with this awesome project.