小众科学上网工具TrustTunnel、mieru等安装配置

本教程测试环境:Ubuntu 24.04 X64 。

一、TrustTunnel安装配置

     TrustTunnel 是一种现代化的开源 VPN 协议,最初由 AdGuard VPN 开发,现已开放供任何人使用和审计。它能提供快速、安全且可靠的 VPN 连接,且无需在性能或功能上做出通常所需的妥协。从设计上讲,TrustTunnel 的流量与常规 HTTPS 流量无法区分,这使其能够在保持强大隐私保护的同时,绕过流量限速和深度包检测。

    服务器端特性:

VPN 协议:该库实现了兼容 HTTP/1.1、HTTP/2 和 QUIC 的 VPN 协议。通过模拟常规网络流量,使其难以被检测或拦截。

灵活的流量隧道:TrustTunnel 支持在客户端与服务器之间对 TCP、UDP 和 ICMP 流量进行隧道传输。

平台兼容性:服务器端兼容 Linux 和 macOS;客户端支持 Android、Apple(iOS/macOS)、Windows 和 Linux 平台。

客户端功能:

流量隧道传输:该库支持在客户端与端点之间对 TCP、UDP 和 ICMP 流量进行双向隧道传输。

跨平台支持:支持 Linux、macOS 和 Windows 平台,确保在不同操作系统上提供一致的使用体验。

系统级隧道与 SOCKS5 代理:既可配置为利用虚拟网络接口的系统级隧道,也可作为 SOCKS5 代理使用。

分流隧道(Split Tunneling):支持分流隧道功能,允许用户指定特定域名或主机,使其连接不通过 VPN 端点路由(或反之,即仅将特定域名或主机的连接通过端点路由)。

自定义 DNS 上游:用户可指定自定义 DNS 上游,用于处理经由 VPN 端点路由的 DNS 查询。

1、服务器端安装

curl -fsSL https://raw.githubusercontent.com/TrustTunnel/TrustTunnel/refs/heads/master/scripts/install.sh | sh -s -

默认安装目录在 /opt/trusttunnel ,切换到此目录下

cd /opt/trusttunnel/

编辑配置文件。trusttunnel有四个配置文件:Main Settings File (vpn.toml),TLS Hosts Settings File (hosts.toml),Credentials File (credentials.toml),Rules File (rules.toml),参考这里

vpn.toml文件,端口修改成自己的,其他可以保持默认

# The address to listen on
listen_address = "0.0.0.0:8443"   #端口修改为自己的

# Whether IPv6 connections can be routed
ipv6_available = true

# Whether connections to private network of the endpoint are allowed.
# Applies to traffic tunneled by clients only, the reverse proxy
# `server_address` is always reachable.
allow_private_network_connections = false

# Timeout of an incoming TLS handshake (seconds)
tls_handshake_timeout_secs = 10

# Timeout of a client listener (seconds)
client_listener_timeout_secs = 600

# Timeout of outgoing connection establishment (seconds)
connection_establishment_timeout_secs = 30

# Idle timeout of tunneled TCP connections (seconds)
tcp_connections_timeout_secs = 604800

# Timeout of tunneled UDP "connections" (seconds)
udp_connections_timeout_secs = 300

# Path to credentials file
credentials_file = "credentials.toml"

# Path to rules file (optional)
rules_file = "rules.toml"

# Listen protocol settings
[listen_protocols]

[listen_protocols.http1]
upload_buffer_size = 32768

[listen_protocols.http2]
initial_connection_window_size = 8388608
initial_stream_window_size = 131072
max_concurrent_streams = 1000
max_frame_size = 16384
header_table_size = 65536

[listen_protocols.quic]
recv_udp_payload_size = 1350
send_udp_payload_size = 1350
initial_max_data = 104857600
initial_max_stream_data_bidi_local = 1048576
initial_max_stream_data_bidi_remote = 1048576
initial_max_stream_data_uni = 1048576
initial_max_streams_bidi = 4096
initial_max_streams_uni = 4096
max_connection_window = 25165824
max_stream_window = 16777216
disable_active_migration = true
enable_early_data = true
message_queue_capacity = 4096

# Forward protocol (optional, defaults to direct)
[forward_protocol]
direct = {}

hosts.toml文件,修改成自己的域名及证书地址

# Main TLS hosts for traffic tunneling
[[main_hosts]]
hostname = "vpn.medomain.com"
cert_chain_path = "/etc/cert/cert.crt"
private_key_path = "/etc/cert/private.key"

credentials.toml文件,修改客户端访问时的认证密码

[[client]]
username = "username"
password = "password"
rules.toml文件
# Rules are evaluated in order, first matching rule's action is applied.
# If no rules match, the connection is allowed by default.

# Deny connections from specific IP range
[[rule]]
cidr = "192.168.1.0/24"
action = "deny"
配置开机启动
cp trusttunnel.service.template /etc/systemd/system/trusttunnel.service
sudo systemctl daemon-reload
sudo systemctl enable --now trusttunnel
升级的话,需先停止程序
sudo systemctl stop trusttunnel
再重新运行安装脚本一次
curl -fsSL https://raw.githubusercontent.com/TrustTunnel/TrustTunnel/refs/heads/master/scripts/install.sh | sh -s -
然后启动程序
sudo systemctl start trusttunnel
查看查看运行状态
sudo systemctl status  trusttunnel
生成客户端配置文件,为下面所用
./trusttunnel_endpoint  vpn.toml  hosts.toml   -c  username    -a 12.34.56.78  --format  toml
username与credentials.toml文件中的保持一致,IP换成自己vps的。

2、客户端安装
      (1)、官方客户端安装参考这里
      (2)、mihomo配置参考这里 ,添加一个trusttunnel字段

  - name: trusttunnel
    type: trusttunnel
    server: 12.34.56.78
    port: 8443
    username: username
    password: password
    client-fingerprint: chrome
    health-check: true
    udp: true
    congestion-controller: bbr
     (3)、手机端ios下shadowrocket已经支持TrustTunnel协议。

二、mieru安装配置

    mieru是一款安全的、无流量特征、难以主动探测的,基于 TCP 或 UDP 协议的 socks5 / HTTP / HTTPS 网络代理软件。mieru 代理软件由称为 mieru的客户端软件和称为 mita服务器端软件这两部分组成。
 核心特点:
      多协议支持:支持 SOCKS5、HTTP 和 HTTPS 代理类型。
      传输层灵活:支持基于 TCP 或 UDP 传输,TCP 速度通常比 UDP 更快,而 UDP 具有不同的抗封锁特性。
      抗主动探测:不依赖常见的 TLS 伪装网站配置(无需繁琐申请域名),同时在底层减少流量特征,使之不易被防火墙识别和分类。
     多路复用:支持多路复用设置(如关闭或高/中/低级别调整),提升传输效率。
     多用户与双栈:支持多用户共享单个代理服务器,并全面支持 IPv4 与 IPv6。

 1、服务端安装
curl -fSsLO https://raw.githubusercontent.com/enfein/mieru/refs/heads/main/tools/setup.py
chmod +x setup.py
sudo python3 setup.py --lang=zh
会提示安装向导,第一步选择y,安装服务端软件,后续可以直接CTRL+C退出


编辑配置文件,当前目录下新建 nano mit.json文件,将端口,用户名及密码修改成自己的
{
    "portBindings": [
        {
            "port": 9443,
            "protocol": "TCP"
        }
    ],
    "users": [
        {
            "name": "username",
            "password": "password"
        }
    ],
    "loggingLevel": "INFO",
    "mtu": 1400
}

运行以下命令使配置文件生效
mita apply config mit.json
启动服务
mita start
下面指令查看当前设置
mita describe config
注意,每次使用 mita apply config <FILE> 修改设置后,需要用 mita stop 和 mita start 重启代理服务

2、客户端安装,参考这里 

      mihomo配置,添加一个mieru字段
  - name: mieru
    type: mieru
    server: 12.34.56.78
    port: 9443
    transport: TCP
    udp: true
    username: username 
    password: password
    multiplexing: MULTIPLEXING_HIGH
   手机端ios下shadowrocket已经支持mieru协议。

评论

热门博文

Xray安装配置VLESS-XTLS-Vision及VLESS-XTLS-uTLS-REALITY

V2Ray安装配置VMESS-TLS及VMESS-TLS-WS

在VPS上轻松搭建L2TP/IPSec图文教程(通吃各种架构的VPS,包括KVM,OpenVZ等)