Code Monkey home page Code Monkey logo

hin2n's Introduction

Hin2n

README | 中文文档

N2N is a VPN project that supports p2p. It was originally developed and open sourced by Luca Deri [email protected], Richard Andrews [email protected] of ntop.org, and Meyerd https://github.com/meyerd continues to do optimization work. Our goal is to provide mobile version support.

gradle API license GitHub release Github All Releases Travis branch

The original n2n supports many platforms, including Windows, Linux, OSX, BSD, OpenWrt, Raspberry Pie, etc., except for mobile phones (non-root). Therefore, we have developed the Hin2n project.

What is Hin2n

  • Hin2n is a mobile VPN app that supports the n2n protocol
  • Hin2n does not need to root your phone
  • Hin2n only supports Android phones for now, iPhone version will be developed in the future
  • Hin2n is currently in continuous development and will gradually provide more complete versions
  • Hin2n now supports all v1/v2s/v2/v3 protocols

Hin2n latest version CHANGELOG

The latest version of Hin2n is available for download at release link.

Hin2n Development Plan

View the development plan at Projects. If you have new features and ideas, you can submit them in Issues, and we will arrange development plans as appropriate. Your concern is our motivation.

Technical principle

  • VPNService

Hin2n is based on Android's native VPNService. It builds a tun virtual network card through VPNService and communicates with supernode and edges.

  • tun2tap

Android only supports tun virtual network card, only support network layer, and n2n requires tap virtual network card, which needs data link layer support. So we simulated the data link layer and ARP protocol.

  • n2n protocol

Hin2n supports the n2n protocol by using the native method of jni to reuse the code of the original n2n project as far as possible.

N2N protocol version

There are four popular versions of the n2n project

About v2s version

The v2s is the renaming of the v2 (also known as v2.1) developed by master Meyerd in the QQ group (5804301), that is, the v2 upgrade version. The v2s version is not compatible with the v2 version developed by the ntop.org masters. To avoid confusion, the QQ group members named the project separately.

Development and compilation

Project Structure

The n2n source code is linked to the hin2n directory via git submodules, which are located into the bundles directory. Hin2n provides the CMakeLists.txt file to build all the supported n2n versions from the corresponding submodule. The submodules actually link a fork of the official n2n source code repositories (e.g. https://github.com/switch-iot/n2n_ntop) in order to guaranteed that the compilation of hin2n always succedes. The ntop v2 fork is a 1:1 copy of the official repository, which will be periodically updated to reflect the upstream changes.

How to compile on Linux

You need to install Java and Android SDK before compile.

  • git clone https://github.com/switch-iot/hin2n.git --depth=1 --recurse-submodules # download source
  • cd hin2n/Hin2n_android # hin2n_android directory is the hin2n project android source directory
  • ./gradlew assemble # compile hin2n (You can compile one of the files by running ./gradlew assembleNormalAllarchDebug). If you are using Android Studio, use "Import Project", then select the Hin2n_android directory and build the app module. The compiled files are in hin2n/Hin2n_android/app/build/outputs/apk/
  • When switching branches, you need to execute git submodule update to synchronize the code of the submodules

How to compile on Windows

You need to install Java and Android SDK before compile, and the git compatible symbolic link needs to be set in the Windows environment.

  • Launch gpedit.msc, and add the account(s) to Computer Configuration/Windows Setting/Security Settings/Local Policies/User Rights Assignment/Create symbolic links
  • Or run git-cmd as an administrator user, and execute the following command
  • git clone -c core.symlinks=true https://github.com/switch-iot/hin2n.git --depth=1 --recurse-submodules && cd hin2n && link.bat
  • cd Hin2n_android # hin2n_android directory is the hin2n project android source directory
  • gradlew assemble # compile hin2n (You can compile one of the files by running gradlew assembleNormalAllarchDebug). If you are using Android Studio, use "Import Project", then select the Hin2n_android directory and build the app module. The compiled files are here: hin2n\Hin2n_android\app\build\outputs\apk\
  • When switching branches, you need to execute git submodule update to synchronize the code of the submodules

About open source agreement

The project is open sourced under the GPLv3 agreement, and is consistent with the original open source agreement of n2n. We also hope that everyone will support and comply with the open source agreement of this project.

Contribute to Hin2n

Hin2n is a free and open source n2n project, and we welcome anyone to contribute to it.

  • Any problems in use can be fed back through Issues
  • Bug fixes can submit Pull Request to android_dev branch
  • If you want to add a new feature, please create an Issues first to describe the new feature, as well as the implementation approach. Once a proposal is accepted, create an implementation of the new features and submit it as a pull request.
  • Sorry for my poor English and improvement for this document is welcome even some typo fix.
  • Welcome to watch the project and give the project a Star!

Thanks

QQ group

  • Hin2n QQ group: 769731491
  • N2N QQ group: 256572040

hin2n's People

Contributors

emanuele-f avatar lucktu avatar oliver0624 avatar ozyb avatar peasoft avatar randomize00 avatar siskai avatar switch-st avatar zhangbz 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

hin2n's Issues

举报侵权使用问题

近日国内有一叫做"世纪星耀联机平台"的游戏盒子应用在手机版上使用了hin2n和其中继
但其并没有将软件开源,甚至使用此软件收取大量"捐赠费用",并在群内侮辱用户
想请问一下这个问题能否通过官方途径解决

so文件缺失

Hin2nApplication类缺少以下so文件 ,麻烦问一下应在哪里下载
System.loadLibrary("slog");
System.loadLibrary("uip.c");
System.loadLibrary("n2n_v2s");
// n2n_v2 is part of edge_v2 due to dependency on the g_status
System.loadLibrary("n2n_v1");
System.loadLibrary("edge_v2s");
System.loadLibrary("edge_v2");
System.loadLibrary("edge_v1");
System.loadLibrary("edge_jni");

Hin2n not working!

Hello i'm using this app on my Huawei Honor 4x running android 6 marshmallow.
i tried v0.5.2 and it did not work! then tried v0.6.0 and nothing changed...
i compiled 'supernode' for my windows 10 computer using vs2013 and i can connect using Edge GUI.
also i connect with the 'edgenode' that i compiled on several linux systems that i have( such as ubuntu kali and raspbian[raspberry pi] ) and they all work fine!
when i connect with Hin2n app a 'key icon' shows up on the notification bar(saying that a vpn is connected).
then, i can ping the ip that i set for my phone from an app on the phone it self and the ping response time is under 1ms !
but i can not ping my phone from any other edgenodes that are connected ...
any idea what is the problem?

Is there still anyone working on this project?

I am wondering this project is suspended? Looks like it is far behind the n2n server side development....

as there are N2N3.0 released and there are two important features for me:

  1. Federation feature and header encryption and supernode selection via --select-mac
  2. static routing parameter using -n CIDR to specify the route

Can anyone help to integrate those features to this Android project? It is highly appericiated. thanks!

填写网关后网络不可用

之前填写网关都能正常运行,最近用的时候发现app卡死了,关闭也得kill掉app才行,然后去掉网关后就可以使用

Provide a simplified mode

Choosing the right protocol version can be challenging for new people. Since only the ntop n2n protocol is actively developed, we should move the other legacy protocols into the advanced section.

建议增加断线自动重连、自动打通指定隧道和指定网络连接后自启功能

建议增加断线自动重连、自动打通指定隧道和指定网络(WIFI、流量或指定的WIFI)连接后自动启动的功能。
断线重连功能主要针对节点网络波动或者supernode不稳定导致连接断开的情况。
另外,建议增加自动打通指定隧道功能。具体情况是,新节点每次连接进n2n网络时,第一次与其中的某节点通信,打通隧道总是需要等待一定的时间,而打通后就不用再等待了,所以最好能根据事先的设定,让APP在连接n2n网络后,自动打通指定的一些节点的隧道(比如用ping的方式向节点发送数据),这样使用体验会好很多。

Some suggestions for hin2n_v0.6.0-rc3

  1. Name: it is recommended to have a default value, such as 2020070701, 2020070702

  2. Recommended version number: v1/v2_2.6/v2_dev/v2_meyerd, when a version is selected, add a comment below indicating where it came from and the reference date. (for example, https://github.com/meyerd/n2n/tree/master/n2n_v1 Cited by 10 Oct 2017. Please do not use such marks: v1.0/v1.3.2/v2.5.0/v2.7.0, these figures are ambiguous)

  3. Encryption: default twofish. the default is compatible with previous versions, so that unfamiliar people don't get it wrong and can connect to other devices

  4. It is recommended that all items have a default value to guide the user to write correctly ( if not, give an example in title). for example, supernode, 1.2.3.4:10086 (Gateway IP address: 192.168.2.0/24:10.0.0.1).

  5. MTU: for meyerd's n2n, using 1400 would result in poor communication, and 1390 would not work either. the maximum I measured was 1387, while the official is 1290, which I found to be too small, is recommended at 1384.

Thank you all!

Rename the protocol versions

The protocol versions v2 / v2s are not very meaningful for people without hin2n background. It would be useful to rename them v2 -> ntop dev n2n, v2s -> meyerd n2n

travis build failed

$ echo y | sdkmanager "lldb;3.1"
Warning: File /home/travis/.android/repositories.cfg could not be loaded.
Error: Failed to find package lldb;3.1
The command "echo y | sdkmanager "lldb;3.1"" failed and exited with 1 during .

image

App在后台时连接会断开

提示错误:

WARNING: Supernode not responding
ERROR: sendto failed (1) Operation not permitted

系统版本:

MIUI12,android10.0

如何在有root权限的情况下,使用n2n cli?

环境/目的

  • 拥有root权限
  • 不需要UI
  • 能够通过CLI启停

已经做过的尝试

输出日志如下:

30/Jun/2022 03:43:56 [edge_utils.c:3168] adding supernode = supernode.ntop.org:7777
30/Jun/2022 03:43:56 [edge.c:1028] WARNING: switching to AES as key was provided
30/Jun/2022 03:43:56 [edge.c:1068] starting n2n edge 3.1.1-40-gcf23457-dirty Jun 30 2022 08:24:48
30/Jun/2022 03:43:56 [edge.c:1074] using compression: none.
30/Jun/2022 03:43:56 [edge.c:1075] using AES cipher.
30/Jun/2022 03:43:56 [edge_utils.c:392] number of supernodes in the list: 1
30/Jun/2022 03:43:56 [edge_utils.c:394] supernode 0 => supernode.ntop.org:7777
30/Jun/2022 03:43:56 [edge.c:1099] use manually set IP address
30/Jun/2022 03:43:56 [edge.c:1217] created local tap device IP: 192.168.100.1, Mask: 255.255.255.0, MAC: DE:3A:4E:84:91:B3
30/Jun/2022 03:43:56 [edge.c:1276] WARNING: n2n has not been compiled with libcap-dev; some commands may fail
30/Jun/2022 03:43:56 [edge.c:1282] dropping privileges to uid=9999, gid=9999
30/Jun/2022 03:43:56 [edge.c:1307] edge started
30/Jun/2022 03:43:56 [edge_utils.c:1160] successfully joined multicast group 224.0.0.68:1968
30/Jun/2022 03:44:00 [edge_utils.c:2527] [OK] edge <<< ================ >>> supernode

猜测原因可能是

  • 原始的VpnService.protect并未调用,因此数据并未实际发送出去
  • 路由表存在问题
    • 通过ip route查看系正常
  • IFF_TAP失败
    • 但相关调用的ioctl并未返回失败

看起来更像是第一种情况,但是仍然不确定。

因此想咨询下各位大佬,当初开发这个项目的时候,应该是经历过一个阶段,在Android设备上,通过root可用,随后再实现的VpnService,以及在应用模拟的Tap设备。那么当初是如何让原版的n2n能够在root Android上直接运行的呢?

感谢各位大佬。

Problems building with Android Studio on Windows

  1. Ran
    git clone https://github.com/switch-iot/n2n_vLTS.git --recurse-submodules
  2. Executed link.bat
  3. Launched Android Studio IDE with NDK and CMake components.
  4. From the IDE Terminal, ran gradlew.bat build

Auto configuration in gradle completes, but CMake fails to find many source files that are, in fact there, and gives "could not determine linker language" errors on folder symlinks.

How is this project built???

Add routes feature

Is there a way to add routes other than the one automatically provided by the choosen IP address?

android29报错

android29,没法设置低版本,因为高版本访问文件系统需要用到android:requestLegacyExternalStorage="true"
JNI DETECTED ERROR IN APPLICATION: fid == null
in call to GetStaticObjectField
from com.xxx.model.EdgeStatus N2NService.getEdgeStatus()

Debug Build doesn't seem to connect to supernode

Looks like the Debug APK won't connect to the supernode. Apparently, only the Release APK can use VPNService. The Debug APK hangs at the access risk warning message first time connect is attempted.

不能使用DHCP

首先,我参照一下两篇教程,在自己的vps上启动supernode和edge,然后部署DHCP服务。
http://www.lucktu.com/archives/786.html
https://bugxia.com/475.html

然后,在自己的PC上启动edge时,原本是通过 -a <本机IP> 参数指定虚拟LAN的IP地址
但是 -a 参数如果写成 -a <dhcp:DHCP服务器IP>,那么就可以通过vps上的DHCP服务自动获取IP
我在自己的PC上已经成功了(如图,我是用的是bug侠制作的n2n启动器,效果和命令行是一样的)
image
image

但是我在Hin2n中使用相同的写法时会提示格式错误。。。
image

我觉得,填在GUI里的东西,就是作为启动进程时的参数,所以从技术上讲,这么填其实可以使用DHCP,结果GUI强制格式检查导致不能这么填?
又或者是Hin2n里的edge在编译时阉割了DHCP,就算这么填也没用?

安卓6.0以上写日志失败

6.0以上创建文件提示没有权限,需求动态申请权限
需要测试下写入目录/storage/sdcard0/wang.switchy.hin2n//sdcard/wang.switchy.hin2n/那个生效,是否不同版本路径不同

External IP is not masked

Great work adding ability to add DNS Server and it eliminated the DNS Leak.

However, my ip address is exposed (Leaking). Would it be possible to hide the ip address? Thanks

Do tests in link below.
https://ipleak.net

Need help with p2p internet configuration

Hello! I am trying to forward all internet traffic from one android device to another, but not sure how to do it correctly. I saw this functionality mentioned in #19 and #9
On each device I added an edge node with specific IP (10.0.0.50 and 10.0.0.51), made sure that there are no connection issues and that I can ping one device from another.
I checked [enable packet forwarding] checkbox on both devices.
I added gateway IP 10.0.0.50 on a device with IP 10.0.0.51 and reconnected both devices
And after this change, device with IP 10.0.0.51 cannot ping any IP on the internet or access any external website
I tried both v2 and v3, different servers, but it seems like result is always the same - no connection. Am I doing something wrong?

Support auto-rotation feature

Question

When I use hin2n on pad, it just support vertical display. But I want to horizontal operate on pad.

Could please support auto-rotation? Thx!!!

Feature

  • Support auto-rotation

App的community的字符串长度无法设置大于15个字符

你好,App的community的字符串长度无法设置大于15个字符
我是用community当做自己搭建服务器的密码,n2n官网也是这么建议的,我设置的community字符会大于15个字符.
windows电脑版的n2n是可以连接成功的,但是App版本无法保存大于15个字符才community.
希望这个功能可以改进一下,谢谢,非常感谢您的辛苦付出.
感谢.

No new release any more?

I am looking forward to there is a new release that support add multiple CIDR:gateway entry, the current gateway option works too weak in feature wise and cannot handle multiple LAN interconnection.... is there anyone WIP?

header encryption support

n2n 2.8 introduced full header encryption (- H option), will hin2n add support for this feature?

The header which contains some metadata like the virtual MAC address of the edge nodes, their IP address and the community name optionally can be encrypted applying -H on the edges.

hin2n_v1.0-rc1版本在华为手机下闪退

app版本是:hin2n_v1.0-rc1
手机型号:荣耀 V10
手机系统是:harmonyos 2.0.0.230
问题表现:app打开先是一片白,然后直接退出.
其他信息:在我的另外一台mate40中有同样的问题.
相关日志:
130|HWBKL:/ $ logcat --pid=12846
--------- beginning of system
05-19 23:55:04.098 12846 12846 D ActivityThread: Attach thread to application
05-19 23:55:04.117 12846 12868 I HwActivityThreadImpl: mSocketName: 03216872-5607-42b8-9b78-be886b787506
05-19 23:55:04.117 12846 12868 I HwActivityThreadImpl: initPreloadedSocked end mPreloadStatus 2
05-19 23:55:04.119 12846 12868 I HwActivityThreadImpl: before connect app.socketName:03216872-5607-42b8-9b78-be886b787506
05-19 23:55:04.128 12846 12846 W ActivityThread: Application wang.switchy.hin2n can be debugged on port 8100...
05-19 23:55:04.134 12846 12869 I ActivityThread: Init compatible state: true
05-19 23:55:04.268 12846 12846 I HwActivityThreadImpl: accept socket mSocketName: 03216872-5607-42b8-9b78-be886b787506
05-19 23:55:04.268 12846 12846 I HwActivityThreadImpl: accept socket end
05-19 23:55:04.268 12846 12868 I HwActivityThreadImpl: connectContinuePreload end mPreloadStatus 3
05-19 23:55:04.268 12846 12846 I HwActivityThreadImpl: acceptPreloadedApplication end mPreloadStatus 3
05-19 23:55:04.462 12846 12846 I ActivityThread: finishPreloaded preloadStatus 3
05-19 23:55:04.462 12846 12846 I ActivityThread: finishPreloaded end preloadStatus 3
05-19 23:55:04.463 12846 12846 I RtgSchedEvent: current pid:12846 AppType:-1
05-19 23:55:04.517 12846 12846 V ActivityThread: callActivityOnCreate
05-19 23:55:04.694 12846 12846 D ActivityThread: add activity client record, r= ActivityRecord{f280194 token=android.os.BinderProxy@9367da5 {wang.switchy.hin2n/wang.switchy.hin2n.activity.MainActivity}} token= android.os.BinderProxy@9367da5
--------- beginning of crash
05-19 23:55:04.708 12846 12846 E AndroidRuntime: FATAL EXCEPTION: main
05-19 23:55:04.708 12846 12846 E AndroidRuntime: Process: wang.switchy.hin2n, PID: 12846
05-19 23:55:04.708 12846 12846 E AndroidRuntime: java.lang.RuntimeException: Unable to resume activity {wang.switchy.hin2n/wang.switchy.hin2n.activity.MainActivity}: android.database.sqlite.SQLiteException: no such column: T.HEADER_ENC (Sqlite code 1 SQLITE_ERROR): , while compiling: SELECT T."_id",T."VERSION",T."NAME",T."IP_MODE",T."IP",T."NETMASK",T."COMMUNITY",T."PASSWORD",T."DEV_DESC",T."SUPER_NODE",T."MORE_SETTINGS",T."SUPER_NODE_BACKUP",T."MAC_ADDR",T."MTU",T."LOCAL_IP",T."HOLE_PUNCH_INTERVAL",T."RESOVE_SUPERNODE_IP",T."LOCAL_PORT",T."ALLOW_ROUTING",T."DROP_MUTICAST",T."USE_HTTP_TUNNEL",T."TRACE_LEVEL",T."IS_SELCECTED",T."GATEWAY_IP",T."DNS_SERVER",T."ENCRYPTION_MODE",T."HEADER_ENC" FROM "N2NSettingList" T WHERE T."_id"=?, (OS error - 2:No such file or directory)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5078)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5121)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:190)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:105)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2613)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:110)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.os.Looper.loop(Looper.java:219)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8668)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: Caused by: android.database.sqlite.SQLiteException: no such column: T.HEADER_ENC (Sqlite code 1 SQLITE_ERROR): , while compiling: SELECT T."_id",T."VERSION",T."NAME",T."IP_MODE",T."IP",T."NETMASK",T."COMMUNITY",T."PASSWORD",T."DEV_DESC",T."SUPER_NODE",T."MORE_SETTINGS",T."SUPER_NODE_BACKUP",T."MAC_ADDR",T."MTU",T."LOCAL_IP",T."HOLE_PUNCH_INTERVAL",T."RESOVE_SUPERNODE_IP",T."LOCAL_PORT",T."ALLOW_ROUTING",T."DROP_MUTICAST",T."USE_HTTP_TUNNEL",T."TRACE_LEVEL",T."IS_SELCECTED",T."GATEWAY_IP",T."DNS_SERVER",T."ENCRYPTION_MODE",T."HEADER_ENC" FROM "N2NSettingList" T WHERE T."_id"=?, (OS error - 2:No such file or directory)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1030)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:637)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:610)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:66)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.database.sqlite.SQLiteQuery.(SQLiteQuery.java:37)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:46)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1482)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1416)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at org.greenrobot.greendao.database.StandardDatabase.rawQuery(StandardDatabase.java:32)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at org.greenrobot.greendao.AbstractDao.load(AbstractDao.java:147)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at wang.switchy.hin2n.activity.MainActivity.onResume(MainActivity.java:326)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1472)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.app.Activity.performResume(Activity.java:8351)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5068)
05-19 23:55:04.708 12846 12846 E AndroidRuntime: ... 11 more

建议运行中可以修改配置

至少可以修改其它配置,更好的是可以修改正在用的配置,保存后自动重启并使用新的配置。

针对 0.5.0 版本。

The gateway configuration not working properly

My top like this,

  1. I have 3 openwrt routers run edge(10.0.0.x on n2n TAP dev) ---- Lan (192.168.x.0-254),
  2. a cloud machie with public ipv4 run supernode and also run an edge(10.0.0.1),
  3. I run hin2n on my Android 11 phone, with specified IP like 10.0.0.7
  4. I configure the gateway and dns in hin2n which pointed to one of openwrt routers TAP dev IP (which is 10.0.0.4)
  5. I counfgure the static route on each openwrt like 192.168.x.0 destination to its corresponding 10.0.0.x IF as next hop, so each Lans behinds routers ping other peer whatever the IP is 10.0.0.x or 192.168.x.0 working well.

however the problem is when I use Android netwokr tools to ping the openwrt router's Lan , it works very wired, it can ping time by time and sometimes it is unreachable , but the 10.0.0.x address can ping well. I not understand even if I have set the gateway and dns pointed to one of openwrt there, why it is not working stable? is the route table changed time by time mysteriously? what is t he mechanism of this on Android?

BTW: is it possible to enhance this app that I can define 3-5 static routers to wan or lan dev like what I could do on a PC, I guess it will resolve the issue above, seems configure a gw there would be problem and not working as desired in most senario.

无法启动vpn

C64F019C4342E90C305609EEB03C9DC1
这个报错似乎经常出现,但并未找到具体原因和触发条件,经测试,先开启其他vpn,再开启hin2n,会把其他vpn冲掉,但是自己也无法启动,且似乎接下来一段时间内都无法启动,即别的vpn可以冲掉它后正常使用,但它冲掉别的vpn后就无法正常使用。报错内容简洁但并不很明了,不太看得出具体哪里出问题

Add ability to tunnel specific networks

建议增加自定义路由转发。原理是每次在创建VPNService时,用addDnsServer和addRoute方法,把自定义的DNS和路由信息参数加入进去,以达到配置自定义路由的效果(运行时修改自定义路由表的话,重新创建VPNService并重写新的参数即可)。因为实际使用中组网的目的不一定只是为了访问具体主机,在某些场合还有链路分流或者使用某一个节点的内网环境的需求。谢谢!

App freezes when supernode name resolution fails

2020-06-30 19:55:15.977 11228-11228/wang.switchy.hin2n V/AudioManager: playSoundEffect   effectType: 0
2020-06-30 19:55:15.978 11228-11228/wang.switchy.hin2n V/AudioManager: querySoundEffectsEnabled...
2020-06-30 19:55:15.981 11228-11228/wang.switchy.hin2n D/edge_jni: in stop
2020-06-30 19:55:15.981 11228-11228/wang.switchy.hin2n D/edge_jni: ResetEdgeStatus tid = 517589284080, cleanup = 0
2020-06-30 19:55:19.716 11228-11276/wang.switchy.hin2n D/IMonitor: Load library imonitor_jni
2020-06-30 19:55:19.723 11228-11276/wang.switchy.hin2n E/ZrHungImpl:  sendAppFreezeEvent failed!
2020-06-30 19:55:19.774 11228-11378/wang.switchy.hin2n W/n2n: 30/Jun/2020 19:55:19 [/home/emanuele/src/hin2n/Hin2n_android/app/src/main/cpp/n2n_v2/src/edge_utils.c:405] WARNING: Failed to resolve supernode host supernode.ntop.org, assuming numeric
2020-06-30 19:55:19.775 11228-11378/wang.switchy.hin2n E/n2n: 30/Jun/2020 19:55:19 [/home/emanuele/src/hin2n/Hin2n_android/app/src/main/cpp/n2n_v2/src/edge_utils.c:696] ERROR: sendto failed (13) Permission denied
2020-06-30 19:55:19.780 11228-11378/wang.switchy.hin2n E/n2n: 30/Jun/2020 19:55:19 [/home/emanuele/src/hin2n/Hin2n_android/app/src/main/cpp/n2n_v2/src/edge_utils.c:1158] ERROR: stop command received.
2020-06-30 19:55:22.031 11228-11276/wang.switchy.hin2n E/ZrHungImpl:  sendAppFreezeEvent failed!
2020-06-30 19:55:35.946 11228-11276/wang.switchy.hin2n E/ZrHungImpl:  sendAppFreezeEvent failed!

