tun2socks config
[ol] tunnel:
mtu: 9000
socks5:
port: 7890
address: ::1
udp: 'udp'
misc:
task-stack-size: 20480
connect-timeout: 5000
read-write-timeout: 60000
log-file: stderr
log-level: error
limit-nofile: 65535
[/ol]复制代码
PacketTunnelProvider
[ol] let settings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: "254.1.1.1")
settings.mtu = 9000
settings.ipv4Settings = {
let settings = NEIPv4Settings(addresses: ["198.18.0.0"], subnetMasks: ["255.255.0.0"])
settings.includedRoutes = [NEIPv4Route.default()]
return settings
}()
settings.ipv6Settings = {
let settings = NEIPv6Settings(addresses: ["fd6e:a81b:704f:1211::1"], networkPrefixLengths: [64])
settings.includedRoutes = [NEIPv6Route.default()]
return settings
}()
settings.dnsSettings = NEDNSSettings(servers: ["127.0.0.1"])
try await self.setTunnelNetworkSettings(settings)[/ol]复制代码
问题情况
当 socks5 地址为 ::1监听本地起的 socks 服务时,就无法使用,所有的请求到达本地 socks 服务,都无法出去,形成了路由环路 请求超时
使用 *.*.*.* 远程 socks 服务一切正常
GPT 已经是问的想吐了,实在是没有任何的思路,includedRoutes excludedRoutes 都试过,别人的项目参考也看了,无法解决,请各位大佬指点下