Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能否提供libv2ray模块供学习 #49

Closed
Lua12138 opened this issue Aug 6, 2019 · 13 comments
Closed

能否提供libv2ray模块供学习 #49

Lua12138 opened this issue Aug 6, 2019 · 13 comments

Comments

@Lua12138
Copy link

Lua12138 commented Aug 6, 2019

因自己最近想学习VpnService收到的三层报文转发方法,参考了此项目,但是发现此项目com/v2ray/ang/service/V2RayVpnService.kt#24 中通过local socket将tun的文件描述符传入了libv2ray模块。

因此,是否方便提供libv2ray以供学习呢?如果不方便的话,能否给一些参考资料,对于VpnService收到的三层报文,如何以最简单的方式,将数据原样发送出去?

因为Java上提供的所有网络方法均构建在协议四层,NDK中也无法创建raw socket

如果不便提供任何信息,请直接关闭此issue即可。

@2dust
Copy link
Owner

2dust commented Aug 6, 2019

@2dust 2dust closed this as completed Aug 6, 2019
@phoenixxie0
Copy link

phoenixxie0 commented Aug 7, 2019

你好,使用https://github.com/2dust/AndroidLibV2rayLite 上的源代码编译出来的libv2ray.arr放入本项目后,编译成功,但是安装之后出现了一个疑问。具体是这样的,在设置里面的路由模式选择全局可以成功连接,但是选择其他的模式,就会报错,日志里显示是no correct JVM。请问这是什么原因呢?

@foezzy
Copy link

foezzy commented Aug 13, 2019

你好,使用https://github.com/2dust/AndroidLibV2rayLite 上的源代码编译出来的libv2ray.arr放入本项目后,编译成功,但是安装之后出现了一个疑问。具体是这样的,在设置里面的路由模式选择全局可以成功连接,但是选择其他的模式,就会报错,日志里显示是no correct JVM。请问这是什么原因呢?

请问一下怎么编译出aar呢,还没解决,能具体说下吗

@2dust
Copy link
Owner

2dust commented Aug 14, 2019

@phoenixxie0
Copy link

@2dust 按照这个编译成功之后,放入本项目相应位置编译成功,但是选择不是全局的路由模式就会无法连接。显示no correct JVM

@2dust
Copy link
Owner

2dust commented Aug 15, 2019

golang/go#33254

@phoenixxie0
Copy link

phoenixxie0 commented Aug 15, 2019

我是应该把Seq.setContext(getApplicationContext())加入到.java么?能不能说一下具体操作

@2dust
Copy link
Owner

2dust commented Aug 19, 2019

Seq.setContext(Context context). 增加在调用lib之前

@phoenixxie0
Copy link

phoenixxie0 commented Aug 21, 2019

@gam2046 搞定了吗?想参考一下
@2dust 是在V2RayVpnService.kt中的调用lib之前吗?还是在MainActivity.kt中的onCreate的地方呢?似乎还需要import go.Seq;
Seq.setContext(Context context).这个不知道怎么用,Java不精通。
我在MainActivity.kt中的onCreate增加了Seq.setContext(getApplicationContext()),无效。
似乎需要参考https://github.com/golang/go/issues/26815

@2dust
Copy link
Owner

2dust commented Aug 27, 2019

在V2RayVpnService 的onCreate 增加
Seq.setContext(applicationContext)

@phoenixxie0
Copy link

phoenixxie0 commented Sep 2, 2019

@2dust 在在V2RayVpnService 的onCreate 增加 Seq.setContext(applicationContext)后

Task :app:compileDebugKotlin FAILED
e: /opt/src/v2rayNG/V2rayNG/app/src/main/kotlin/com/v2ray/ang/service/V2RayVpnService.kt: (106, 9): Unresolved reference: Seq

@2dust
Copy link
Owner

2dust commented Sep 2, 2019

#88

@mr-sarsarabi
Copy link

For anyone wondering here about how to build that Libv2ray.aar Library, you can visit this answer on stack overflow for a shortcut.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants