Skip to content

Commit 4b7adec

Browse files
committed
Add slipnet:// share URLs for SlipNet Android app
Generate slipnet:// deep-link URLs alongside dnst:// URLs in the setup summary. SlipNet uses a v16 pipe-delimited format (36 fields) with base64 encoding, separate from dnst:// JSON format. - Add generate_slipnet_url() helper function - Show both URL types in step_summary and do_add_domain - Update README (English + Farsi) with Share URLs section
1 parent 9f3760c commit 4b7adec

2 files changed

Lines changed: 122 additions & 8 deletions

File tree

README.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ Displays everything you need:
281281
- Server IP and domain
282282
- All 4 tunnel endpoints
283283
- DNSTT public key
284-
- `dnst://` share URLs for easy client configuration
284+
- `dnst://` share URLs for dnstc CLI client
285+
- `slipnet://` deep-link URLs for SlipNet Android app (tap to import)
285286
- SSH tunnel credentials (if configured) or warning if not set up
286287
- List of DNS resolvers for SlipNet
287288
- Client app download link
@@ -414,6 +415,21 @@ Each topic gives deep explanations of how things work, why each step is needed,
414415
| 🤖 Android | SlipNet |||
415416
| 🍎 iOS | HTTP Injector |||
416417

418+
### 🔗 Share URLs
419+
420+
The setup generates two types of share URLs for easy client configuration:
421+
422+
| URL Scheme | App | How to Use |
423+
|---|---|---|
424+
| `dnst://` | **dnstc** (CLI client) | Import with `dnstc tunnel import dnst://...` |
425+
| `slipnet://` | **SlipNet** (Android) | Tap the link on your phone — opens SlipNet and imports the profile automatically |
426+
427+
- **`dnst://`** URLs are generated by `dnstm tunnel share` and contain JSON-encoded tunnel config
428+
- **`slipnet://`** URLs are generated by the setup script and contain all fields SlipNet needs (domain, resolver, public key, SSH credentials)
429+
- HTTP Injector (iOS) does not support URL import — configure manually using the settings above
430+
431+
> 💡 The easiest way to set up a client is to copy a `slipnet://` link from the server summary and open it on your Android phone — SlipNet will import everything automatically.
432+
417433
### 🌍 Recommended DNS Resolvers
418434

419435
| Provider | IP | Note |
@@ -437,9 +453,12 @@ After setup, manage your tunnels with these commands:
437453
# 📋 View all tunnels and their status
438454
dnstm tunnel list
439455

440-
# 🔗 Generate a shareable dnst:// URL for a tunnel
456+
# 🔗 Generate share URLs for a tunnel
457+
# dnst:// URLs (for dnstc CLI client):
441458
dnstm tunnel share -t slip1
442459
dnstm tunnel share -t dnstt-ssh --user tunnel --password secret
460+
# slipnet:// URLs (for SlipNet Android app) are generated automatically
461+
# in the setup summary — tap the link on your phone to import the profile
443462

444463
# 📊 Check DNS Router status
445464
dnstm router status
@@ -770,7 +789,7 @@ sudo bash dnstm-setup.sh --add-domain
770789
9. 🧦 **بررسی پروکسی SOCKS** — تست microsocks (تشخیص خودکار پورت)
771790
10. 👤 **کاربر SSH** — ایجاد کاربر محدود برای تانل SSH (بدون آن تانل‌های SSH کار نمی‌کنند)
772791
11. 🧪 **تست‌های نهایی** — ۶ تست خودکار برای تأیید عملکرد
773-
12. 📊 **خلاصه** — نمایش تمام اطلاعات اتصال و لینک‌های اشتراک‌گذاری dnst://
792+
12. 📊 **خلاصه** — نمایش تمام اطلاعات اتصال، لینک‌های dnst:// (برای dnstc) و slipnet:// (برای اپ SlipNet)
774793

775794
---
776795

@@ -826,6 +845,21 @@ sudo bash dnstm-setup.sh --add-domain
826845
| 🤖 اندروید | SlipNet |||
827846
| 🍎 iOS | HTTP Injector |||
828847

