kuoruan / openwrt-frp

Frpc & Frps for OpenWrt
MIT License
623 stars 145 forks source link

k2p #1

Closed mvscode closed 2 years ago

mvscode commented 5 years ago

可以支持下K2p的frpc吗,架构1004k的,大小最好在1500KB左右,谢谢拜托

kuoruan commented 5 years ago

K2P 用 mipsel_24kc 不行吗? 对于大小这个问题,由于 golang 是静态编译,二进制文件带了所有依赖库,所以比较大,不好精简

mvscode commented 5 years ago

K2P 用 mipsel_24kc 不行吗? 对于大小这个问题,由于 golang 是静态编译,二进制文件带了所有依赖库,所以比较大,不好精简

不可以,已经尝试过,失败

kuoruan commented 5 years ago

试试官方的能不能用?https://github.com/fatedier/frp/releases/tag/v0.27.0

Droid-MAX commented 5 years ago

可以用upx来压缩,我想给widora-bit3装frpc,但编译时报错,用widora官方的sdk

ERROR: please fix package/frp/Makefile - see logs/package/frp/dump.txt for details

Makefile:30: /home/icloud/Workspace/openwrt/feeds/packages/lang/golang/golang-package.mk: No such file or directory Package: frpc Submenu: Web Servers/Proxies Version: 0.27.0-1 Depends: +libc +SSP_SUPPORT:libssp +USE_GLIBC:librt +USE_GLIBC:libpthread Conflicts: Menu-Depends: Provides: Build-Depends: golang/host Section: net Category: Network Title: A fast reverse proxy (frpc) Maintainer: Xingwang Liao kuoruan@gmail.com Require-User: frp=7000:frp=7000 Source: frp-0.27.0.tar.gz License: Apache-2.0 LicenseFiles: LICENSE Type: ipkg Description: frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet. As of now, it supports tcp & udp, as well as httpand https protocols, where requests can be forwarded to internal services by domain name.

This package contains the frpc. https://github.com/fatedier/frp Xingwang Liao kuoruan@gmail.com @@

Package: frps Submenu: Web Servers/Proxies Version: 0.27.0-1 Depends: +libc +SSP_SUPPORT:libssp +USE_GLIBC:librt +USE_GLIBC:libpthread Conflicts: Menu-Depends: Provides: Build-Depends: golang/host Section: net Category: Network Title: A fast reverse proxy (frps) Maintainer: Xingwang Liao kuoruan@gmail.com Require-User: frp=7000:frp=7000 Source: frp-0.27.0.tar.gz License: Apache-2.0 LicenseFiles: LICENSE Type: ipkg Description: frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet. As of now, it supports tcp & udp, as well as httpand https protocols, where requests can be forwarded to internal services by domain name.

This package contains the frps. https://github.com/fatedier/frp Xingwang Liao kuoruan@gmail.com @@

Package: golang-github-fatedier-frp-dev Version: 0.27.0-1 Depends: +libc +SSP_SUPPORT:libssp +USE_GLIBC:librt +USE_GLIBC:libpthread Conflicts: Menu-Depends: Provides: Build-Depends: golang/host Section: opt Category: Extra packages Title: A fast reverse proxy (source files) Maintainer: Xingwang Liao kuoruan@gmail.com Source: frp-0.27.0.tar.gz License: Apache-2.0 LicenseFiles: LICENSE Type: ipkg Description: frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet. As of now, it supports tcp & udp, as well as httpand https protocols, where requests can be forwarded to internal services by domain name.

This package provides the source files for frpc/frps. https://github.com/fatedier/frp Xingwang Liao kuoruan@gmail.com @@

make[2]: *** No rule to make target '/home/icloud/Workspace/openwrt/feeds/packages/lang/golang/golang-package.mk'. Stop.

kuoruan commented 5 years ago

@Droid-MAX 需要这个 package https://github.com/openwrt/packages/tree/master/lang/golang

WingLim commented 5 years ago

K2P 用 mipsel_24kc 不行吗? 对于大小这个问题,由于 golang 是静态编译,二进制文件带了所有依赖库,所以比较大,不好精简

我的K2P用的PandoraBox,然后它的是 1004kc 的,安装 mipsel_24k 的话会报错:


