kuoruan / luci-app-kcptun

LuCI support for kcptun
Apache License 2.0
316 stars 84 forks source link

arch侦测好像有问题 #40

Closed ghost closed 5 years ago

ghost commented 5 years ago

比如我的是K3,应该用arm版本,事实上也能打开对应的二进制文件。 但是无论是自己放进去/usr/bin还是用这个luci-app-kcptun的自动更新都会显示版本错误有问题。

kuoruan commented 5 years ago

你手动放上去之后,在命令行里边运行一下,能正常跑起来吗?

ghost commented 5 years ago

试过了,没问题,我自己的脚本能跑起来工作。

/usr/bin/kcptun -r 11.22.33.44:55555 -l :12345
2018/12/24 06:13:52 version: 20181114
2018/12/24 06:13:52 initiating key derivation
2018/12/24 06:13:52 listening on: [::]:12345
2018/12/24 06:13:52 encryption: aes
2018/12/24 06:13:52 nodelay parameters: 0 30 2 1
2018/12/24 06:13:52 remote address: 11.22.33.44:55555
2018/12/24 06:13:52 sndwnd: 128 rcvwnd: 512
2018/12/24 06:13:52 compression: true
2018/12/24 06:13:52 mtu: 1350
2018/12/24 06:13:52 datashard: 10 parityshard: 3
2018/12/24 06:13:52 acknodelay: false
2018/12/24 06:13:52 dscp: 0
2018/12/24 06:13:52 sockbuf: 4194304
2018/12/24 06:13:52 keepalive: 10
2018/12/24 06:13:52 conn: 1
2018/12/24 06:13:52 autoexpire: 0
2018/12/24 06:13:52 scavengettl: 600
2018/12/24 06:13:52 snmplog:
2018/12/24 06:13:52 snmpperiod: 60
2018/12/24 06:13:52 quiet: false
2018/12/24 06:13:52 connection: 192.168.2.145:50667 -> 11.22.33.44:55555

如果有需要,我可以配合测试。

kuoruan commented 5 years ago

只是更新的时候有问题吗?能正常运行吗?

获取arch的代码在这里, https://github.com/kuoruan/luci-app-kcptun/blob/0759eaef13/luasrc/model/kcptun.lua#L100

主要取的 uname/usr/lib/os-release /etc/openwrt_release 两个文件

麻烦你贴一下

uname
uname -a

和两个文件的内容,谢谢

ghost commented 5 years ago

运行一切正常

root@OpenWrt:~# uname
Linux

root@OpenWrt:~# uname -a
Linux OpenWrt 4.14.89 #0 SMP Sun Dec 23 17:53:14 2018 armv7l GNU/Linux

root@OpenWrt:~# cat /usr/lib/os-release
NAME="OpenWrt"
VERSION="18.06.1"
ID="openwrt"
ID_LIKE="lede openwrt"
PRETTY_NAME="OpenWrt 18.06.1"
VERSION_ID="18.06.1"
HOME_URL="http://openwrt.org/"
BUG_URL="http://bugs.openwrt.org/"
SUPPORT_URL="http://forum.lede-project.org/"
BUILD_ID="r1085-4fd4aec3"
LEDE_BOARD="bcm53xx/generic"
LEDE_ARCH="arm_cortex-a9"
LEDE_TAINTS="no-all"
LEDE_DEVICE_MANUFACTURER="OpenWrt"
LEDE_DEVICE_MANUFACTURER_URL="http://openwrt.org/"
LEDE_DEVICE_PRODUCT="Generic"
LEDE_DEVICE_REVISION="v0"
LEDE_RELEASE="OpenWrt 18.06.1 r1085-4fd4aec3"

root@OpenWrt:~# cat /etc/openwrt_release
DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='18.06.1'
DISTRIB_TARGET='bcm53xx/generic'
DISTRIB_ARCH='arm_cortex-a9'
DISTRIB_TAINTS='no-all'
DISTRIB_REVISION='R8.1.12 By Lean'
DISTRIB_DESCRIPTION='OpenWrt '
kuoruan commented 5 years ago

再帮忙看看 /proc/diag/model 这个文件

ghost commented 5 years ago

并没有/proc/diag/这个目录 在/proc/里也找不到任何以model为名的文件

kuoruan commented 5 years ago
#!/usr/bin/lua

local nixio = require "nixio"

local arch = nixio.uname().machine

print(string.format("arch: %s", arch))

local file_tree = ""
local sub_version = ""

if arch == "x86_64" then
        file_tree = "amd64"
elseif arch == "ramips" then
        file_tree = "mipsle"
elseif arch == "ar71xx" then
        file_tree = "mips"
elseif arch:match("^i[%d]86$") then
        file_tree = "386"
elseif arch:match("^armv[5-8]") then
        file_tree = "arm"
        sub_version = arch:match("[5-8]")
end

print(string.format("file_tree: %s, sub_version: %s.", file_tree, sub_version))

把这个文件命名为 arch.lua 放任意目录,运行 lua arch.lua 看看输出什么

ghost commented 5 years ago
root@K3N ~# lua arch.lua
arch: armv7l
file_tree: arm, sub_version: 7.
⏎
kuoruan commented 5 years ago

自动检测是没问题的,我估计是解压的时候,选文件的时候有问题,我下来仔细看看