Git Product home page Git Product logo

ngrok-c's Introduction

ngrok-c

  • the client of ngrok in language C
  • Before compiling, you need to generate the libpolarssl.a static library(via polarssl official website).
  • contact me via email: [email protected]

不会编译的伙伴可以用,hauntek大神写的python版本,https://github.com/hauntek/python-ngrok

openwrt 编译方法。

  • 看教程http://www.jianshu.com/p/8428949d946c
  • 另外还需要在mbedtls-lib子目录中以同样方法修改并执行build.sh,并将编译生成的三个.a静态库文件拷贝至上层目录中

build

ddns.cpp and https.cpp are abandoned

windows

run Build.bat in CLI.

linux

run build.sh instead of makefile

openwrt

run openwrtbuild.sh

tomatoware

openssl

cp Makefile.openssl.static Makefile

make

mbedTLS

Compile and install mbedTLS into tomatoware first, then:

cp Makefile.mbedtls.static Makefile

make

使用说明

命令

ngrok-polarssl -SER[Shost:ngrokd.ngrok.com,Sport:443,Atoken:xxx] -AddTun[Type:http,Lhost:127.0.0.1,Lport:80,Sdname:xxdosgo]

Shost -Server host. //服务器host

Sport -server port. //服务器端口

Atoken -ngrok authtoken. //服务器认证串

type -tcp or http or https. //要映射的类型,tcp,http,https

Lhost -local address. //本地地址,如果是本机直接127.0.0.1

Lport -local port. //本地端口

sdname -Subdomain. //子域名

Hostname -hostname //自定义域名映射

Rport -remote port //远程端口,tcp映射的时候,制定端口使用。

Example

  • ngrokc -SER[Shost:ngrokd.ngrok.com,Sport:443] -AddTun[Type:http,Lhost:127.0.0.1,Lport:80,Sdname:Example]
  • ngrokc -AddTun[Type:http,Lhost:127.0.0.1,Lport:80,Sdname:Example]

You can also register multiple Tunnel, but can only have one of each type.

  • ngrokc -AddTun[Type:http,Lhost:127.0.0.1,Lport:80,Sdname:Example] -AddTun[Type:https,Lhost:127.0.0.1,Lport:81,Sdname:Example1]

2015/7/10更新增加

  • 如,你只要把xx.xxx.org解析到tunnel.mobi,那么访问xx.xxx.org就可以了..比Sdname好。。

ngrokc.exe -SER[Shost:tunnel.mobi,Sport:44433] -AddTun[Type:http,Lhost:127.0.0.1,Lport:80,Hostname:xx.xxx.org] -AddTun[Type:tcp,Lhost:127.0.0.1,Lport:80,Rport:55556]

  • 有空的话增加openssl的支持

  • 感谢981213的makefile文件

  • 感谢maz-1 修复ubuntu下编译bug

2015/7/28更新

  • 增加openssl支持,
  • 如果编译openssl版本,修改config.h文件把define OPENSSL 改为1,
  • 如果编译polarssl版本,修改config.h文件把define OPENSSL 改为0,

2015/8/4

  • make -f Makefile.openssl编译openssl版本
  • make -f Makefile.polarssl编译polarssl版本
  • openssl版本有bug,运行久了会崩溃...慎用。。

2015/10/7

  • 增加PolarSSL v2.0.0++版本兼容

注意如果编译polarssl版本

如果你使用的PolarSSL 版本是v2.0.0及其以上的版本编译,请把config.h文件的define ISMBEDTLS 改为1

2015/10/17

  • 修复内存泄漏
  • 增加编译详细说明
  • 发现bug,路由上CPU偶尔9%,暂未修复。

2015/10/20

  • 大幅减少内存占用
  • 如无重大bug,不更新了。。

2015/11/5

  • 修复没网导致的内存泄漏问题。会导致路由不断重启
  • 增加版本号。

2015/12/8

  • 做些小优化,避免嵌入式设备,栈溢出,主要是嵌入式设备栈内存太小。。多个连接就会导致崩溃。
  • 对了,记得编译的时候用-O2参数,不然这些,优化完全无效。。电脑可以忽略,但是嵌入式设备,记得用,我的8M,20个连接就溢出了。优化以后没测试,感觉没那么脆弱了。。

2015/12/13

  • 修复一个古老的bug,10月份以后的版本都有这问题,如果是,请务必升级到最新版本,加载速度大幅提升。

2015/12/20

  • 关闭。。tcp缓存区。。以修复http连接,保存失败问题。
  • 打开tcp keepalive避免死链问题。
  • 这个版本相对完善,没啥,大问题了。。不更新了。

2015/12/30

  • 修复一个超长url在大端下,无法使用的bug。

2016/3/12

2016/3/29

  • 增加openssl库动态加载,以方便编译openwrt版本。
  • 增加openwrt傻瓜编译教程。
  • 关于需要luci界面的,恩山有大神写了。我提交了。叫luci-app-ngrokc_git-15.290.16504-8c2fd44-1_all.ipk,下载安装好以后把编译好的ngrokc替换/usr/bin/里面的ngrokc,改权限,重启就可以了。。

2016/3/31

  • 修复openssl版本连接不了sslv2服务器问题。

2016/4/4

  • 去掉线程减少内存占用。
  • 修改发送接收缓存区大小,避免阻塞。

2016/04/19

  • 修复一个bug,增大缓存区。
  • 大幅减少CPU消耗,一般10%以下

2016/04/20

  • 修复1.22版本的polarssl下的bug,如果你使用的是ngrokc1.22版本,请更新,那个版本有重大bug,openssl版本没问题。
  • 全部建议到1.24稳定版本。

2016/04/25

-1.25 版本(测试)增加多个通道功能,避免多个进程,可以注册N个通道,如- ngrokc -AddTun[Type:http,Lhost:127.0.0.1,Lport:80,Sdname:Example] -AddTun[Type:http,Lhost:127.0.0.1,Lport:80,Sdname:Example1] -AddTun[Type:http,Lhost:127.0.0.1,Lport:80,Sdname:Example2]

  • 这是一个支持ngrok完全协议的版本。go语言以后可能员生支持mips,这个就没人用了。可能不更新了。

2016/05/2

-1.32稳定版本,修复1.25版本tcp映射出错问题。修复1.25的崩溃bug。

2016/05/11

-1.33版本 修复重连子域名bug。

2016/05/25

-1.37版本 修复一个崩溃bug,建议所有的都升级到这个版本。

2016/07/26

-1.39版本 为了增加自定义cid。其它没用

2016/10/27

-1.40版本 增加password功能支持。

2016/11/26