红米 android 4.4 crash

配置MTU小于1300时,点击开始运行后crash

crash message 1

HM NOTE 1 LTE
java.lang.RuntimeException: Unable to start service wang.switchy.an2n.service.N2NService@423f7ff8 with Intent { cmp=wang.switchy.an2n/.service.N2NService (has extras) }: java.lang.IllegalStateException: command '87 interface fwmark rule add tun0' failed with '400 87 Failed to add fwmark rule (Success)'
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2721)
at android.app.ActivityThread.access$2100(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1309)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5052)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: command '87 interface fwmark rule add tun0' failed with '400 87 Failed to add fwmark rule (Success)'
at android.os.Parcel.readException(Parcel.java:1497)
at android.os.Parcel.readException(Parcel.java:1443)
at android.net.IConnectivityManager$Stub$Proxy.establishVpn(IConnectivityManager.java:1639)
at android.net.VpnService$Builder.establish(VpnService.java:472)
at wang.switchy.an2n.service.N2NService.onStartCommand(N2NService.java:79)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2704)
... 10 more
java.lang.IllegalStateException: command '87 interface fwmark rule add tun0' failed with '400 87 Failed to add fwmark rule (Success)'
at android.os.Parcel.readException(Parcel.java:1497)
at android.os.Parcel.readException(Parcel.java:1443)
at android.net.IConnectivityManager$Stub$Proxy.establishVpn(IConnectivityManager.java:1639)
at android.net.VpnService$Builder.establish(VpnService.java:472)
at wang.switchy.an2n.service.N2NService.onStartCommand(N2NService.java:79)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2704)
at android.app.ActivityThread.access$2100(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1309)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5052)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
at dalvik.system.NativeStart.main(Native Method)

crash message 2

HM NOTE 1 LTE
java.lang.RuntimeException: Unable to start service wang.switchy.an2n.service.N2NService@423c50f0 with Intent { cmp=wang.switchy.an2n/.service.N2NService (has extras) }: java.lang.IllegalStateException: command '2309 interface fwmark rule add tun0' failed with '400 2309 Failed to add fwmark rule (File exists)'
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2721)
at android.app.ActivityThread.access$2100(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1309)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5052)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: command '2309 interface fwmark rule add tun0' failed with '400 2309 Failed to add fwmark rule (File exists)'
at android.os.Parcel.readException(Parcel.java:1497)
at android.os.Parcel.readException(Parcel.java:1443)
at android.net.IConnectivityManager$Stub$Proxy.establishVpn(IConnectivityManager.java:1639)
at android.net.VpnService$Builder.establish(VpnService.java:472)
at wang.switchy.an2n.service.N2NService.onStartCommand(N2NService.java:79)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2704)
... 10 more
java.lang.IllegalStateException: command '2309 interface fwmark rule add tun0' failed with '400 2309 Failed to add fwmark rule (File exists)'
at android.os.Parcel.readException(Parcel.java:1497)
at android.os.Parcel.readException(Parcel.java:1443)
at android.net.IConnectivityManager$Stub$Proxy.establishVpn(IConnectivityManager.java:1639)
at android.net.VpnService$Builder.establish(VpnService.java:472)
at wang.switchy.an2n.service.N2NService.onStartCommand(N2NService.java:79)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2704)
at android.app.ActivityThread.access$2100(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1309)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5052)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
at dalvik.system.NativeStart.main(Native Method)

mdns can't work

Both devices create VPN, but mDNS can't find each other,why??

Protocol version 2 not working

Your ReadMe says:

Hin2n now supports all v1/v2/v2s protocols

but I installed https://github.com/switch-iot/hin2n/releases/download/hin2n_v0.6.0-rc8_debug-7-gc2c9a59/hin2n_v0.6.0-rc8_debug-7-normal_allarch.apk on my Android 11 phone and the only protocol version that connected was v1.

v2 and v3 gave errors like:

07/Jun/2021 19:12:04 [supernode.c: 325] WARNING: Received packet with unknown protocol version (2): discarded
07/Jun/2021 19:12:07 [supernode.c: 317] WARNING: Received packet too short [len=34]
07/Jun/2021 19:12:08 [      n2n.c: 560] WARNING: Receive error [Success] or pkt too short [len=32]
07/Jun/2021 19:16:16 [supernode.c: 325] WARNING: Received packet with unknown protocol version (3): discarded

v2s gave a GUI error in the mobile app and once crashed it.

Supernode info:

Welcome to n2n v.1.3.2 for x86_64
Built on 04/17/18 07:52:27 AM

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.