848+
### 🔗 لینک‌های اشتراک‌گذاری
849+
850+
اسکریپت دو نوع لینک اشتراک‌گذاری تولید می‌کند:
851+
852+
| نوع لینک | اپلیکیشن | نحوه استفاده |
853+
|---|---|---|
854+
| `dnst://` | **dnstc** (کلاینت خط فرمان) | وارد کردن با `dnstc tunnel import dnst://...` |
855+
| `slipnet://` | **SlipNet** (اندروید) | روی لینک بزنید — اپ باز میشه و پروفایل خودکار اضافه میشه |
856+
857+
- لینک‌های `dnst://` توسط دستور `dnstm tunnel share` تولید می‌شوند و شامل اطلاعات JSON تانل هستند
858+
- لینک‌های `slipnet://` توسط اسکریپت تولید می‌شوند و شامل تمام اطلاعات مورد نیاز SlipNet هستند (دامنه، resolver، کلید عمومی، اطلاعات SSH)
859+
- HTTP Injector (iOS) از لینک پشتیبانی نمی‌کند — تنظیمات را دستی وارد کنید
860+
861+
> 💡 ساده‌ترین راه: لینک `slipnet://` را از خلاصه سرور کپی کنید و روی گوشی اندرویدتان باز کنید — SlipNet همه چیز را خودکار وارد می‌کند.
862+
829863
### 🌍 DNS Resolverهای پیشنهادی
830864

831865
| ارائه‌دهنده | آدرس | توضیح |
@@ -851,8 +885,9 @@ sudo bash dnstm-setup.sh --add-domain
851885
# 📋 نمایش تمام تانل‌ها و وضعیت آنها
852886
dnstm tunnel list
853887

854-
# 🔗 ایجاد لینک اشتراک‌گذاری
888+
# 🔗 ایجاد لینک اشتراک‌گذاری (dnst:// برای dnstc)
855889
dnstm tunnel share -t slip1
890+
# لینک‌های slipnet:// برای اپ SlipNet خودکار در خلاصه نصب نمایش داده می‌شوند
856891

857892
# 📊 بررسی وضعیت روتر
858893
dnstm router status

dnstm-setup.sh

Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,42 @@ show_about() {
545545
echo ""
546546
}
547547

548+
# ─── SlipNet URL Generator ────────────────────────────────────────────────────
549+
550+
# Generate a slipnet:// deep-link URL for the SlipNet Android app.
551+
# Usage: generate_slipnet_url <tunnel_type> <subdomain> [pubkey] [ssh_user] [ssh_pass]
552+
# tunnel_type: "slipstream" or "dnstt"
553+
# subdomain: e.g. "t2" or "d2"
554+
# pubkey: DNSTT public key (required for dnstt, empty for slipstream)
555+
# ssh_user: SSH tunnel username (optional)
556+
# ssh_pass: SSH tunnel password (optional)
557+
generate_slipnet_url() {
558+
local tunnel_type="$1"
559+
local subdomain="$2"
560+
local pubkey="${3:-}"
561+
local ssh_user="${4:-}"
562+
local ssh_pass="${5:-}"
563+
local name="${subdomain}.${DOMAIN}"
564+
local ns_domain="${subdomain}.${DOMAIN}"
565+
local resolver="8.8.8.8:53:0"
566+
local ssh_enabled="" ssh_port="22" ssh_host="127.0.0.1"
567+
568+
if [[ -n "$ssh_user" && -n "$ssh_pass" ]]; then
569+
ssh_enabled="1"
570+
fi
571+
572+
# v16 pipe-delimited format (36 fields):
573+
# 1:version 2:tunnelType 3:name 4:domain 5:resolvers 6:authMode 7:keepAlive
574+
# 8:cc 9:port 10:host 11:gso 12:dnsttPublicKey 13:socksUser 14:socksPass
575+
# 15:sshEnabled 16:sshUser 17:sshPass 18:sshPort 19:fwdDns 20:sshHost
576+
# 21:useServerDns 22:dohUrl 23:dnsTransport 24:sshAuthType 25:sshPrivKey
577+
# 26:sshKeyPass 27:torBridges 28:dnsttAuthoritative 29:naivePort
578+
# 30:naiveUser 31:naivePass 32:isLocked 33:lockHash 34:expiration
579+
# 35:allowSharing 36:boundDeviceId
580+
local data="16|${tunnel_type}|${name}|${ns_domain}|${resolver}|0|5000|bbr|1080|127.0.0.1|0|${pubkey}|||${ssh_enabled}|${ssh_user}|${ssh_pass}|${ssh_port}|0|${ssh_host}|0||udp|password|||0|443||||0||0|0|"
581+
echo "slipnet://$(echo -n "$data" | base64 -w0)"
582+
}
583+
548584
# ─── Security Hardening Helpers ────────────────────────────────────────────────
549585

