This project's artifact is a .pkg, not a web page, so the mirror is the thing that can actually be checked: every script inside the package, byte for byte, with its hash. The engine is deliberately absent — it is 67.7 MB of xray v26.11.9 (universal), and its hash is recorded instead.
vless setup <link>. The copy that carries a link is handed over privately, which is why the private build has its own hash underneath.| Artifact | Bytes | SHA-256 |
|---|---|---|
vless-setup.pkg published, no link inside | 25,772,033 | 1217964f79e43acd565201b9460fe3d3edd71187a3ae9f51e61f9c145f1a5afa |
vless-setup.pkg private build, link baked in | 25,772,087 | ceb94d812b55b245f70a5947271adafb2abbdc5fa89dbfe4f9b7d9a7588c5db2 |
| File | Bytes | Lines | SHA-256 | Job |
|---|---|---|---|---|
vless | 8,572 | 240 | 0650c27338819114 | The command: on / off / status / uninstall |
vless-autostart | 2,529 | 78 | 59fdc99ed8d482b1 | Per-network decision: probe three sites, tunnel on or off |
proxy-toggle | 1,120 | 37 | ccbb59c1fb132f87 | Root helper that flips the system SOCKS proxy |
postinstall | 1,371 | 36 | b7c0aaa7798eef1c | Runs once at install: permissions, symlink, sudoers, agent |
uninstall | 929 | 28 | 94c2bce090801579 | Removes every file, the agent and the sudoers rule |
com.vless.autostart.plist | 898 | 36 | 8b606705f9282f23 | LaunchAgent: network change, login, every 5 minutes |
The machine-readable version of this table is manifest.json, which also records the engine's hash and both package builds.
Each block below is the exact file that goes into /usr/local/libexec/. Links in the table above open the same bytes as a plain file.
#!/bin/bash
# vless — campus/office tunnel over VLESS + WebSocket + TLS.
#
# vless setup <link> save the subscription link this copy will use
# vless on start tunnel, verify real traffic, then set the system proxy
# vless off stop tunnel and clear the proxy
# vless status what is running
# vless uninstall remove everything (needs admin)
#
# Safety rule: the system proxy is set only AFTER traffic through the tunnel is
# proven, and a detached watcher clears it the moment the tunnel dies. Failure
# mode is "sites stop loading", never "no internet at all".
set -u
PREFIX="${VLESS_PREFIX:-/usr/local/libexec/vless}"
STATE="$HOME/.vless"
XRAY="$PREFIX/xray"
SUB="${VLESS_SUB:-$PREFIX/subscription}"
[ -r "$SUB" ] || SUB="$STATE/subscription"
HELPER="${VLESS_HELPER:-/usr/local/libexec/proxy-toggle}"
PORT="${VLESS_PORT:-1080}"
NO_PROXY="${VLESS_NO_PROXY:-0}"
mkdir -p "$STATE" 2>/dev/null
say() { printf '%s\n' "$*"; }
log() { printf '%s %s\n' "$(date '+%F %T')" "$*" >>"$STATE/vless.log"; }
pid_alive() { # $1 = pidfile
[ -f "$1" ] || return 1
local p; p=$(cat "$1" 2>/dev/null)
case "$p" in ''|*[!0-9]*) return 1 ;; esac
kill -0 "$p" 2>/dev/null
}
urldecode() { printf '%s' "$1" | perl -pe 's/%([0-9A-Fa-f]{2})/chr(hex($1))/ge' 2>/dev/null; }
qp() { # $1 = query string, $2 = key
printf '%s' "$1" | tr '&' '\n' | sed -n "s/^$2=//p" | head -1
}
is_ip() { case "$1" in ''|*[!0-9a-fA-F.:]*) return 1 ;; *[0-9]*) return 0 ;; *) return 1 ;; esac; }
egress() { # $1 = direct|proxy
local out=""
if [ "$1" = proxy ]; then
out=$(curl -s --max-time 12 --socks5-hostname "127.0.0.1:$PORT" https://api.ipify.org 2>/dev/null)
is_ip "$out" || out=$(curl -s --max-time 12 --socks5-hostname "127.0.0.1:$PORT" https://ifconfig.me/ip 2>/dev/null)
else
out=$(curl -s --max-time 8 --noproxy '*' https://api.ipify.org 2>/dev/null)
fi
is_ip "$out" && printf '%s' "$(printf '%s' "$out" | tr -d '[:space:]')"
}
fetch_links() { # prints one vless:// link per line, 443 first
[ -f "$SUB" ] || return 1
local url body
url=$(head -1 "$SUB" | tr -d '[:space:]')
body=$(curl -s --noproxy '*' --max-time 25 "$url" 2>/dev/null)
case "$body" in
vless://*) : ;;
"") return 1 ;;
*) body=$(printf '%s' "$body" | base64 -D 2>/dev/null) ;;
esac
case "$body" in *vless://*) : ;; *) return 1 ;; esac
printf '%s\n' "$body" | grep '^vless://' | grep -e ':443' -e '=443'
printf '%s\n' "$body" | grep '^vless://' | grep -v -e ':443' -e '=443'
}
write_cfg() { # $1 = link
local rest userinfo hostport host port q id sni whost wpath
rest="${1#vless://}"
userinfo="${rest%%@*}"
hostport="${rest#*@}"; hostport="${hostport%%\?*}"
id=$(urldecode "$userinfo")
host="${hostport%:*}"; port="${hostport##*:}"
case "$port" in ''|*[!0-9]*) port=443 ;; esac
q="${rest#*\?}"; [ "$q" = "$rest" ] && q=""
sni=$(qp "$q" sni); [ -n "$sni" ] || sni=$(qp "$q" host); [ -n "$sni" ] || sni="$host"
whost=$(qp "$q" host); [ -n "$whost" ] || whost="$sni"
wpath=$(urldecode "$(qp "$q" path)"); [ -n "$wpath" ] || wpath="/"
cat >"$STATE/cfg.json" <<JSON
{
"log": {"loglevel": "warning"},
"inbounds": [{"port": $PORT, "listen": "127.0.0.1", "protocol": "socks",
"settings": {"udp": true, "auth": "noauth"}}],
"outbounds": [{
"protocol": "vless",
"settings": {"vnext": [{"address": "$host", "port": $port,
"users": [{"id": "$id", "encryption": "none"}]}]},
"streamSettings": {"network": "ws", "security": "tls",
"tlsSettings": {"serverName": "$sni", "fingerprint": "chrome"},
"wsSettings": {"path": "$wpath", "headers": {"Host": "$whost"}}}
}]
}
JSON
printf '%s:%s' "$host" "$port"
}
stop_all() {
touch "$STATE/stop" 2>/dev/null
local n
for n in supervisor.pid xray.pid; do
if pid_alive "$STATE/$n"; then kill "$(cat "$STATE/$n")" 2>/dev/null; fi
done
sleep 1
rm -f "$STATE/xray.pid" "$STATE/supervisor.pid" "$STATE/status" "$STATE/cfg.json" "$STATE/stop" 2>/dev/null
}
cmd_on() {
local keep=0
[ "${1:-}" = "--keep" ] && keep=1
if pid_alive "$STATE/xray.pid"; then
say "already on: $(cat "$STATE/status" 2>/dev/null)"
return 0
fi
# something else on the port would make the checks below test the wrong tunnel
if lsof -nP -iTCP:"$PORT" -sTCP:LISTEN >/dev/null 2>&1; then
say "FAILED: port $PORT is already in use by another program; nothing was changed"
return 1
fi
if [ ! -s "$SUB" ]; then
say "no subscription link saved yet."
say "get the link from whoever sent you this installer, then run: vless setup <link>"
return 1
fi
rm -f "$STATE/stop"
if [ "$keep" = 1 ]; then echo 1 >"$STATE/keep"; else rm -f "$STATE/keep"; fi
local links direct
links=$(fetch_links)
if [ -z "$links" ]; then
say "FAILED: could not fetch the subscription (network down, or the link is dead)"
return 1
fi
direct=$(egress direct)
say "direct egress=${direct:-unknown} nodes=$(printf '%s\n' "$links" | wc -l | tr -d ' ')"
local i=0 link node ip attempt
while IFS= read -r link; do
[ -n "$link" ] || continue
i=$((i + 1)); [ "$i" -le 8 ] || break
node=$(write_cfg "$link")
nohup "$XRAY" run -c "$STATE/cfg.json" >"$STATE/xray.log" 2>&1 &
echo $! >"$STATE/xray.pid"
sleep 2
ip=""
attempt=0
while [ "$attempt" -lt 3 ]; do
attempt=$((attempt + 1))
pid_alive "$STATE/xray.pid" || break
ip=$(egress proxy)
[ -n "$ip" ] && [ "$ip" != "$direct" ] && break
ip=""
sleep 2
done
if [ -n "$ip" ]; then
say "node $i $node -> egress=$ip"
if [ "$NO_PROXY" != 1 ]; then
sudo -n "$HELPER" on >/dev/null 2>&1 || say "warning: could not set the system proxy (needs admin)"
fi
printf 'node=%s egress=%s direct=%s\n' "$node" "$ip" "${direct:-unknown}" >"$STATE/status"
log "up node=$node egress=$ip"
nohup "$0" __supervise "$(cat "$STATE/xray.pid")" >/dev/null 2>&1 &
echo $! >"$STATE/supervisor.pid"
say "ON (proxy -> 127.0.0.1:$PORT)"
return 0
fi
say "node $i $node no data"
kill "$(cat "$STATE/xray.pid")" 2>/dev/null
rm -f "$STATE/xray.pid"
done <<EOF
$links
EOF
say "FAILED: no node carried data; nothing was changed"
log "failed: no working node"
return 1
}
cmd_off() {
stop_all
if [ "$NO_PROXY" != 1 ]; then
sudo -n "$HELPER" off 2>/dev/null || say "warning: could not clear the system proxy"
fi
log "down"
say "OFF"
return 0
}
cmd_supervise() { # $1 = xray pid
while kill -0 "$1" 2>/dev/null; do sleep 5; done
[ "$NO_PROXY" = 1 ] || sudo -n "$HELPER" off >/dev/null 2>&1
rm -f "$STATE/status" "$STATE/xray.pid" "$STATE/cfg.json" 2>/dev/null
log "tunnel died; proxy cleared"
}
cmd_setup() { # $1 = subscription link
local url="${1:-}"
if [ -z "$url" ]; then
printf 'paste the subscription link: '
read -r url
fi
case "$url" in
http://*|https://*) ;;
*) say "that is not a link (it must start with http:// or https://)"; return 1 ;;
esac
mkdir -p "$STATE"
printf '%s\n' "$url" >"$STATE/subscription"
chmod 600 "$STATE/subscription"
SUB="$STATE/subscription"
say "saved to $STATE/subscription"
say "next: vless on"
return 0
}
cmd_status() {
local up=down
pid_alive "$STATE/xray.pid" && up=up
if [ -s "$SUB" ]; then say "subscription: saved"; else say "subscription: none (run: vless setup <link>)"; fi
say "tunnel=$up $([ -f "$STATE/status" ] && cat "$STATE/status")"
if [ "$NO_PROXY" != 1 ]; then
say "proxy: $(sudo -n "$HELPER" status 2>/dev/null | tr '\n' ' ')"
fi
return 0
}
cmd_uninstall() {
stop_all
say "removing /usr/local/libexec/vless and its helpers (admin password needed)"
exec sudo /bin/bash "$PREFIX/uninstall"
}
case "${1:-status}" in
setup) shift; cmd_setup "${1:-}" ;;
on) shift; cmd_on "${1:-}" ;;
off) cmd_off ;;
status) cmd_status ;;
uninstall) cmd_uninstall ;;
__supervise) cmd_supervise "${2:-0}" ;;
*) say "usage: vless setup <link> | on [--keep] | off | status | uninstall"; exit 1 ;;
esac
#!/bin/bash
# vless-autostart — decides whether this network needs the tunnel.
#
# A network "needs" it when a few well-known sites fail to load directly. That
# covers campus/office filtering without hard-coding any one school's name, and
# it turns the tunnel off again on a normal connection.
#
# Called by the LaunchAgent on network changes, on login, and every 5 minutes.
set -u
VLESS=/usr/local/libexec/vless/vless
STATE="$HOME/.vless"
# no link configured (public build): stay silent instead of logging a failure every 5 minutes
SUB="${VLESS_SUB:-/usr/local/libexec/vless/subscription}"
[ -s "$SUB" ] || [ -s "$STATE/subscription" ] || exit 0
LOG="$HOME/Library/Logs/vless-autostart.log"
LOCK="$STATE/.autostart.lock"
mkdir -p "$STATE" "$(dirname "$LOG")" 2>/dev/null
log() { printf '%s %s\n' "$(date '+%F %T')" "$*" >>"$LOG"; }
up() { "$VLESS" status 2>/dev/null | grep -q 'tunnel=up'; }
probe() { # $1 = url -> 0 if reachable directly
curl -s -o /dev/null -w '%{http_code}' --max-time 7 --noproxy '*' "$1" 2>/dev/null | grep -q -E '^[23]'
}
# --- do we need it here? --------------------------------------------------
dom=$(ipconfig getoption en0 domain_name 2>/dev/null || true)
need=0
reason="network allows the sites we test"
case "${dom:-}" in
*islandschool*) need=1; reason="school domain $dom" ;;
esac
if [ "$need" = 0 ]; then
fails=0
for u in https://www.youtube.com/ https://www.instagram.com/ https://discord.com/; do
probe "$u" || fails=$((fails + 1))
done
if [ "$fails" -ge 2 ]; then
need=1
reason="direct access blocked ($fails/3 sites)"
fi
fi
if [ "${1:-}" = "--dry-run" ]; then
echo "need=$need dom=${dom:-none} reason=\"$reason\" tunnel=$(up && echo up || echo down)"
exit 0
fi
# --- one run at a time ----------------------------------------------------
if ! mkdir "$LOCK" 2>/dev/null; then
log "another run in progress; skipping"
exit 0
fi
trap 'rmdir "$LOCK" 2>/dev/null' EXIT
if [ "$need" = 1 ]; then
if up; then
log "needs tunnel ($reason); already up"
exit 0
fi
log "needs tunnel ($reason); starting"
if "$VLESS" on >>"$LOG" 2>&1; then
log "tunnel up"
else
log "tunnel failed; system proxy untouched"
fi
else
if up; then
if [ -f "$STATE/keep" ]; then
log "not needed here but keep flag set; leaving up"
else
log "not needed here ($reason); taking tunnel down"
"$VLESS" off >>"$LOG" 2>&1
fi
fi
fi
#!/bin/bash
# proxy-toggle — root helper. Points macOS system SOCKS proxy at the local
# tunnel, or clears it. Installed root:wheel; the sudoers rule allows only
# the verbs on|off|status for admin accounts.
set -u
PORT="${VLESS_PORT:-1080}"
HOST=127.0.0.1
services() {
networksetup -listallnetworkservices 2>/dev/null | tail -n +2 | sed 's/^\*//'
}
case "${1:-}" in
on)
services | while IFS= read -r s; do
[ -n "$s" ] || continue
networksetup -setsocksfirewallproxy "$s" "$HOST" "$PORT" >/dev/null 2>&1
networksetup -setsocksfirewallproxystate "$s" on >/dev/null 2>&1
done
echo "PROXY ON -> $HOST:$PORT (all services)"
;;
off)
# clear on every service, enabled or not, so nothing can blackhole traffic
services | while IFS= read -r s; do
[ -n "$s" ] || continue
networksetup -setsocksfirewallproxystate "$s" off >/dev/null 2>&1
done
echo "PROXY OFF (all services)"
;;
status)
scutil --proxy | grep -i -E "SOCKS" || echo "no socks proxy set"
;;
*)
echo "usage: proxy-toggle on|off|status" >&2
exit 1
;;
esac
#!/bin/bash
# postinstall — permissions, PATH symlink, sudoers rule, load the auto-start agent.
set -u
PREFIX=/usr/local/libexec/vless
LOG=/var/log/vless-install.log
exec 2>>"$LOG"
echo "--- $(date) install" >>"$LOG"
chmod 755 "$PREFIX" "$PREFIX/vless" "$PREFIX/vless-autostart" "$PREFIX/uninstall" "$PREFIX/xray"
chmod 644 "$PREFIX/subscription" "$PREFIX/README.html" 2>/dev/null
chmod 755 /usr/local/libexec/proxy-toggle
chown -R root:wheel "$PREFIX" /usr/local/libexec/proxy-toggle
# one-word command
mkdir -p /usr/local/bin
ln -sf ../libexec/vless/vless /usr/local/bin/vless
# let admin accounts flip the system proxy without a password prompt each time
mkdir -p /etc/sudoers.d
printf '%%admin ALL=(root) NOPASSWD: /usr/local/libexec/proxy-toggle\n' > /etc/sudoers.d/vless-proxy
chown root:wheel /etc/sudoers.d/vless-proxy
chmod 440 /etc/sudoers.d/vless-proxy
if ! visudo -cf /etc/sudoers.d/vless-proxy >>"$LOG" 2>&1; then
rm -f /etc/sudoers.d/vless-proxy
echo "sudoers rule rejected; the proxy toggle will ask for a password" >>"$LOG"
fi
# load the agent now for the logged-in user (also loaded at every login)
CUID=$(stat -f %u /dev/console)
if [ "${CUID:-0}" -ne 0 ]; then
launchctl asuser "$CUID" launchctl bootstrap "gui/$CUID" \
/Library/LaunchAgents/com.vless.autostart.plist >>"$LOG" 2>&1
fi
echo "install complete" >>"$LOG"
exit 0
#!/bin/bash
# uninstall — removes vless completely. Run through `sudo vless uninstall`.
set -u
CONSOLE_UID=$(stat -f %u /dev/console)
CONSOLE_USER=$(dscl . -list /Users UniqueID 2>/dev/null | awk -v u="$CONSOLE_UID" '$2==u{print $1; exit}')
echo "stopping tunnel"
if [ -n "${CONSOLE_USER:-}" ]; then
launchctl asuser "$CONSOLE_UID" sudo -u "$CONSOLE_USER" \
/usr/local/libexec/vless/vless off >/dev/null 2>&1
fi
echo "unloading auto-start"
launchctl bootout "gui/$CONSOLE_UID" /Library/LaunchAgents/com.vless.autostart.plist 2>/dev/null
rm -f /Library/LaunchAgents/com.vless.autostart.plist
rm -f /etc/sudoers.d/vless-proxy
if [ -x /usr/local/libexec/proxy-toggle ]; then
/usr/local/libexec/proxy-toggle off >/dev/null 2>&1
fi
rm -f /usr/local/bin/vless
rm -rf /usr/local/libexec/vless
for h in /Users/*; do
[ -d "$h/.vless" ] && rm -rf "$h/.vless"
done
echo "vless removed. Nothing else was changed."
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.vless.autostart</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>/usr/local/libexec/vless/vless-autostart</string>
</array>
<key>WatchPaths</key>
<array>
<string>/Library/Preferences/SystemConfiguration</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>300</integer>
<key>ThrottleInterval</key>
<integer>30</integer>
<key>ProcessType</key>
<string>Background</string>
<key>StandardOutPath</key>
<string>/tmp/vless-autostart.out</string>
<key>StandardErrorPath</key>
<string>/tmp/vless-autostart.err</string>
</dict>
</plist>