Unknown package 'frpc'.
Collected errors:
 * pkg_hash_fetch_best_installation_candidate: Packages for frpc found, but incompatible with the architectures configured
 * opkg_install_cmd: Cannot install package frpc
kuoruan commented 5 years ago

@WingLim

cat /usr/lib/os-release
cat /etc/openwrt_release

贴一下输出内容

mvscode commented 5 years ago

不用,我找到适用于K2P用的PandoraBox,1004kc

Droid-MAX commented 5 years ago

@WingLim 你编译frpc的sdk用的是什么?

WingLim commented 5 years ago

@kuoruan

cat /usr/lib/os-release

cat: can't open '/usr/lib/os-release': No such file or directory

cat /etc/openwrt_release

DISTRIB_ID="PandoraBox" DISTRIB_CODENAME="19.02" DISTRIB_RELEASE="19.02" DISTRIB_VERSION="4802" DISTRIB_REVISION="2019-02-01-git-93f2639a7" DISTRIB_TARGET="ralink/mt7621" DISTRIB_DESCRIPTION="PandoraBox 19.02 2019-02-01-git-93f2639a7" DISTRIB_TAINTS="no-all busybox" DISTRIB_MANUFACTURER="PandoraBox-Team" DISTRIB_MANUFACTURER="http://www.pandorabox.com.cn"

mvscode commented 5 years ago

直接用lintel的Pandorabox里面的sdk,不会报错https://downloads.pangubox.com/pandorabox/

kuoruan commented 5 years ago

@WingLim

opkg print-architecture
WingLim commented 5 years ago

@kuoruan

opkg print-architecture

arch all 1 arch noarch 1 arch mipsel_1004kc_dsp 10

kuoruan commented 5 years ago

@WingLim 你自己试着用潘多拉的 SDK 编译吧,OpenWrt 官方的 SDK 编译不出 mipsel_1004kc_dsp

WingLim commented 5 years ago

@kuoruan 刚刚试了,编译成功而且可用了,谢谢啦~

mvscode commented 5 years ago

@kuoruan 刚刚试了,编译成功而且可用了,谢谢啦~

可以分享下ipk文件吗?我看有什么区别

WingLim commented 5 years ago

@MvsCode http://106.14.126.106/files/openwrt/frpc_0.27.0-1_mipsel_1004kc_dsp.ipk

mvscode commented 5 years ago

@MvsCode http://106.14.126.106/files/openwrt/frpc_0.27.0-1_mipsel_1004kc_dsp.ipk

安装了这个,还要安装luci-app-frpc,才会在页面显示,https://downloads.pangubox.com/pandorabox/19.02/packages/mipsel_1004kc_dsp/base/luci-app-frpc_1.1-2_all.ipk

WingLim commented 5 years ago

@MvsCode 对的,我编译的那个安装之后只是安装 frpc,luci 界面的话更建议作者的https://github.com/kuoruan/luci-app-frpc 个人觉得作者的更好用

Droid-MAX commented 5 years ago

在编译ipk的时候我想用host上的upx给编译好的二进制文件给压缩一下再让它打包成ipk,我该怎么做?

kuoruan commented 5 years ago

@Droid-MAX

define Build/Compile
$(call GoPackage/Build/Compile,-ldflags "-s -w")
    upx --ultra-brute $$(GO_PKG_BUILD_BIN_DIR)/frpc
endef
Droid-MAX commented 5 years ago

编译frpc.ipk时是不是还要额外定义GOOS变量呀?刚才报错不支持的GOARCH mipsle,不应该啊

kuoruan commented 5 years ago

@Droid-MAX 日志贴上来瞅瞅

Droid-MAX commented 5 years ago

