EbrahimTahernejad / Tun2SocksKit

Tun2Socks Solution for Apple Devices
59 stars 38 forks source link

Problem with iOS #14

Open Alireza1044 opened 2 months ago

Alireza1044 commented 2 months ago

Hi,

Thanks for the wrapper.

I'm trying to use this to forward iPhone's traffic to xray-core using NetworkExtension, however it seems the connection between tun2socks and xray is broken. Could you help me please?

Network settings:

let settings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "254.1.1.1")
settings.mtu = 8500
let ipv4Settings = NEIPv4Settings(addresses: ["198.18.0.1"], subnetMasks: ["255.255.0.0"])
ipv4Settings.includedRoutes = [NEIPv4Route.default()]
settings.ipv4Settings = ipv4Settings
let dns = NEDNSSettings(servers: ["1.1.1.1", "8.8.8.8"])
settings.dnsSettings = dns
settings.proxySettings = nil

tun2socks config:

tunnel:
  mtu: 8500

socks5:
  port: 1081
  address: ::1
  udp: 'udp'

misc:
  task-stack-size: 20480
  connect-timeout: 5000
  read-write-timeout: 60000
  log-file: \(logFile.path(percentEncoded: false))
  log-level: debug
  limit-nofile: 65535

xray intbounds config:

"inbounds" : [
    {
      "port" : 1081,
      "protocol" : "socks",
      "settings" : {
        "auth" : "noauth",
        "udp" : true
      },
      "sniffing" : {
        "destOverride" : [
          "http",
          "tls",
          "quic",
          "fakedns"
        ],
        "enabled" : true,
        "routeOnly" : true
      },
      "tag" : "socks"
    }
  ],

Do you have any idea of where the problem is?

EbrahimTahernejad commented 1 month ago

I'm gonna need some logs brother

houmie commented 1 month ago

That was a problem with previous release 3.6.8, which was pointing to 3.6.9. (mismatch) The latest release 3.7.1 works correctly. Get the latest.

Alireza1044 commented 1 month ago

Thank you both for answering. Release 3.7.1 still has the same issue. Here is Tun2sockKit's logs: log.txt

I haven't configured xray-core's logger. I'll try to provide logs for that in a few days as well.

Alireza1044 commented 1 month ago

Hi,

I have some logs from xray-core. Looks like tun2sockskit tries to connect to xray-core's socks proxy, but is being rejected. Any ideas?

2024/07/16 06:00:32 [Debug] app/log: Logger started
2024/07/16 06:01:12 [Debug] app/proxyman/inbound: creating stream worker on 0.0.0.0:1081
2024/07/16 06:01:16 [Info] transport/internet/tcp: listening TCP on 0.0.0.0:1081
2024/07/16 06:01:22 [Info] transport/internet/udp: listening UDP on 0.0.0.0:1081
2024/07/16 06:01:22 [Warning] core: Xray 1.8.16 started
2024/07/16 06:02:09 [Info] [3249438730] app/proxyman/inbound: connection ends > proxy/socks: failed to read request > proxy/socks: insufficient header > EOF
2024/07/16 06:02:09 tcp:[::1]:54201 rejected  proxy/socks: insufficient header > EOF
2024/07/16 06:02:18 tcp:[::1]:54197 rejected  proxy/socks: insufficient header > EOF
2024/07/16 06:02:21 tcp:[::1]:54200 rejected  proxy/socks: insufficient header > EOF
2024/07/16 06:02:21 tcp:[::1]:54196 rejected  proxy/socks: insufficient header > EOF
2024/07/16 06:02:22 tcp:[::1]:54203 rejected  proxy/socks: insufficient header > EOF
2024/07/16 06:02:27 tcp:[::1]:54204 rejected  proxy/socks: insufficient header > EOF