bepass-org / warp-plus

Warp+Psiphon, an anti censorship utility for iran
MIT License
1.33k stars 238 forks source link

TUN Mode #66

Open zoghal opened 2 months ago

zoghal commented 2 months ago

سلام و عرض ادب داشتم یه بتچ فایل برای خودم مینوشتم تا با کمک tun2socks بتونم تمام ترافیک سیستم رو به وارپ پلاس پروکسی کنم(اسکریپت).

مشکلی که هست اینه وارپ پلاس هروقت اجرا میشه ای‌پی endpoints متغیره و تغییر میکنه. که البته خیلی هم خوب است! منتهی من برای اجرای tun2socks لازم دارم قبلش اون ای‌پی که برای endpoints وارپ پلاس ست شده رو پیدا کنم و هنگام روت کردن ترافیک سیستم این این ای‌پی رو از کل سیستم مستثنی کنم.

برای اینکار دو راهکار پیشنهادی دارم. ۱- وارپ پلاس زمان اجرا خودش ای‌پی endpoints رو در یک متغییر(environment variables) ست کنه! ۲- وارپ پلاس زمان اجرا ای‌پی endpoints رو در یک فایل تو فولدر stuff ذخیره کنه!

Amir2367 commented 2 months ago

سلام و عرض ادب داشتم یه بتچ فایل برای خودم مینوشتم تا با کمک tun2socks بتونم تمام ترافیک سیستم رو به وارپ پلاس پروکسی کنم(اسکریپت).

مشکلی که هست اینه وارپ پلاس هروقت اجرا میشه ای‌پی endpoints متغیره و تغییر میکنه. که البته خیلی هم خوب است! منتهی من برای اجرای tun2socks لازم دارم قبلش اون ای‌پی که برای endpoints وارپ پلاس ست شده رو پیدا کنم و هنگام روت کردن ترافیک سیستم این این ای‌پی رو از کل سیستم مستثنی کنم.

برای اینکار دو راهکار پیشنهادی دارم. ۱- وارپ پلاس زمان اجرا خودش ای‌پی endpoints رو در یک متغییر(environment variables) ست کنه! ۲- وارپ پلاس زمان اجرا ای‌پی endpoints رو در یک فایل تو فولدر stuff ذخیره کنه!

منم با این نظر دوستمون موافقم

zoghal commented 2 months ago

@markpash مهندس کاری میشه واسه این مورد کرد؟ امیدی هست؟

markpash commented 2 months ago

Hi,

I'm thinking about enabling native tun support instead of tun2socks. But if I can't, I could potentially use something called fwmark on Linux which would allow you to isolate the connections from this application and route them differently without knowing the endpoint IP.

These things are on my to-do list, no worries. ❤️

markpash commented 2 months ago

@zoghal Hi I have a testing build with Tun support on Linux. Can you please test it and report back? Fetch the correct file for your platform from here: https://github.com/bepass-org/warp-plus/actions/runs/8858306802?pr=79 I have added a couple of new flags which enable the feature but it also requires configuration on the linux side too.

  1. Run the binary with sudo or root and then pass the following flags --scan --tun --fwmark 0x1375
  2. Run ip addr show and you should see a new network interface called warp0
  3. Run sudo ip link set warp0 up
  4. Run sudo ip addr add 172.16.0.2/24 dev warp0
  5. Run sudo ip rule add table main suppress_prefixlength 0
  6. Run sudo ip rule add not fwmark 0x1375 table 1375
  7. Run sudo ip route add default dev warp0 table 1375

The above commands configure the routing tables to send the traffic from warp-plus through your normal internet, but all other traffic through warp-plus. This is temporary and will reset after reboot or when warp-plus is closed.

Don't run this on a server or a device you can only access through SSH as this will break SSH connectivity. For that to work you will need to write iptables/nftables rules to prevent inbound connections from routing through warp-plus.

zoghal commented 2 months ago

ضمن تشکر از بابت وقتی که گذاشتی 🙏

متاسفانه من تا چند روز دسترسی به سیستی که روش لینوکس دستکاپ باشم ندارم. لذا سعی کردم در WSL ویندوز تست کنم. اجرا شد، منتهی در روت کردن ترافیک، تلاشم به جایی نرسید.

تو پرانتز(): بنظرم یه سویچ -v هم برای نشون دادن نسخه هم اضافه بشود، خیلی عالی میشه.🥰

markpash commented 1 month ago

There's experimental tun support for Linux and Windows in the latest version (v1.2.0). The linux version is manual and requires following the instructions I wrote above. Windows is automatic.

Please test and give feedback.

zoghal commented 1 month ago

ممنون چه خبر خوبی!🤓 اما متاسفانه ترافیک کلادفلر روی adsl های‌وب هنوز مسدود هست!

به محض آزاد شدن! حتما امتحانش می‌کنم.

AliGh1 commented 1 month ago

Issue: Error Creating Interface Due to Missing wintun.dll

Description

When running warp-plus with the --tun-experimental flag, the process fails to create the interface due to a missing wintun.dll library. The error message indicates that the specified module could not be found.

Steps to Reproduce

  1. Execute warp-plus --tun-experimental in the terminal.
  2. Observe the log output.

Log Output

time=2024-05-24T14:00:57.839+03:30 level=INFO msg="tun mode enabled"
time=2024-05-24T14:00:57.846+03:30 level=INFO msg="successfully generated wireguard configuration" subsystem=warp/account
time=2024-05-24T14:00:57.848+03:30 level=INFO msg="successfully generated wireguard configuration" subsystem=warp/account
time=2024-05-24T14:00:57.848+03:30 level=INFO msg="using warp endpoints" endpoints="[188.114.99.106:8742 188.114.99.106:8742]"
time=2024-05-24T14:00:57.848+03:30 level=INFO msg="running in normal warp mode"
time=2024-05-24T14:00:57.850+03:30 level=ERROR msg="Error creating interface: Error loading wintun.dll DLL: Unable to load library: The specified module could not be found."

Expected Behavior

The interface should be created successfully without errors when warp-plus is run in experimental TUN mode.

Actual Behavior

The process fails with an error indicating that the wintun.dll module could not be found, preventing the creation of the interface.

Environment

Soberia commented 1 month ago

@AliGh1 Download Wintun driver and place it beside the warp-plus.exe.

AliGh1 commented 1 month ago

@Soberia @markpash Thanks for the guidance. To enhance the user experience, it would be helpful if the requirement to download the Wintun driver was included in the project's README or the Wintun driver directly in the project. This way, new users will have clear instructions on what they need to do.

mldaali commented 23 hours ago

Hi @markpash Is it possible to have a switch to set the tunnel name and create multiple tunnels simultaneously? I want to have another tunnel on the same server to route my traffic using the --gool feature, while the rest of the traffic goes through the primary tunnel (warp0) for better speed.

Thanks in advance.