make[1]: Entering directory/home/droidmax/workspace/openwrt-sdk' make[2]: Entering directory `/home/droidmax/workspace/openwrt-sdk/package/frp' ( cd /home/droidmax/workspace/openwrt-sdk/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/frp-0.27.0/.go_work/build ; export GOPATH=/home/droidmax/workspace/openwrt-sdk/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/frp-0.27.0/.go_work/build GOCACHE=/home/droidmax/workspace/openwrt-sdk/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/frp-0.27.0/.go_work/cache GOTMPDIR=/home/droidmax/workspace/openwrt-sdk/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/frp-0.27.0/.go_work/tmp GOROOT_FINAL=/usr/lib/go-1.12 CC=ccache_cc CXX=ccache_cxx GOOS=linux GOARCH=mipsle GO386=387 GOARM= GOMIPS=softfloat GOMIPS64= CGO_ENABLED=1 CGO_CFLAGS="-Os -pipe -mno-branch-likely -mtune=24kec -mdsp -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float" CGO_CPPFLAGS="-I/home/droidmax/workspace/openwrt-sdk/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include -I/home/droidmax/workspace/openwrt-sdk/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/include -I/home/droidmax/workspace/openwrt-sdk/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/usr/include -I/home/droidmax/workspace/openwrt-sdk/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/include" CGO_CXXFLAGS="-Os -pipe -mno-branch-likely -mtune=24kec -mdsp -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float" ; echo "Finding targets" ; targets=$(go list github.com/fatedier/frp/cmd/...) ; for pattern in ; do targets=$(echo "$targets" | grep -v "$pattern") ; done ; echo ; if [ "" = 1 ]; then echo "Calling go generate" ; go generate -v -ldflags "-s -w" $targets ; echo ; fi ; if [ "" != 1 ]; then echo "Building targets" ; case mipsle in arm) installsuffix="v" ;; mips|mipsle) installsuffix="softfloat" ;; mips64|mips64le) installsuffix="" ;; esac ; trimpath="all=-trimpath=/home/droidmax/workspace/openwrt-sdk/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/frp-0.27.0/.go_work/build" ; ldflags="all=-linkmode external -extldflags '-L/home/droidmax/workspace/openwrt-sdk/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/lib -L/home/droidmax/workspace/openwrt-sdk/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/lib -L/home/droidmax/workspace/openwrt-sdk/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/usr/lib -L/home/droidmax/workspace/openwrt-sdk/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib'" ; pkg_gcflags="" ; pkg_ldflags="" ; for def in ; do pkg_ldflags="$pkg_ldflags -X $def" ; done ; go install ${installsuffix:+-installsuffix $installsuffix} -gcflags "$trimpath" -asmflags "$trimpath" -ldflags "$ldflags" -v ${pkg_gcflags:+-gcflags "$pkg_gcflags"} ${pkg_ldflags:+-ldflags "$pkg_ldflags"} -ldflags "-s -w" $targets ; retval=$? ; echo ; if [ "$retval" -eq 0 ] && [ -z "$(find /home/droidmax/workspace/openwrt-sdk/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/frp-0.27.0/.go_work/build/bin/linux_mipsle -maxdepth 0 -type d ! -empty 2>/dev/null)" ]; then echo "No binaries were generated, consider adding GO_PKG_SOURCE_ONLY:=1 to Makefile" ; echo ; fi ; echo "Cleaning module download cache (golang/go#27455)" ; go clean -modcache ; echo ; fi ; exit $retval ; ) Finding targets 2019/06/16 18:00:49 unsupported GOARCH mipsle

Building targets 2019/06/16 18:00:49 unsupported GOARCH mipsle

Cleaning module download cache (golang/go#27455) 2019/06/16 18:00:49 unsupported GOARCH mipsle

make[2]: [/home/droidmax/workspace/openwrt-sdk/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/frp-0.27.0/.built] Error 1 make[2]: Leaving directory `/home/droidmax/workspace/openwrt-sdk/package/frp' make[1]: [package/frp/compile] Error 2 make[1]: Leaving directory /home/droidmax/workspace/openwrt-sdk' make: *** [package/frp/compile] Error 2

kuoruan commented 5 years ago

SDK 什么版本

Droid-MAX commented 5 years ago

OpenWrt 15.05.1 ramips mt76x8

kuoruan commented 5 years ago

没用这么低的版本编译过,不行的话也很正常, 官方是支持这个 ARCH 的 https://github.com/openwrt/packages/blob/master/lang/golang/golang-package.mk#L275

Droid-MAX commented 5 years ago

@kuoruan 大佬可以把upx压缩这段代码加进去嘛?

kuoruan commented 5 years ago

我后期会通过选项的方式加进去,而不是直接加进去。