<div align="center">
  <a href="https://rustvnt.com">
<img src="https://socialify.git.ci/vnt-dev/vnt/image?description=1&logo=https%3A%2F%2Fraw.githubusercontent.com%2Fvnt-dev%2FVntApp%2Fmaster%2Fandroid%2Fapp%2Fsrc%2Fmain%2Fres%2Fmipmap-xxxhdpi%2Fic_launcher.png&name=1&pattern=Plus&theme=Auto" alt="" width="640" height="320" />
<p>

<a href="https://hits.seeyoufarm.com"><img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=http%3A%2F%2Flmq8267%2Fctcaddy%2Fvnt-cli%2F2&count_bg=%2395C10D&title_bg=%23555555&icon=rust.svg&icon_color=%238DC409&title=%E8%AE%BF%E9%97%AE%E6%95%B0&edge_flat=false"/></a>
	<a href="https://github.com/vnt-dev/vnt/releases"><img src="https://img.shields.io/github/downloads/vnt-dev/vnt/total"></a>
  <a href="https://github.com/vnt-dev/vnt/graphs/contributors"><img src="https://img.shields.io/github/contributors-anon/vnt-dev/vnt"></a>
  <a href="https://github.com/vnt-dev/vnt/releases/"><img src="https://img.shields.io/github/release/vnt-dev/vnt"></a>
  <a href="https://github.com/vnt-dev/vnt/issues"><img src="https://img.shields.io/github/issues-raw/vnt-dev/vnt"></a>
  <a href="https://github.com/vnt-dev/vnt/discussions"><img src="https://img.shields.io/github/discussions/vnt-dev/vnt"></a>
  <a href="GitHub repo size"><img src="https://img.shields.io/github/repo-size/vnt-dev/vnt?color=red&style=flat-square"></a>
  <a href="https://github.com/vnt-dev/vnt/actions?query=workflow%3ABuild"><img src="https://img.shields.io/github/actions/workflow/status/vnt-dev/vnt/rust.yml?branch=main" alt="Build status"></a>
  <a href="https://hub.docker.com/r/lubeilin/vnt"><img src="https://img.shields.io/docker/pulls/lubeilin/vnt?color=%2348BB78&logo=docker&label=pulls" alt="Downloads"></a>
</p>  
</div>
    
<div align="center">
  
## 支持重定向版本

##### 1.2.16开始需要添加`http:`前缀才能识别重定向，具体在1.2.16文件夹里有说明

</div>  

这个重定向版是我在原版的基础上问AI进行修改的，使客户端支持`-s`服务器地址支持重定向地址，方便使用stun打洞（`lucky` `natmap`）自建服务器，由于动态的IP地址和动态的端口，利用脚本每次变化后更新记录到域名进行重定向到动态的IP和端口。重定向版客户端就会优先去获取`-s`参数的域名的重定向地址作为服务器地址，获取不到重定向地址也不影响正常域名。

##### `lhc.us.kg/vnt01` 以UDP协议连接vnts服务端

<p><img src="./img/vnt01.webp" width="400"></p>

##### `tcp://lhc.us.kg/vnt02` 以TCP协议连接vnts服务端

<p><img src="./img/vnt02.webp" width="400"></p>


##### -s 服务器地址格式

|地址格式|例如|协议|原版|重定向版|
|--|--|--|--|--|
|域名:端口号|vnt.wherewego.top:29872|UDP TCP|✅|✅|
|txt:域名|txt:text.liaoh.dedyn.io|UDP TCP|✅|✅|
|域名/后缀|1hc.us.kg/vnt01|UDP|❌|✅|重定向|
|tcp://域名/后缀|tcp://1hc.us.kg/vnt02|TCP|❌|✅|重定向|
|ws://域名/后缀|ws://lhc.us.kg/vnt03|TCP|☑|✅|重定向|
|ws://域名|ws://vnt.wherewego.top:29872|TCP|✅|✅|
|wss://域名|wss://vnt.wherewego.top|TCP|☑|✅|