准备新功能开发,UDP端口映射功能,有没有有兴趣的,一起开发,目前最大的问题在于,我的go语言很烂,别指望官方会加这功能,自己自己动手,又兴趣的加群192182463(QQ群)

2017/1/9

-1.41版本 修复一个网络不好可能导致的内存泄漏问题。

2018/5/7

-1.45版本 增加自定义转发Hostheader功能。用于那些本地会判断host的网站  使用方法-AddTun[Type:http,Lhost:127.0.0.1,Lport:80,Hostheader:localhost]

2019/07/28

-1.53 add support openssl 1.1。

2019/11/2

-1.54 add support http basic auth。 Example -AddTun[Type:http,Lhost:127.0.0.1,Lport:80,Httpauth:"test:test"]

2019/11/2

-1.54 add support http basic auth。 Example -AddTun[Type:http,Lhost:127.0.0.1,Lport:80,Httpauth:"test:test"]

2021/8/31

-1.55 add support local tls。 Example -AddTun[Type:https,Lhost:127.0.0.1,Lport:443,Ltls:1]

关于编译对应路由的版本的ngrokc。

一。去http://downloads.openwrt.org/下载你路由对应的SDK版本 ,如OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2,并且解压。

二.需要先编译polarssl或者openssl库(取决你想用啥库,2选1)。

  • 1.编译polarssl库
    • https://tls.mbed.org/download-archive下载,polarssl版本,然后解压
    • 再把buildlib.sh复制进去,并且修改export STAGING_DIR export PATH,把里面的路径改成你下载的SDK,所在的目录,注意是staging_dir目录对应STAGING_DIR,bin目录对应PATH。
    • 还得修改CC=mips-openwrt-linux-gcc CXX=mips-openwrt-linux-g++ AR=mips-openwrt-linux-ar RANLIB=mips-openwrt-linux-ranlib,把这些参数分别对应你的,编译器。名称。。
    • 然后执行,buildlib.sh
    • 如果一切顺利的话,就会在library目录下生成,2.0版本(libmbedtls.a libmbedcrypto.a libmbedx5.9.a)1.3版本(libpolarssl.a)
    • 这就编译好了polarssl库。
  • 2.编译 openssl库
    • https://www.openssl.org/source/ 下载openssl,然后解压。
    • 再把buildlib.sh复制进去,并且修改export STAGING_DIR export PATH,把里面的路径改成你下载的SDK,所在的目录,注意是staging_dir目录对应STAGING_DIR,bin目录对应PATH。
    • 然后执行,buildlib.sh
    • 如果一切顺利的话,就会在当前目录下生成,libssl.a,libcrypto.a
    • 这就编译好了openssl库库。

三.编译ngrokc

  • 1.openssl版本

    • 把下载的openssl里面的include/openssl,文件夹复制到,你SDK里面的staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/include里面,(可能根据SDK路径有所不同)。
    • 然后把第二步生成的,libssl.a,libcrypto.a,放到ngrok-c目录。
    • 再修改,ngrok-c里面的config.h,#define OPENSSL 0,改成#define OPENSSL 1;
    • 继续修改openwrtbuild.sh文件export STAGING_DIR export PATH,把里面的路径改成你下载的SDK,所在的目录,注意是staging_dir目录对应STAGING_DIR,bin目录对应PATH。
    • 还有,最后一行的libpolarssl-mips.a改成libssl.a,libcrypto.a.
    • 执行openwrtbuild.sh,就行了。。
    • 就会在build-mips生成ngrokc文件。。你用ssh,上传到路由的/bin目录,并且加入执行权限。。就可以了。。跑了。。
  • 2.polarssl版本 - 把下载的polarssl里面的include/polarssl,或者include/mbedtls 文件夹复制到,你SDK里面的staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/include里面,(可能根据SDK路径有所不同)。 - 然后把第二步生成的,2.0版本(libmbedtls.a libmbedcrypto.a libmbedx5.9.a)1.3版本(libpolarssl.a)放到ngrok-c目录。 - 再修改,ngrok-c里面的config.h,#define OPENSSL 1,改成#define OPENSSL 0,如你的是2.0版本,请ISMBEDTLS 0改成ISMBEDTLS 1,如果是1.3,ISMBEDTLS 0 - 继续修改openwrtbuild.sh文件export STAGING_DIR export PATH,把里面的路径改成你下载的SDK,所在的目录,注意是staging_dir目录对应STAGING_DIR,bin目录对应PATH。 - 还有,最后一行的libpolarssl-mips.a改成2.0版本(libmbedtls.a libmbedcrypto.a libmbedx5.9.a)1.3版本(libpolarssl.a). - 执行openwrtbuild.sh,就行了。。 - 就会在build-mips生成ngrokc文件。。你用ssh,上传到路由的/bin目录,并且加入执行权限。。就可以了。。跑了。。

  • 3.这里用Centos7 编译斐讯K2路由(polarssl库)做个(纯小白)教程

      ###安装相应软件包
      yum install bzip2 gzip git vim wget -y
    
      ###下载并解压SDK(以下没说明的话均默认在/root目录下操作)
      wget http://archive.openwrt.org/chaos_calmer/15.05/ramips/mt7621/OpenWrt-SDK-15.05-ramips-mt7621_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2
      tar jxvf OpenWrt-SDK-15.05.1-ramips-mt7621_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2
    
      ###文件夹名字太长,改个名字....
      mv OpenWrt-SDK-15.05.1-ramips-mt7621_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64 op
    
      ###拉取ngrok源码
      git clone https://github.com/dosgo/ngrok-c.git
    
    
      ###开始编译polarsshl库###
      ###下载并解压polarssl
      wget https://tls.mbed.org/download/mbedtls-2.14.1-gpl.tgz&&tar zxvf mbedtls-2.14.1-gpl.tgz
    
      ###复制buildlib.sh文件到polarssl文件夹
      cp /root/ngrok-c/buildlib.sh /root/mbedtls-2.14.1/buildlib.sh
    
      ###修改buildlib.sh
      vim /root/mbedtls-2.14.1/buildlib.sh
    
      ###我这里SDK是这个所以把PATH改成这个
      ###export PATH=$PATH:'/root/op/staging_dir/toolchain-mipsel_1004kc+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin'
      ###export STAGING_DIR="/root/op/staging_dir"
    
      ###下面的SDK编译器名字可以在SDK/bin 下找到,例如:
      ### ls /root/op/staging_dir/toolchain-mipsel_1004kc+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin
      ###看到一些gcc和g++之类的,把名字复制替换掉就行了
    
      ###运行buildlib.sh
      cd /root/mbedtls-2.14.1&&chmod 777 buildlib.sh&&./buildlib.sh
      ###不出意外的话会在library文件夹生成三个文件libmbedcrypto.a,libmbedtls.a,libmbedx509.a
    
      ###把生成的文件复制到ngrok目录下
      cd /root/mbedtls-2.14.1/library
      cp {libmbedcrypto.a,libmbedtls.a,libmbedx509.a} /root/ngrok-c/
    
      ###复制mbedtls文件夹到SDK/include下
      cp -r /root/mbedtls-2.14.1/include/mbedtls /root/op/staging_dir/toolchain-mipsel_1004kc+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/include/
    
      ###修改config.h文件,我们用的是polarssl2.0 所以把 #define OPENSSL 1,改成#define OPENSSL 0;#define ISMBEDTLS 0改成#define ISMBEDTLS 1(其实默认就是1.....)
      vim /root/ngrok-c/config.h
    
      ###修改openwrtbuild.sh里面 SDK路径和编译器,SDK路径上边说了就不再重复,这里的编译器改成上面编译polarssh时buildlib.sh里的那个CXX的值
      ###我这里是CXX=mipsel-openwrt-linux-g++,所以openwrtbuild.sh的CC=mipsel-openwrt-linux-g++
      vim /root/ngrok-c/openwrtbuild.sh
      ###修改CC=mipsel-openwrt-linux-g++,保存退出
      cd /root/ngrok-c/
      chmod 777 openwrtbuild.sh&&./openwrtbuild.sh
    
      ###执行完openwrtbuild.sh如果没有提示erroe的话就行了。。。
    
      ###然后会在build-mips生成ngrokc文件。。你用ssh,上传到路由的/bin目录,并且加入执行权限
      ###下面在SSH连接到路由后的操作
      ###记得安装,libstdcpp.ipk,官网有下载,我这个SDK对应的下载地址是
      wget http://archive.openwrt.org/chaos_calmer/15.05/ramips/mt7621/packages/base/libstdcpp_4.8-linaro-1_ramips_1004kc.ipk
      ###安装
      opkg install libstdcpp_4.8-linaro-1_ramips_1004kc.ipk
      安装完就可以用了。。。。。
      (小声BB:作者很有耐心,纯小白问一下很愚蠢的问题他都会耐心解答,哈哈,再次感谢dosgo)
    

