Skip to content

safely detect global IPv4 and close socket properly and Harden get_subscription_payload against malformed tokens - #21

Closed
zZedix wants to merge 7 commits into
PasarGuard:nextfrom
zZedix:main
Closed

safely detect global IPv4 and close socket properly and Harden get_subscription_payload against malformed tokens#21
zZedix wants to merge 7 commits into
PasarGuard:nextfrom
zZedix:main

Conversation

@zZedix

@zZedix zZedix commented Oct 5, 2025

Copy link
Copy Markdown
Contributor

Improve public IP detection with multiple HTTP and socket fallbacks

Add layered fallback strategy using ipify, icanhazip, and ifconfig.io with IPv4 enforcement.
Falls back to UDP socket check when HTTP methods fail, and defaults to 127.0.0.1.
Ensures IPv6 is disabled for reliability and includes proper socket cleanup.

Improves resilience of get_subscription_payload by validating decoded token format
and preventing IndexError/ValueError for tampered or malformed tokens.

Added split and numeric validation for custom token decoding
Ensures consistent None return instead of 500 on invalid input
Keeps behavior unchanged for valid subscription tokens

zZedix added 7 commits October 5, 2025 01:52
- اضافه کردن لوگوی PasarGuard
- بهبود طراحی بصری با ایموجی‌ها و جداول
- ترجمه کامل به فارسی و انگلیسی
- ساختار بهتر و خوانایی بیشتر
- اضافه کردن بخش‌های جدید و بهبود یافته
- حل تضاد merge در README.md
- نگه‌داری نسخه بهبود یافته با لوگو و طراحی زیبا
- حل تضاد در فایل‌های utils
- Remove all Persian translations
- Keep only English content
- Maintain beautiful design and emojis
- Clean and professional English documentation
@zZedix zZedix closed this Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant