leaf icon indicating copy to clipboard operation
leaf copied to clipboard

请问还有 Android 库构建文档吗?

Open sayhell opened this issue 3 years ago • 44 comments

sayhell avatar Sep 14 '21 03:09 sayhell

请问,您安卓库构建成功了吗?

chen2ding avatar Mar 14 '22 05:03 chen2ding

我在mac m1上构建成功了

chekun avatar May 13 '22 02:05 chekun

@chekun Do you mind sharing how you did the build?

shenshengkafei avatar May 13 '22 15:05 shenshengkafei

@shenshengkafei Sure, you can refer at https://github.com/chekun/aleaf/tree/master/app/src/main/rust/leaf-android ,that repo is old, but it surely applies to leaf current version.

chekun avatar May 14 '22 03:05 chekun

@shenshengkafei Sure, you can refer at https://github.com/chekun/aleaf/tree/master/app/src/main/rust/leaf-android ,that repo is old, but it surely applies to leaf current version.

Thank you very much!

shenshengkafei avatar May 14 '22 03:05 shenshengkafei

谢谢!

---原始邮件--- 发件人: @.> 发送时间: 2022年5月14日(周六) 中午11:32 收件人: @.>; 抄送: @.@.>; 主题: Re: [eycorsican/leaf] 请问还有 Android 库构建文档吗? (#230)

@shenshengkafei Sure, you can refer at https://github.com/chekun/aleaf/tree/master/app/src/main/rust/leaf-android ,that repo is old, but it surely applies to leaf current version.

Thank you very much!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

chen2ding avatar May 14 '22 04:05 chen2ding

@shenshengkafei @ChenDing2018

https://github.com/chekun/aleaf/blob/master/app/src/main/rust/leaf-android/src/lib.rs#L28 socket_protect_path arg is removed in current leaf , you guys need modify the code a little bit.

chekun avatar May 14 '22 05:05 chekun

我在mac m1上构建成功了

大佬, 请问有iOS的库没?这上面新的releases都没有iOS的了?

594810899 avatar May 25 '22 01:05 594810899

@594810899 https://github.com/eycorsican/leaf/blob/master/Makefile#L9 leaf.h 会一起生成的呀

clone项目,执行 make ios-opt 就行了

chekun avatar May 25 '22 01:05 chekun

ios15 获取 tunFd 的方式要改,你google一下

chekun avatar May 25 '22 04:05 chekun

@594810899 这个得你自己看一下日志吧,idevicesyslog -p PacketTunnel

chekun avatar May 25 '22 05:05 chekun

大佬 请问socket_protect_path那要怎么修改啊 完全不懂rust, image

foreverZou avatar May 25 '22 12:05 foreverZou

大佬 请问socket_protect_path那要怎么修改啊 完全不懂rust, image 我也不懂rust

594810899 avatar May 25 '22 13:05 594810899

大佬,我不想努力了,请问有编译好的so文件可以给我一份么。/(ㄒoㄒ)/~~ image @chekun @594810899

foreverZou avatar May 25 '22 14:05 foreverZou

大佬,我不想努力了,请问有编译好的so文件可以给我一份么。/(ㄒoㄒ)/~~ image @chekun @594810899 我看你编译的安卓的,我是编译iOS的 ,你用不了啊

594810899 avatar May 25 '22 14:05 594810899

昂 谢谢大佬 我继续去掉头发了/(ㄒoㄒ)/~~

foreverZou avatar May 25 '22 14:05 foreverZou

@foreverZou so文件 发给你你也用不了,带包名的。 你看一下rust基础语法就可以了哈

chekun avatar May 26 '22 02:05 chekun

@594810899 你把配置改成这样试试,这个配置我可以用的,用下面的看看是否可以正常上网

[General]
loglevel = trace
dns-server = 223.5.5.5, 114.114.114.114
tun-fd = REPLACE-ME-WITH-THE-FD
routing-domain-resolve = true

[Proxy]
Direct = direct
Reject = reject

[Rule]
Final = direct

chekun avatar May 26 '22 02:05 chekun

你需要看日志 看发生了啥才能确定原因哦

chekun avatar May 26 '22 03:05 chekun

我加你Q吧

chekun avatar May 26 '22 05:05 chekun

Hello! Help! I've been trying to compile for Android for several days now and it doesn't work. Someone can help me with this?

Error: "no method named write_to_file found for enum Result in the current scope"

Valew17 avatar May 27 '22 19:05 Valew17

@Valew17 follow instructions with aleaf demo project, it will definitely work.

chekun avatar May 28 '22 01:05 chekun

@chekun let appGroup = "com.myncic.MyVpnProject.VPNTunneDemoA"

let conf = """ [General] loglevel = trace dns-server = 223.5.5.5, 114.114.114.114 tun-fd = REPLACE-ME-WITH-THE-FD routing-domain-resolve = true

[Proxy] Direct = direct Reject = trojan, 212.50.244.81, 6666, password=myncic_123456 [Rule] FINAL, direct """ 是这样的吗? 我用这个配置, 其它代码没变,还是访问不到外网

Hello! Did you manage to figure out what the problem is? Faced a similar situation.

Valew17 avatar May 28 '22 12:05 Valew17

编译出来了 但是连接不上 大佬救我/(ㄒoㄒ)/~~ @chekun image

foreverZou avatar May 31 '22 14:05 foreverZou

截图上不是写了ssl decrypt错误么

chekun avatar Jun 02 '22 01:06 chekun

我的同事使用相同的配置成功了,所以我想会不会是我哪一步弄错了。请问安卓的site.dat文件需要放在哪里呀? @chekun

foreverZou avatar Jun 03 '22 14:06 foreverZou

Hello! Excuse me for my English, it's not my native language. Can someone help me for money to collect libleafandroid.so the latest version and make the on and off function and what would it work stably on android? I really hope for your help.

Valew17 avatar Jun 04 '22 10:06 Valew17

@foreverZou 你同事成功了,很你同事的代码对比一下。

chekun avatar Jun 05 '22 04:06 chekun

@Valew17 follow the steps on your forked aleaf project, it works with the latest version.

chekun avatar Jun 05 '22 04:06 chekun

看报错信息哦,里面不光说了为啥错,还给你解决方案了

rustup target add aarch64-apple-ios

chekun avatar Jun 11 '22 03:06 chekun

make ios-opt 试试

chekun avatar Jun 11 '22 03:06 chekun

@Chen77777 嗯,这我就不是很清楚了,我是在m1上编译的,深层原因我也不太懂了,哈哈,看有没有大佬解答。

chekun avatar Jun 11 '22 03:06 chekun

@Chen77777 不是哦,安卓,ios 我都在m1上成功啦

chekun avatar Jun 11 '22 04:06 chekun

@Chen77777 是的,都是最新版编译的啦

chekun avatar Jun 11 '22 05:06 chekun

@Chen77777 是的,都是最新版编译的啦

嗯嗯 那可能问题在编译环境上

Chen77777 avatar Jun 11 '22 05:06 Chen77777

Hello! Can someone share an example of this file https://github.com/chekun/aleaf/blob/master/app/src/main/java/com/leaf/example/aleaf/SimpleVpnService.kt ?

As I understand it does not work with the new version 0.6.0

Valew17 avatar Jun 16 '22 12:06 Valew17

https://github.com/chekun/aleaf/blob/master/app/src/main/rust/leaf-android/src/lib.rs#L28 socket_protect_path arg is removed in current leaf , you guys need modify the code a little bit.

as i mentioned earlier, modify this file to match latest leaf api

@Valew17

chekun avatar Jun 17 '22 08:06 chekun

https://github.com/chekun/aleaf/blob/master/app/src/main/rust/leaf-android/src/lib.rs#L28 socket_protect_path arg is removed in current leaf , you guys need modify the code a little bit.

as i mentioned earlier, modify this file to match latest leaf api

@Valew17

Did I remove the line "socket_protect_path: Some(protect_path)," or is that not enough? Everything compiled after that, in the logs I see that requests are coming, but the Internet on the Android device does not work. Please help me to figure out how to run the latest version.

Valew17 avatar Jun 17 '22 09:06 Valew17

@Valew17

before runLeaf ,do you set SOCKET_PROTECT_PATH env variable? If not , set it before runLeaf.

The code is here https://github.com/eycorsican/leaf/blob/50703f8ad8e9cb238fa3a352d9a07af2b00b9e65/leaf/src/option/mod.rs#L189

comments says

     /// Sets the RPC service endpoint for protecting outbound sockets on Android to
    /// avoid infinite loop. The `path` is treated as a Unix domain socket endpoint.
    /// The RPC service simply listens for incoming connections, reads an int32 on
    /// each connection, treats it as the file descriptor to protect, writes back 0
    /// on success.

chekun avatar Jun 17 '22 09:06 chekun

@Valew17

before runLeaf ,do you set SOCKET_PROTECT_PATH env variable? If not , set it before runLeaf.

The code is here

https://github.com/eycorsican/leaf/blob/50703f8ad8e9cb238fa3a352d9a07af2b00b9e65/leaf/src/option/mod.rs#L189

comments says

     /// Sets the RPC service endpoint for protecting outbound sockets on Android to
    /// avoid infinite loop. The `path` is treated as a Unix domain socket endpoint.
    /// The RPC service simply listens for incoming connections, reads an int32 on
    /// each connection, treats it as the file descriptor to protect, writes back 0
    /// on success.
error0

Please help me a little more, I don't know the syntax of this language, like I'm passing a String, but it still swears when compiling.

Valew17 avatar Jun 17 '22 10:06 Valew17

i mean , in java , Os.setenv("SOCKET_PROTECT_PATH", protectPath, true)

chekun avatar Jun 17 '22 10:06 chekun

i mean , in java , Os.setenv("SOCKET_PROTECT_PATH", protectPath, true)

Thanks a lot! It helps me!

Valew17 avatar Jun 17 '22 10:06 Valew17

夜神模拟器android7 运行aleaf代理失败,android9 就可以,有大佬遇见过吗?

chen2ding avatar Jun 20 '22 02:06 chen2ding

image

chen2ding avatar Jun 20 '22 02:06 chen2ding