四.简单编译ngrokc。

  1. 去http://downloads.openwrt.org/下载你路由对应的SDK版本 ,如OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2,并且解压。
  2.编辑openwrtbuildv2.sh 修改export STAGING_DIR export PATH,把里面的路径改成你下载的SDK。
  3. 把openssl.zip解压到你的下载的sdk,/xxx/OpenWrt-SDK/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/include目录下,
  4. 运行编辑openwrtbuildv2.sh,就会在build-mips生成一个叫ngrokc的文件。成功了。。把它复制到bin目录。就可以运行ngrokc了。
  5.记得安装,libopenssl.ipk,官网有下载。

五.zig交叉编译ngrokc。

  1. 去https://ziglang.org/download/下载zig编译器并且安装好,
  2. 修改crossbuild.bat文件的TARGET=mipsel-linux-musl改成你的平台。
  3. 运行crossbuild.bat就会在当前目录生成编译文件。
  4. 记得安装,libopenssl.ipk,官网有下载。

编译就这样了,以后请不要邮件问我怎么编译了,有bug可以联系。

现在tunnel.mobi不能用了。。,哪里还有国内的服务器的。。

ngrok-c's People

Contributors

981213 avatar auslin45 avatar b4yuan avatar bootlee-wh avatar bryant1410 avatar dosgo avatar marwahaha avatar maz-1 avatar mzer0-yu avatar onlyjinx avatar rampagex avatar timgates42 avatar ugxhdhlwdxm avatar wjchen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ngrok-c's Issues

openssl的makefile少编译了一个文件,openwrt编译会出错

makefile里少编译了一个文件,参考openwrtbuildv2.sh就知道少了openssldl.o,makefile改成
CC?=gcc
CXX?=g++
CFLAGS+=-fexceptions -DOPENSSL=1 -O2
CXXFLAGS=-fexceptions -DOPENSSL=1 -O2
LIBS=sendmsg.o openssldl.o cJSON.o nonblocking.o sslbio.o ngrok.o main.o
all:: ngrokc $(LIBS)
ngrokc: $(LIBS)
$(CXX) -s $(LIBS) -o ngrokc -lpthread -lssl -lcrypto
sendmsg.o: sendmsg.h
openssldl.o: openssldl.h
cJSON.o: cJSON.h
nonblocking.o: nonblocking.h
sslbio.o: sslbio.h
ngrok.o: ngrok.h
main.o: sendmsg.h openssldl.h sslbio.h ngrok.h cJSON.h bytestool.h nonblocking.h

clean:
rm -f $(LIBS) ngrokc
编译通过,请大神修正一下

lib是否有错?编译windows版本时。

F:\XXX\ngrok-c-1.37-2016-5-25->g++ -s build-win32\main.o build-win32\sendmsg.o build-win32\ngrok.o build-win32\cJSON.o build-win32\nonblocking.o build-win32\sslbio.o -o build-win32\ngrokc.exe libpolarssl-win32.a -lws2_32 -lpthread
build-win32\main.o:main.cpp:(.text+0x4e2): undefined reference to SslWrite' build-win32\main.o:main.cpp:(.text.startup+0xa4): undefined reference to AbreSSL()'
D:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: build-win32\main.o: bad reloc address 0xa4 in section `.text.startup'

请问linux服务端能编译吗

我编译的原版ngrok服务端,它是证书编译的,没有toke功能,所以ngrokc连不上。
请问有办法解决证书认证问题吗?或者有没有带toke功能的服务端,我想自己架设服务器。
感谢您

貌似不支持openssl 1.1版本,能否加入

first,非常棒的项目!小巧精悍,各个平台都可以使用,Thanks for sharing ~~

貌似ngrok-c 不支持openssl 1.1版本,而且在openssl 1.1的环境下运行也会报错

ngrokc v1.48-(2019/01/23)
OpenSSL init fail.
Please check if the OpenSSL is installed.
OPENSSL_add_all_algorithms not found.

由于 OpenSSL 1.0 到 1.1 API有很大的变化,导致很多APP不兼容,可能ngrokc也不支持?

于是验证了一下(以下测试在 x64 系统下进行):

ngrokc 运行时,调用ssl库时是优先寻找 libssl.so 和 libcrypto.so, 然后才是 1.0版本的so

## file openssldl.cpp
 ssl_handle1 = dlopen("libssl.so", RTLD_LAZY);  
    if (ssl_handle1 == 0)
        ssl_handle1 = dlopen("libssl.so.1.0.0", RTLD_LAZY);
    if (ssl_handle1 == 0)
        return "Erro ao carregar libssl.so";
    ssl_handle2 = dlopen("libcrypto.so", RTLD_LAZY);
    if (ssl_handle2 == 0)
    ssl_handle2 = dlopen("libcrypto.so.1.0.0", RTLD_LAZY);
    if (ssl_handle2 == 0)
    {
        dlclose(ssl_handle1);
        ssl_handle1 = 0;
        return "Erro ao carregar libcrypto.so";
    }

而我当前系统同时存在 openssl 1.0和1.1(1.1是后来安装的)

libssl.so 及 libcrypto.so 均是指向最新的1.1版本

# ls -l /usr/lib/libssl.so*
lrwxrwxrwx 1 root root     13  6月 22 10:06 /usr/lib/libssl.so -> libssl.so.1.1
lrwxrwxrwx 1 root root     24  1月 17 2018 /usr/lib/libssl.so.10 -> /usr/lib/libssl.so.1.0.0
-r-xr-xr-x 1 root root 514670  3月 15 2018 /usr/lib/libssl.so.1.0.0
-rwxr-xr-x 1 root root 688857  3月  1 10:37 /usr/lib/libssl.so.1.1

ls -l /usr/lib/libcrypto.so*
lrwxrwxrwx 1 root root      16  6月 22 10:05 /usr/lib/libcrypto.so -> libcrypto.so.1.1
lrwxrwxrwx 1 root root      27  1月 17 2018 /usr/lib/libcrypto.so.10 -> /usr/lib/libcrypto.so.1.0.0
-r-xr-xr-x 1 root root 2668513  3月 15 2018 /usr/lib/libcrypto.so.1.0.0
-rwxr-xr-x 1 root root 3367180  3月  1 10:37 /usr/lib/libcrypto.so.1.1

于是我改动了 openssldl.cpp,让它优先使用 1.0版本的库

## file openssldl.cpp
 ssl_handle1 = dlopen("libssl.so.1.0.0", RTLD_LAZY);         # 这里有改动
    if (ssl_handle1 == 0)
        ssl_handle1 = dlopen("libssl.so.1.0.0", RTLD_LAZY);
    if (ssl_handle1 == 0)
        return "Erro ao carregar libssl.so";
    ssl_handle2 = dlopen("libcrypto.so.1.0.0", RTLD_LAZY);        #  这里有改动
    if (ssl_handle2 == 0)
    ssl_handle2 = dlopen("libcrypto.so.1.0.0", RTLD_LAZY);
    if (ssl_handle2 == 0)
    {
        dlclose(ssl_handle1);
        ssl_handle1 = 0;
        return "Erro ao carregar libcrypto.so";
    }

重新编译,运行正常

ngrokc v1.48-(2019/01/23)
{"Type":"AuthResp","Payload":{"Version":"2","MmVersion":"1.7","ClientId":"7fbd328269da12e9def746d781503778","Error":""}}
{"Type":"ReqProxy","Payload":{}}

报错!!!

lo@lo-virtual-machine:~/ngrok-c$ sh openwrtbuildv2.sh
mkdir: 无法创建目录"build-mips": 文件已存在
openwrtbuildv2.sh: 16: openwrtbuildv2.sh: mips-openwrt-linux-g++: not found
openwrtbuildv2.sh: 17: openwrtbuildv2.sh: mips-openwrt-linux-g++: not found
openwrtbuildv2.sh: 18: openwrtbuildv2.sh: mips-openwrt-linux-g++: not found
openwrtbuildv2.sh: 19: openwrtbuildv2.sh: mips-openwrt-linux-g++: not found
openwrtbuildv2.sh: 20: openwrtbuildv2.sh: mips-openwrt-linux-g++: not found
openwrtbuildv2.sh: 21: openwrtbuildv2.sh: mips-openwrt-linux-g++: not found
openwrtbuildv2.sh: 22: openwrtbuildv2.sh: mips-openwrt-linux-g++: not found
openwrtbuildv2.sh: 23: openwrtbuildv2.sh: mips-openwrt-linux-g++: not found

!/bin/sh

export PATH=$PATH:'/home/lo/sdk/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin'
export STAGING_DIR="/home/lo/sdk/staging_dir"

./build.sh 报错

ubuntu 14.04 64位 gcc4.8.4
执行./build.sh出现以下报错,请问如何解决?

→ ./build.sh 
build/main.o: In function `main':
/root/ngrok-c/main.cpp:174: undefined reference to `AbreSSL()'
build/main.o: In function `sendpack(int, ssl_st*, char const*, int)':
/root/ngrok-c/sendmsg.h:155: undefined reference to `SslWrite'
build/nonblocking.o: In function `openssl_free_info(openssl_info*)':
/root/ngrok-c/sslbio.h:52: undefined reference to `SslShutdown'
/root/ngrok-c/sslbio.h:53: undefined reference to `SslFree'
/root/ngrok-c/sslbio.h:54: undefined reference to `SslCtxFree'
build/sslbio.o: In function `openssl_init_info(int, openssl_info*)':
/root/ngrok-c/sslbio.cpp:10: undefined reference to `SslCtxNew'
/root/ngrok-c/sslbio.cpp:10: undefined reference to `SslMethodV23'
/root/ngrok-c/sslbio.cpp:12: undefined reference to `SslCtxCtrl'
/root/ngrok-c/sslbio.cpp:13: undefined reference to `SslNew'
/root/ngrok-c/sslbio.cpp:16: undefined reference to `SsLSetSession'
/root/ngrok-c/sslbio.cpp:19: undefined reference to `SslSetFd'
/root/ngrok-c/sslbio.cpp:20: undefined reference to `SslSetConnectState'
/root/ngrok-c/sslbio.cpp:23: undefined reference to `SslGetError'
/root/ngrok-c/sslbio.cpp:22: undefined reference to `SslDoHandshake'
/root/ngrok-c/sslbio.cpp:34: undefined reference to `SsLGet1Session'
build/ngrok.o: In function `SslRecv(ssl_st*, char*, int)':
/root/ngrok-c/sslbio.h:30: undefined reference to `SslRead'
/root/ngrok-c/sslbio.h:31: undefined reference to `SslGetError'
build/ngrok.o: In function `sendremote(int, ssl_st*, char const*, int, int)':
/root/ngrok-c/sendmsg.h:99: undefined reference to `SslWrite'
collect2: error: ld returned 1 exit status

ar71xx 编译出错

之前一直用openwrt 15.05 CC 的SDK来编译ngrokc,一直是成功的,但是1.33/1.34/1.35,每次编译都出现:

mkdir: cannot create directory 'build-mips': File exists
./test.sh: 17: ./test.sh: mips-openwrt-linux-g++: not found
./test.sh: 18: ./test.sh: mips-openwrt-linux-g++: not found
./test.sh: 19: ./test.sh: mips-openwrt-linux-g++: not found
./test.sh: 20: ./test.sh: mips-openwrt-linux-g++: not found
./test.sh: 21: ./test.sh: mips-openwrt-linux-g++: not found
./test.sh: 22: ./test.sh: mips-openwrt-linux-g++: not found
./test.sh: 23: ./test.sh: mips-openwrt-linux-g++: not found
./test.sh: 24: ./test.sh: mips-openwrt-linux-g++: not found
mkdir: cannot create directory 'build-mips': File exists
./test.sh: 48: ./test.sh: mips-openwrt-linux-g++: not found
./test.sh: 49: ./test.sh: mips-openwrt-linux-g++: not found
./test.sh: 50: ./test.sh: mips-openwrt-linux-g++: not found
./test.sh: 51: ./test.sh: mips-openwrt-linux-g++: not found
./test.sh: 52: ./test.sh: mips-openwrt-linux-g++: not found
./test.sh: 53: ./test.sh: mips-openwrt-linux-g++: not found
./test.sh: 54: ./test.sh: mips-openwrt-linux-g++: not found

./test.sh: 55: ./test.sh: mips-openwrt-linux-g++: not found

tesh.sh是我vi建立的,也有sudo chmod +x test.sh

各种文件找不到!

qq 20160626214614
怎办
sdk:OpenWrt-SDK-ramips-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2
系统:ubuntu14.04 64位

编译openssl 出错

buildlib.sh文件如下:

export PATH=$PATH:'/home/linux/1/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin'
export STAGING_DIR="/home/linux/1/staging_dir"
CC=mipsel-openwrt-linux-gcc
CXX=mipsel-openwrt-linux-g++
AR=mipsel-openwrt-linux-ar
RANLIB=mipsel-openwrt-linux-ranlib
./Configure no-asm shared --prefix=pwd/../out/openssl linux-mips32
make clean
make
make install

错误信息:
making all in crypto...
make[1]: Entering directory /home/linux/openssl-1.0.2h/crypto' /usr/bin/perl ../util/mkbuildinf.pl "gcc -I. -I.. -I../include -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -mabi=32 -O3 -Wall -DBN_DIV3W" "linux-mips32" >buildinf.h gcc -I. -I.. -I../include -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -mabi=32 -O3 -Wall -DBN_DIV3W -c -o cryptlib.o cryptlib.c gcc: error: unrecognized argument in option '-mabi=32' gcc: note: valid arguments to '-mabi=' are: ms sysv make[1]: *** [cryptlib.o] Error 1 make[1]: Leaving directory/home/linux/openssl-1.0.2h/crypto'
make: *** [build_crypto] Error 1
making all in crypto...
make[1]: Entering directory /home/linux/openssl-1.0.2h/crypto' gcc -I. -I.. -I../include -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -mabi=32 -O3 -Wall -DBN_DIV3W -c -o cryptlib.o cryptlib.c gcc: error: unrecognized argument in option '-mabi=32' gcc: note: valid arguments to '-mabi=' are: ms sysv make[1]: *** [cryptlib.o] Error 1 make[1]: Leaving directory/home/linux/openssl-1.0.2h/crypto'
make: *** [build_crypto] Error 1

断线重连问题

当Sdname含有"."时断线重连后会有问题!
测试发现如果Sdname:abc.bcd
第一次运行一切正常,
访问路由器网址为abc.bcd.XXXX.com
当路由器断线后ngrokc重连后会只会返回abc不是返回的abc.bcd
此时访问路由器的网址则变为abc.XXXX.com

好多memleak。

Sublime+Sublimelinter有一堆leak提示。
路由器的内存本来就少,不能这么浪费吧。。。

centos下编绎bcm63XX openwrt 出错.

运行./openwrtbuildv2.sh

提示
mkdir: cannot create directory `build-mips': File exists
/home/OpenWrt-SDK/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.3.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status

确定 sh里 需要生成的*.o文件已经编绎好.

arm编译出错,求帮助

脚本:
#!/bin/sh
export PATH=$PATH:'/home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin'
export STAGING_DIR="/home/ivan/Lede/1/staging_dir"
DIR=build-arm
mkdir $DIR
rm -rf $DIR/main.o
rm -rf $DIR/cJSON.o
rm -rf $DIR/sendmsg.o
rm -rf $DIR/sslbio.o
rm -rf $DIR/nonblocking.o
rm -rf $DIR/openssldl.o
rm -rf $DIR/ngrokc

CC=arm-openwrt-linux-muslgnueabi-g++
YH="-Wall -fexceptions -DOPENSSL=1 -DOPENSSLDL=1 -O2"
$CC $YH -c $1 sendmsg.cpp -o $DIR/sendmsg.o
$CC $YH -c openssldl.cpp -o $DIR/openssldl.o
$CC $YH -c $1 cJSON.c -o $DIR/cJSON.o
$CC $YH -c $1 main.cpp -o $DIR/main.o
$CC $YH -c $1 nonblocking.cpp -o $DIR/nonblocking.o
$CC $YH -c $1 sslbio.cpp -o $DIR/sslbio.o
$CC $YH -c $1 ngrok.cpp -o $DIR/ngrok.o
$CC -s $DIR/main.o $DIR/cJSON.o $DIR/sendmsg.o $DIR/nonblocking.o $DIR/ngrok.o $DIR/sslbio.o $DIR/openssldl.o -o $DIR/ngrokc -ldl

#buill openssl
#CC=arm-openwrt-linux-gcc
#CXX=arm-openwrt-linux-g++
#AR=arm-openwrt-linux-ar
#RANLIB=arm-openwrt-linux-ranlib
#./Configure no-asm shared --prefix=pwd/../out/openssl linux-mips32
#make
#make install


# 报错内容:
ivan@ubuntu:~/Lede/ngrok-c-master$ sudo ./openwrtbuildv2.sh
mkdir: cannot create directory ‘build-arm’: File exists
/home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin/arm-openwrt-linux-muslgnueabi-g++: 1: /home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin/arm-openwrt-linux-muslgnueabi-g++: Syntax error: word unexpected (expecting ")")
/home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin/arm-openwrt-linux-muslgnueabi-g++: 1: /home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin/arm-openwrt-linux-muslgnueabi-g++: Syntax error: word unexpected (expecting ")")
/home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin/arm-openwrt-linux-muslgnueabi-g++: 1: /home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin/arm-openwrt-linux-muslgnueabi-g++: Syntax error: word unexpected (expecting ")")
/home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin/arm-openwrt-linux-muslgnueabi-g++: 1: /home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin/arm-openwrt-linux-muslgnueabi-g++: Syntax error: word unexpected (expecting ")")
/home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin/arm-openwrt-linux-muslgnueabi-g++: 1: /home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin/arm-openwrt-linux-muslgnueabi-g++: Syntax error: word unexpected (expecting ")")
/home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin/arm-openwrt-linux-muslgnueabi-g++: 1: /home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin/arm-openwrt-linux-muslgnueabi-g++: Syntax error: word unexpected (expecting ")")
/home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin/arm-openwrt-linux-muslgnueabi-g++: 1: /home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin/arm-openwrt-linux-muslgnueabi-g++: Syntax error: word unexpected (expecting ")")
/home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin/arm-openwrt-linux-muslgnueabi-g++: 1: /home/ivan/Lede/1/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-5.4.0_musl-1.1.15_eabi/bin/arm-openwrt-linux-muslgnueabi-g++: Syntax error: word unexpected (expecting ")")

是sdk的问题造成吗? 请问可以帮我编译一个吗?
sdk下载地址:
https://downloads.lede-project.org/snapshots/targets/ipq806x/generic/lede-sdk-ipq806x_gcc-5.4.0_musl-1.1.15_eabi.Linux-x86_64.tar.xz

[email protected]

无法处理HTTPS请求

编译了最新版ngrokc v1.44-(2017/07/25),服务端是Ubuntu 16.04上通过apt-get install ngrok-server安装的,运行时提供了受信的SSL证书

HTTP和TCP channel都能正常使用,但HTTPS始终得不到客户端的数据返回,请问可能是什么原因?

另外,我看到有文章提到需要提供一个config文件,里面配置trust_host_root_certs,但ngrok-c貌似并不支持config文件输入

openwrt 18.06 luci 错误

使用的固件 :openwrt-x86-64-combined-squashfs.img
编译国际的源码:https://github.com/coolsnowwolf/lede
luci版本:src-git luci https://github.com/coolsnowwolf/luci

在使用时出现以下错误:
Sat Oct 27 06:44:58 2018 daemon.err uhttpd[4655]: /usr/lib/lua/luci/dispatcher.lua:509: Failed to execute cbi dispatcher target for entry '/admin/services/ngrokc'.
Sat Oct 27 06:44:58 2018 daemon.err uhttpd[4655]: The called action terminated with an exception:
Sat Oct 27 06:44:58 2018 daemon.err uhttpd[4655]: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/map'.
Sat Oct 27 06:44:58 2018 daemon.err uhttpd[4655]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'cbi/tblsection'.
Sat Oct 27 06:44:58 2018 daemon.err uhttpd[4655]: A runtime error occured: /usr/lib/lua/luci/template.lua:97: Failed to execute template 'ngrokc/overview_value'.
Sat Oct 27 06:44:58 2018 daemon.err uhttpd[4655]: A runtime error occured: /usr/lib/lua/luci/model/uci.lua:221: attempt to call method 'get_all' (a nil value)
Sat Oct 27 06:44:58 2018 daemon.err uhttpd[4655]: stack traceback:
Sat Oct 27 06:44:58 2018 daemon.err uhttpd[4655]: [C]: in function 'assert'
Sat Oct 27 06:44:58 2018 daemon.err uhttpd[4655]: /usr/lib/lua/luci/dispatcher.lua:509: in function 'dispatch'
Sat Oct 27 06:44:58 2018 daemon.err uhttpd[4655]: /usr/lib/lua/luci/dispatcher.lua:127: in function </usr/lib/lua/luci/dispatcher.lua:126>

openwrt ar71xx 无反应

ngrokc -SER[Shost:ngrok.my.domain,Sport:11003] -AddTun[Type:http,Lhost:127.0.0.1, Lport:2,Sdname:ssh]
使用之后
只是会显示

root@OpenWrt:~# ngrokc -SER[Shost:ngrok.sequencer.xyz,Sport:11003] -AddTun[Type:http,Lhost:127.0.0.1,
Lport:2,Sdname:ssh]
ngrokc v1.40-(2016/10/27)

就没有其他的显示了
服务器也没有任何提示
但是如果使用
ngrokc -SER[Shost:ngrok.my.domain,Sport:4443(一个错误的端口)] -AddTun[Type:http,Lhost:127.0.0.1, Lport:2,Sdname:ssh]
则会出现

ngrokc v1.40-(2016/10/27)
connect failed...!
link err

有没有日志功能让我知道发生了啥...
使用
nc -v -w 10 -z ngrok.my.domain 11001-11003
能够提示success

OPENSSL在MT7620平台编译出现问题

1、先编译openssl(buildlib.sh无法成功编译,后修改了Makefile编译成功),CC=mipsel-openwrt-linux-g++,生成了libssl.a和libcrypto.a,拷贝至ngrok-c-master目录。
2、修改openwrtbuild.sh,出现报错,求助!!!谢谢。
main.cpp:(.text+0x57c): warning: gethostbyname is obsolescent, use getnameinfo() instead.
build-mipsel-openssl/ngrok.o: In function ConnectMain(int*, sockaddr_in, ssl_info**, std::string*, std::map<int, sockinfo*, std::less<int>, std::allocator<std::pair<int const, sockinfo*> > >*, char*, char*)': ngrok.cpp:(.text+0x474): undefined reference to ssl_init_info(int*, ssl_info*)'
ngrok.cpp:(.text+0x570): undefined reference to SSL_write' ngrok.cpp:(.text+0x6a0): undefined reference to SSL_shutdown'
ngrok.cpp:(.text+0x6ac): undefined reference to SSL_free' ngrok.cpp:(.text+0x6b8): undefined reference to SSL_CTX_free'
build-mipsel-openssl/ngrok.o: In function CmdSock(int*, sockinfo*, std::map<int, sockinfo*, std::less<int>, std::allocator<std::pair<int const, sockinfo*> > >*, sockaddr_in, std::string*, char*, std::list<TunnelInfo*, std::allocator<TunnelInfo*> >*, std::map<std::string, TunnelReq*, std::less<std::string>, std::allocator<std::pair<std::string const, TunnelReq*> > >*)': ngrok.cpp:(.text+0x1230): undefined reference to SSL_read'
ngrok.cpp:(.text+0x1240): undefined reference to SSL_get_error' ngrok.cpp:(.text+0x15c8): undefined reference to SSL_write'
ngrok.cpp:(.text+0x16ac): undefined reference to SSL_write' build-mipsel-openssl/ngrok.o: In function RemoteSslInit(std::_Rb_tree_iterator<std::pair<int const, sockinfo*> >, sockinfo, std::string&, std::map<int, sockinfo*, std::less, std::allocator<std::pair<int const, sockinfo*> > >)':
ngrok.cpp:(.text+0x17c8): undefined reference to ssl_init_info(int*, ssl_info*)' ngrok.cpp:(.text+0x18a4): undefined reference to SSL_write'
build-mipsel-openssl/ngrok.o: In function LocalToRemote(std::_Rb_tree_iterator<std::pair<int const, sockinfo*> >*, sockinfo*, ssl_info*, std::map<int, sockinfo*, std::less<int>, std::allocator<std::pair<int const, sockinfo*> > >*)': ngrok.cpp:(.text+0x19d4): undefined reference to SSL_write'
build-mipsel-openssl/ngrok.o: In function ConnectLocal(ssl_info*, std::_Rb_tree_iterator<std::pair<int const, sockinfo*> >*, sockinfo*, std::map<int, sockinfo*, std::less<int>, std::allocator<std::pair<int const, sockinfo*> > >*, std::map<std::string, TunnelReq*, std::less<std::string>, std::allocator<std::pair<std::string const, TunnelReq*> > >*)': ngrok.cpp:(.text+0x1ab8): undefined reference to SSL_read'
ngrok.cpp:(.text+0x1ac8): undefined reference to SSL_get_error' build-mipsel-openssl/ngrok.o: In function RemoteToLocal(ssl_info
, sockinfo*, std::_Rb_tree_iterator<std::pair<int const, sockinfo*> >, std::map<int, sockinfo, std::less, std::allocator<std::pair<int const, sockinfo*> > >*)':
ngrok.cpp:(.text+0x1e64): undefined reference to SSL_read' ngrok.cpp:(.text+0x1e74): undefined reference to SSL_get_error'
build-mipsel-openssl/main.o: In function checkping()': main.cpp:(.text+0x358): undefined reference to SSL_write'
build-mipsel-openssl/main.o: In function main': main.cpp:(.text.startup+0xb4): undefined reference to SSL_library_init'
main.cpp:(.text.startup+0xbc): undefined reference to SSL_load_error_strings' main.cpp:(.text.startup+0xc4): undefined reference to OPENSSL_add_all_algorithms_noconf'
build-mipsel-openssl/sendmsg.o: In function SendReqTunnel(int, ssl_st*, char*, char const*, char const*, char const*, int, char*)': sendmsg.cpp:(.text+0x1bc): undefined reference to SSL_write'
build-mipsel-openssl/nonblocking.o: In function clearsock(int, sockinfo*)': nonblocking.cpp:(.text+0xa0): undefined reference to SSL_shutdown'
nonblocking.cpp:(.text+0xac): undefined reference to SSL_free' nonblocking.cpp:(.text+0xb8): undefined reference to SSL_CTX_free'
collect2: error: ld returned 1 exit status

获取DNS失败gethostbyname()

嵌入式设备 应用这个转发模块 当连接的路由器更换/重启,获取dns失败,转发失败?没有相应的判断处理吗?int net_dns( struct sockaddr_in *server_addr, const char *host, int port ) 返回-1!

Compilation error: mbedtls/ssl.h not found

I try to compile the ngrok-c client for my WNDR3800 Router which runs openwrt CC(14.07). I was using the VPS which runs Ubuntu 14.04 for the work. I followed every step you mentioned and still get the error information....Could you please help sort it out? Many thanks.

In file included from sslbio.h:8:0,
from nonblocking.h:21,
from sendmsg.h:4,
from sendmsg.cpp:11:
polarsslbio.h:9:25: fatal error: mbedtls/ssl.h: No such file or directory
#include <mbedtls/ssl.h>
^
compilation terminated.
In file included from sslbio.h:8:0,
from nonblocking.h:21,
from sendmsg.h:4,
from ngrok.h:6,
from main.cpp:33:
polarsslbio.h:9:25: fatal error: mbedtls/ssl.h: No such file or directory
#include <mbedtls/ssl.h>
^
compilation terminated.
In file included from sslbio.h:8:0,
from nonblocking.h:21,
from nonblocking.cpp:1:
polarsslbio.h:9:25: fatal error: mbedtls/ssl.h: No such file or directory
#include <mbedtls/ssl.h>
^
compilation terminated.
In file included from polarsslbio.cpp:4:0:
polarsslbio.h:9:25: fatal error: mbedtls/ssl.h: No such file or directory
#include <mbedtls/ssl.h>
^
compilation terminated.
In file included from sslbio.h:8:0,
from nonblocking.h:21,
from sendmsg.h:4,
from ngrok.h:6,
from ngrok.cpp:13:
polarsslbio.h:9:25: fatal error: mbedtls/ssl.h: No such file or directory
#include <mbedtls/ssl.h>
^
compilation terminated.
mips-openwrt-linux-g++: error: build-mips/main.o: No such file or directory
mips-openwrt-linux-g++: error: build-mips/sendmsg.o: No such file or directory
mips-openwrt-linux-g++: error: build-mips/nonblocking.o: No such file or directory
mips-openwrt-linux-g++: error: build-mips/ngrok.o: No such file or directory
mips-openwrt-linux-g++: error: build-mips/polarsslbio.o: No such file or directory
mips-openwrt-linux-g++: error: libmbedtls.a: No such file or directory
mips-openwrt-linux-g++: error: libmbedx509.a: No such file or directory
mips-openwrt-linux-g++: error: libmbedcrypto.a: No such file or directory

如何编译ngrok-c在ARM11的6410下

我们需要修改openwrtbuildv2.sh文件,将第二行和第三行环境变量环节注释掉,然后将CC改arm-linux-gcc具体如下图所示
image
这种方式最简单!!!!

给作者大神提供个asus-merlin固件编译脚本

!/bin/sh

export PATH=$PATH:'/home/cijliu/work/asuswrt-merlin/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/bin'
export STAGING_DIR="/home/cijliu/work/asuswrt-merlin/release/src-rt-6.x.4708/toolchains"
DIR=build-mips
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/brcm-arm/lib:/usr/local/lib:/usr/lib
mkdir $DIR
rm -rf $DIR/main.o
rm -rf $DIR/cJSON.o
rm -rf $DIR/sendmsg.o
rm -rf $DIR/sslbio.o
rm -rf $DIR/nonblocking.o
rm -rf $DIR/openssldl.o
rm -rf $DIR/ngrokc

CC=arm-brcm-linux-uclibcgnueabi-g++
YH="-Wall -fexceptions -DOPENSSL=1 -DOPENSSLDL=1 -O2"
$CC $YH -c $1 sendmsg.cpp -o $DIR/sendmsg.o
$CC $YH -c openssldl.cpp -o $DIR/openssldl.o
$CC $YH -c $1 cJSON.c -o $DIR/cJSON.o
$CC $YH -c $1 main.cpp -o $DIR/main.o
$CC $YH -c $1 nonblocking.cpp -o $DIR/nonblocking.o
$CC $YH -c $1 sslbio.cpp -o $DIR/sslbio.o
$CC $YH -c $1 ngrok.cpp -o $DIR/ngrok.o
$CC -s $DIR/main.o $DIR/cJSON.o $DIR/sendmsg.o $DIR/nonblocking.o $DIR/ngrok.o $DIR/sslbio.o $DIR/openssldl.o -o $DIR/ngrokc -ldl

搭建好asus-merlin编译环境之后,设置PATH和STAGING_DIR路径,然后从PATH下找到对应路由器版本的CC编译器名称并在本脚本中修改。

另外,大神您提供的简书教程中,忘了提示编译者修改CC编译器那一步了~~~

非常感谢您的工作,让我能用上最新版本的路由器客户端,哈哈

同时多个连接会崩溃,如何差错啊?

自己改了一个纯C的(在ubuntu中运行还算正常)移植到嵌入式系统中,同时有超过5、6个连接时就会崩溃,不知道从哪个方面入手查错。
还有没有人有纯C的ngrok啊?

不支持ipv6?

环境为网件4300v1,OpenWrt CC 15.05.1 r49389,用的ipv6线路,一直刷update dns,域名和线路都是通的,添加hosts也不行,换成ipv4的域名就ok了
root@OpenWrt:~# /root/ngrok/ngrokc -SER[Shost:xxx.com,Sport:11111] -AddTun[Type:http,Lhost:127.0.0.1,Lport:80,Sdname:web] -AddTun[Type:tcp,Lhost:127.0.0.1,Lport:23,Rport:11112]
ngrokc v1.41-(2017/01/09)
update dns
update dns
update dns
update dns
update dns

bcm53xx_gcc-5.4.0_musl 找不到GCC 问题

我这边下载了lede-sdk-17.01.4-bcm53xx_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64.tar.xzngrok-c
并参考Openwrt-Ngrokc编译教程
因为型号不同所以将相应的openwrtbuild2.0.sh修改为

#!/bin/sh
export PATH=$PATH:'/root/lede-sdk-17.01.4-bcm53xx_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64/staging_dir/toolchain-arm_cortex-a9_gcc-5.4.0_musl-1.1.16_eabi/bin'
export STAGING_DIR="/root/lede-sdk-17.01.4-bcm53xx_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64/staging_dir"
DIR=build-mips
mkdir $DIR
rm -rf $DIR/main.o
rm -rf $DIR/cJSON.o
rm -rf $DIR/sendmsg.o
rm -rf $DIR/nonblocking.o
rm -rf $DIR/ngrokc

CC=arm-openwrt-linux-muslgnueabi- #找不到对应的GCC 通过 info.mk找到名称
#CC=arm-openwrt-linux #找不到对应的GCC 通过toolchain-XXXX下目录得到名称
#CC=arm-openwrt-linux-muslgnueabi #找不到对应的GCC 通过toolchain-XXXX下目录得到名称
#CC=mips-openwrt-linux-ar #找不到对应的GCC 通过AR=mips-openwrt-linux-ar 得到名称
YH="-Wall -fexceptions -DOPENSSL=0 -DISMBEDTLS=1 -O2"
$CC $YH -c $1 sendmsg.cpp -o $DIR/sendmsg.o
$CC $YH -c $1 cJSON.c -o $DIR/cJSON.o
$CC $YH -c $1 main.cpp -o $DIR/main.o
$CC $YH -c $1 nonblocking.cpp -o $DIR/nonblocking.o
$CC $YH -c $1 polarsslbio.cpp -o $DIR/polarsslbio.o
$CC $YH -c $1 ngrok.cpp -o $DIR/ngrok.o
$CC -s $DIR/main.o $DIR/cJSON.o $DIR/sendmsg.o $DIR/nonblocking.o $DIR/ngrok.o $DIR/polarsslbio.o libmbedtls.a libmbedx509.a libmbedcrypto.a -o $DIR/ngrokc

#buill openssl
#CC=mips-openwrt-linux-gcc
#CXX=mips-openwrt-linux-g++
#AR=mips-openwrt-linux-ar
#RANLIB=mips-openwrt-linux-ranlib 
#./Configure no-asm shared --prefix=`pwd`/../out/openssl linux-mips32
#make
#make install

分别尝试了4个GCC都无法找到。
不知道是不是缺少了什么东西?
编译系统是Ubuntu 16 64 LTS
info.mk内容

TARGET_CROSS=arm-openwrt-linux-muslgnueabi-
GCC_VERSION=5.4.0
LIBC_TYPE=musl
LIBC_URL=http://www.musl-libc.org/
LIBC_VERSION=1.1.16
LIBC_SO_VERSION=1.1.16

能不能添加上设置Password功能呢

我的服务器有验证Password功能,我看客户端默认是空的,所以只能把服务器的密码设置空才能,能不能添加一个参数,让运行时可以验证Password

无法编译polarssl版本

我自己编译了libpolarssl.a ,但不管是放在工程目录还是建的polarssl目录下都无法编译成功,提示是编译nonblocking.cpp或sslbio时失败,将这些文件中的include<polarssl/xxx>都改为""还是不行,求指导

关于断线重连的问题

我在用ngrok-c的过程中发现,有时ngrok服务器重启或者ngrokd进程死掉后,再启动ngrokd时,发现ngrok-c不能自动重新建立通道,如果正常使用中断网又恢复后,能否自动重连?

能加入自动重连的功能吗?

能加入自动重连的功能吗?
在openwrt下,3G网络
先执行ngrokc,tcp模式,本地端口22
用ifdown 3g关闭网络
10s后开启网络ifup 3g
等待拨号成功
拨号成功后,发现远程通道未恢复

最后给你一个openwrt的编译包。
这个包在放在源码编译目录的packages目录下
或sdk编译目录(packages)下都可以用。
只是放在sdk编译目录下时,需要解除依赖(比如openssl)
或将源码包和packages的feeds中的相关工程包(比如依赖的openssl)
拷贝到sdk的packages目录下即可编译
ngrok-c.tar.gz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.