550586
ensure_resolv_conf_fallback() {
@@ -1814,8 +1850,8 @@ step_summary() {
18141850
echo ""
18151851
fi
18161852

1817-
# Generate share URLs
1818-
echo -e " ${BOLD}Share URLs (dnst://)${NC}"
1853+
# Generate share URLs (dnst:// for dnstc CLI)
1854+
echo -e " ${BOLD}Share URLs dnst:// (for dnstc CLI)${NC}"
18191855
echo -e " ${DIM}────────────────────────────────────────${NC}"
18201856
local share_url
18211857
for tag in slip1 dnstt1; do
@@ -1834,6 +1870,29 @@ step_summary() {
18341870
fi
18351871
echo ""
18361872

1873+
# Generate SlipNet deep-link URLs (slipnet:// for SlipNet Android app)
1874+
echo -e " ${BOLD}Share URLs — slipnet:// (for SlipNet app)${NC}"
1875+
echo -e " ${DIM}────────────────────────────────────────${NC}"
1876+
local slipnet_url
1877+
# Slipstream + SOCKS
1878+
slipnet_url=$(generate_slipnet_url "slipstream" "t2" "" "" "")
1879+
echo -e " ${GREEN}slip1:${NC} ${slipnet_url}"
1880+
# DNSTT + SOCKS
1881+
if [[ -n "$DNSTT_PUBKEY" ]]; then
1882+
slipnet_url=$(generate_slipnet_url "dnstt" "d2" "$DNSTT_PUBKEY" "" "")
1883+
echo -e " ${GREEN}dnstt1:${NC} ${slipnet_url}"
1884+
fi
1885+
# SSH tunnels
1886+
if [[ "$SSH_SETUP_DONE" == true && -n "$SSH_USER" && -n "$SSH_PASS" ]]; then
1887+
slipnet_url=$(generate_slipnet_url "slipstream" "s2" "" "$SSH_USER" "$SSH_PASS")
1888+
echo -e " ${GREEN}slip-ssh:${NC} ${slipnet_url}"
1889+
if [[ -n "$DNSTT_PUBKEY" ]]; then
1890+
slipnet_url=$(generate_slipnet_url "dnstt" "ds2" "$DNSTT_PUBKEY" "$SSH_USER" "$SSH_PASS")
1891+
echo -e " ${GREEN}dnstt-ssh:${NC} ${slipnet_url}"
1892+
fi
1893+
fi
1894+
echo ""
1895+
18371896
if [[ "$SSH_SETUP_DONE" == true ]]; then
18381897
echo -e " ${BOLD}SSH Tunnel User${NC}"
18391898
echo -e " ${DIM}────────────────────────────────────────${NC}"
@@ -2153,8 +2212,8 @@ do_add_domain() {
21532212
echo ""
21542213
fi
21552214

2156-
# Generate share URLs for new tunnels
2157-
echo -e " ${BOLD}Share URLs (dnst://)${NC}"
2215+
# Generate share URLs for new tunnels (dnst:// for dnstc CLI)
2216+
echo -e " ${BOLD}Share URLs dnst:// (for dnstc CLI)${NC}"
21582217
echo -e " ${DIM}────────────────────────────────────────${NC}"
21592218
local share_url
21602219
for tag in "$slip_tag" "$dnstt_tag"; do
@@ -2171,6 +2230,26 @@ do_add_domain() {
21712230
done
21722231
echo ""
21732232

2233+
# Generate SlipNet deep-link URLs for new tunnels (slipnet:// for SlipNet app)
2234+
echo -e " ${BOLD}Share URLs — slipnet:// (for SlipNet app)${NC}"
2235+
echo -e " ${DIM}────────────────────────────────────────${NC}"
2236+
local slipnet_url
2237+
slipnet_url=$(generate_slipnet_url "slipstream" "t2" "" "" "")
2238+
echo -e " ${GREEN}${slip_tag}:${NC} ${slipnet_url}"
2239+
if [[ -n "$DNSTT_PUBKEY" ]]; then
2240+
slipnet_url=$(generate_slipnet_url "dnstt" "d2" "$DNSTT_PUBKEY" "" "")
2241+
echo -e " ${GREEN}${dnstt_tag}:${NC} ${slipnet_url}"
2242+
fi
2243+
if [[ -n "$SSH_USER" && -n "$SSH_PASS" ]]; then
2244+
slipnet_url=$(generate_slipnet_url "slipstream" "s2" "" "$SSH_USER" "$SSH_PASS")
2245+
echo -e " ${GREEN}${slip_ssh_tag}:${NC} ${slipnet_url}"
2246+
if [[ -n "$DNSTT_PUBKEY" ]]; then
2247+
slipnet_url=$(generate_slipnet_url "dnstt" "ds2" "$DNSTT_PUBKEY" "$SSH_USER" "$SSH_PASS")
2248+
echo -e " ${GREEN}${dnstt_ssh_tag}:${NC} ${slipnet_url}"
2249+
fi
2250+
fi
2251+
echo ""
2252+
21742253
echo -e " ${DIM}To add more domains, run again: sudo bash $0 --add-domain${NC}"
21752254
echo ""
21762255
}

0 commit comments

Comments
 (0)