-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
caf6fcc
commit 40f4e82
Showing
10 changed files
with
442 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,79 @@ | ||
# 订阅 | ||
|
||
ruci 中使用一种非常简单的方法来实现订阅,分为三步:打包、服务文件(生成订阅url)、下载。 | ||
|
||
|
||
|
||
## 示例流程 | ||
```sh | ||
./ruci-cmd utils pack-z resource | ||
mkdir static | ||
mv 83c649c74b8a4c6ebc07a9a99ee350a0.tar.zip static/ | ||
./ruci-cmd utils serve-folder | ||
./ruci-cmd -c http://0.0.0.0:18143/download/83c649c74b8a4c6ebc07a9a99ee350a0.tar.zip --in-memory | ||
``` | ||
./ruci-cmd utils pack resource | ||
|
||
## 打包 | ||
|
||
./ruci-cmd utils pack-z resource | ||
|
||
它会把 ruci-cmd 目录下的 resource 文件夹中的全部内容打包为一个 {md5}.tar.zip 文件。 | ||
这个 zip文件里面只有一个文件,即 {md5}.tar, 而 {md5}.tar 里面则是 resource 文件夹中的所有文件内容(不包含resource 这个层级) | ||
|
||
其中 {md5} 是 {md5}.tar 这个文件的 md5 哈希值。 | ||
|
||
## 服务文件(生成订阅url) | ||
|
||
之后把 {md5}.tar.zip 文件移动到 ruci-cmd 所在目录的 static 文件夹下。若没有则创建一个。 | ||
|
||
```sh | ||
mkdir static | ||
mv 83c649c74b8a4c6ebc07a9a99ee350a0.tar.zip static/ | ||
``` | ||
|
||
然后运行 ruci-cmd 的文件服务器 | ||
|
||
```sh | ||
./ruci-cmd utils serve-folder | ||
./ruci-cmd -c http://0.0.0.0:18143/download/folder1/83c649c74b8a4c6ebc07a9a99ee350a0.tar.zip --in-memory | ||
``` | ||
|
||
这样,订阅链接就会自动为 | ||
http://0.0.0.0:18143/download/83c649c74b8a4c6ebc07a9a99ee350a0.tar.zip | ||
|
||
注意,0.0.0.0 是本机地址,如果您要在公网,可以将ip换为 您的公网ip。 | ||
|
||
ruci 不提供https、用户鉴权的机制,您可以通过一些反向代理的方式来提供安全性。 | ||
|
||
|
||
## 在客户端使用订阅链接 | ||
|
||
正常使用配置文件时,是用的 `ruci-cmd -c local.lua`, 此时,只要把 -c 的参数改为对应的下载链接即可: | ||
|
||
```sh | ||
./ruci-cmd -c http://0.0.0.0:18143/download/83c649c74b8a4c6ebc07a9a99ee350a0.tar.zip | ||
``` | ||
|
||
该命令会下载该压缩包、保存到当前目录并使用。它会自动阅读包中的 local.lua 或 local.toml 文件。 | ||
|
||
如果不想把下载的包保存,则可以加 ` --in-memory` 选项。 | ||
|
||
如果已经保存了下载好的包,下一次使用时可以直接解压缩里面的内容使用,也可以直接用 | ||
|
||
```sh | ||
./ruci-cmd -c 83c649c74b8a4c6ebc07a9a99ee350a0.tar.zip | ||
``` | ||
|
||
或者 | ||
|
||
```sh | ||
./ruci-cmd -c 83c649c74b8a4c6ebc07a9a99ee350a0.tar | ||
``` | ||
|
||
注意,如果不解压缩,则不要修改 tar 或 tar.zip 的名字。因为名字要作为 md5 由 ruci-cmd 检查其包内容是否一致。 | ||
如果 包的实际内容的 md5 与 名字不一致,则 ruci-cmd 会拒绝运行。 | ||
|
||
# 接下来 | ||
|
||
- [toml配置](../toml/index.md) | ||
- [lua配置](../lua/lua.md) | ||
- [路由配置](lua/route_config.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# ruci 入门 | ||
|
||
ruci 的可执行文件叫做 ruci-cmd, 客户端和服务端都是使用这同一个程序。 | ||
|
||
## 安装ruci | ||
|
||
从这里下载 ruci-cmd 的最新发布版:[Release](https://github.com/e1732a364fed/ruci/releases) | ||
|
||
|
||
发布版 以 .tar.xz 为后缀,是一个压缩包,包含 ruci-cmd 以及相关的 resource 文件夹。 | ||
|
||
压缩包对于不同的平台有不同的后缀。 | ||
|
||
### windows | ||
|
||
建议下载后缀为 `x86_64-pc-windows-msvc.tar.xz` 的版本 | ||
|
||
下载后,可以用 7zip 来解压,先解压出一个 tar, 再解压一遍得到程序。 | ||
|
||
第一次运行时,windows 可能弹出提示,询问是否允许连接到网络,同意即可。 | ||
|
||
|
||
### macOS | ||
|
||
apple silicon(m1,m2,m3,m4) 下载 | ||
`aarch64-apple-darwin.tar.xz` | ||
|
||
老机型下载 | ||
`x86_64-apple-darwin.tar.xz ` | ||
|
||
解压: | ||
|
||
tar xf archive.tar.xz | ||
|
||
第一次运行时,macOS 会提示您该程序不受信任,您可以到 设置-隐私与安全 中,许可本程序的使用。 | ||
|
||
|
||
### x64 linux | ||
建议 x64的 linux 用户下载 后缀为 `x86_64-unknown-linux-gnu.tar.xz` 的版本 | ||
|
||
如果运行闪退,则可以下载 后缀为 `x86_64-unknown-linux-musl.tar.xz` 的版本 | ||
|
||
解压: | ||
|
||
tar xf archive.tar.xz | ||
chmod +x ruci-cmd | ||
|
||
### 安卓 | ||
|
||
termux 用户可以下载 后缀为 `aarch64-linux-android.tar.xz` 的版本 | ||
|
||
可以先在电脑上解压好,再传到手机中 | ||
|
||
之后在 termux 中 | ||
|
||
chmod +x ruci-cmd | ||
|
||
## 开始使用 | ||
|
||
在ruci-cmd 所在的文件夹中: | ||
|
||
windows下,打开 cmd 或 powershell, 运行: | ||
|
||
.\ruci-cmd.exe | ||
|
||
其它平台,进入终端,输入 | ||
|
||
./ruci-cmd | ||
|
||
为了保持本文的简洁,下面命令行示例统一使用 linux 的格式。 | ||
|
||
|
||
运行ruci-cmd后它会在相同目录下的 resource 文件夹 或 ruci_config 文件夹寻找 `local.lua` 文件,如果 | ||
找到了,就会运行,否则就会退出。 | ||
|
||
运行时,会同时在 ruci-cmd 的当前目录下生成一个 logs 文件夹,用于存放生成的日志文件。 | ||
|
||
如果要指定配置文件运行,可以加 -c 参数: | ||
|
||
./ruci-cmd -c remote.lua | ||
./ruci-cmd -c local.toml | ||
|
||
如果要了解编译等方面的细节,可参考 [这里](https://github.com/e1732a364fed/ruci/blob/tokio/crates/ruci-cmd/README.md) | ||
|
||
为了不让 resource 文件夹中的示例文件影响您的自定义配置,您可以把 resource 文件夹重命名为其它名称, | ||
然后建立一个 ruci_config 文件夹,将您的配置文件放在 ruci_config 文件夹中。 | ||
|
||
```sh | ||
mv resource resource_default | ||
mkdir ruci_config | ||
cp resource_default/local.toml ruci_config/local.toml | ||
``` | ||
|
||
resource 文件夹中的内容有助于参考使用,建议保留。 | ||
|
||
调节日志等级为 debug: | ||
|
||
./ruci-cmd -l debug | ||
|
||
|
||
# 接下来 | ||
|
||
- [ruci-cmd程序](app/cmd.md) | ||
- [订阅](app/subscrible.md) | ||
- [toml配置](toml/index.md) | ||
- [lua配置](lua/lua.md) | ||
- [路由配置](lua/route_config.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.