⚠️注意：原版的`WS` `WSS` 协议的重定向需要以`ws`或`wss`的头才能支持重定向，普通重定向的头一般是`http` `https`,目前有[1hc.us.kg](https://1hc.us.kg)和[pgy.us.kg](https://pgy.us.kg)短链接服务才支持这种WS头的重定向。<br>
重定向版则没有任何限制。

---------------------

### vnts服务器

- **udp**

1. 192.168.60.1:29872————natmap/lucky————125.94.158.166:58500

2. natmap/lucky带动脚本将 `125.94.158.166:58500` 提交到短链接服务网站，如：[1hc.us.kg](https://1hc.us.kg)
<p><img src="./img/vnt01_udp.webp" width="400"></p>

3. 可自定义后缀(`vnt01`)，生成 `1hc.us.kg/vnt01`

4. 使用时直接输入：`1hc.us.kg/vnt01`
<p><img src="./img/vnt01.webp" width="400"></p>

- **tcp**

1. 192.168.60.1:29872————natmap/lucky————125.94.158.166:58544

2. natmap/lucky带动脚本将 `125.94.158.166:58544` 提交到短链接服务网站，如：[1hc.us.kg](https://1hc.us.kg)
<p><img src="./img/vnt02_tcp.webp" width="400"></p>

3. 自定义后缀(`vnt02`),生成 `1hc.us.kg/vnt02`

4. 使用时直接输入： `tcp://1hc.us.kg/vnt02`
<p><img src="./img/vnt02.webp" width="400"></p>

- **ws**

1. 192.168.60.1:29872————natmap/lucky————125.94.158.166:58544

2. natmap/lucky带动脚本将 `125.94.158.166:58544` 提交到<u>特制短链接</u>服务网站，如：[1hc.us.kg](https://1hc.us.kg)
<p><img src="./img/vnt03_ws.webp" width="400"></p>

3. 自定义后缀(`vnt03`),生成 `1hc.us.kg/vnt03`

4. 使用时直接输入： `ws://1hc.us.kg/vnt03`

-----------------

## 使用GitHub进行云编译

#### 1. 首先fork原项目 [vnt-dev/vnt](https://github.com/vnt-dev/vnt) 电脑 安卓端[vnt-dev/VntApp](https://github.com/vnt-dev/VntApp)

<p><img src="./img/Fork.png" width="800"></p>

#### 2. 修改代码支持重定向

- **修改文件一**

`vnt/src/util/dns_query.rs`  对应文件在上方 `dns_query.rs`

- **修改文件二**

`vnt/Cargo.toml` 找到`[dependencies]` 在下方增加两个 如下

```
[dependencies]
http_req = { git = "https://github.com/lmq8267/http_req.git", default-features = false, features = ["rust-tls"] }
```

- **修改文件三（vntAPP去掉输入限制）**
<p><img src="./img/vntAPP重定向去掉限制.png" width="500"></p>

- **修改文件四（WS重定向）**
<p><img src="./WS替换协议头.png" width="500"></p>

```sh
// 替换协议前缀
if redirect.starts_with("http://") {
       url = redirect.replacen("http://", "ws://", 1);
} else if redirect.starts_with("https://") {
       url = redirect.replacen("https://", "wss://", 1);
} else {
       url = redirect.to_string();
}
println!("Location：{}", url);
log::info!("修改后的重定向地址: {}", url);
```
#### 3. 上传对应的云编译模板到你fork的项目里 在 `.github/workflows`文件夹内 
linux程序：**`编译vnt-cli.yml`** 安卓端 **`vntAPP-Android.yml`** Windows端 **`vntAPP-Windows.yml`**

#### 4. 点击 `Actions` 

- **编译linux二进制**
<p><img src="./img/云编译linux.png" width="300"></p><br>

- **编译电脑端安卓端[vnt-dev/VntApp](https://github.com/vnt-dev/VntApp)**

需要先在你fork的`VntApp`项目里将这个地址 改为你 fork 的 `vnt` 仓库地址

<p><img src="./编译模板更新核心版本2.png" width="500"></p><br>

然后再编译 源码地址写你fork的`VntApp`项目

<p><img src="./编译模板更新核心版本1.png" width="300"></p><br>

- **编译完成后，点击当前运行的编译流程进去 在下方有个文件下载**

<p><img src="./img/编译完成下载.png" width="400"></p>
