bepass-org / warp-plus

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

[Wiki] Running warp-plus on OpenWRT as a service #47

Open euphoria360 opened 8 months ago

euphoria360 commented 8 months ago

It's just a guide on how to run this on OpenWRT as a service on startup. nothing fancy.

USE_PROCD=1

START=88 STOP=89

PROG=/usr/local/bin/warp-plus PROG_CONF=/etc/wplus/config.json

start_service() { procd_open_instance procd_set_param command "$PROG" -c "$PROG_CONF" procd_set_param file "$PROG_CONF" procd_set_param stdout 1 procd_set_param stderr 1 procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5} procd_close_instance }



- Start and enable the service.
`/etc/init.d/wplus start`
`/etc/init.d/wplus enable`

Enjoy!

P.S If you want to to see the logs, just use **logread**:
`logread -f |grep "warp-plus"`
mfat commented 7 months ago

@euphoria360 thanks but executable should never be placed in /etc/. You can put it in /usr/bin.

euphoria360 commented 6 months ago

Yes. As you said it's place shouldn't be in /etc. Although I think /usr/bin is usually for distribution executables. I'll edit and put them on /usr/local/bin folder.

FreddyZeng commented 6 months ago

Who can give a example about "tun-experimental: true" in openwrt, appreciate

euphoria360 commented 6 months ago

Who can give a example about "tun-experimental: true" in openwrt, appreciate

Unfortunately, Warp-Plus stopped working for me after a recent incident (Raisi Helicopter Incident). I would love to test it for you but first I should make wplus work.

Edit: It works again with v1.2.2. Ill try to test the TUN functionality

markpash commented 6 months ago

Who can give a example about "tun-experimental: true" in openwrt, appreciate

Unfortunately, Warp-Plus stopped working for me after a recent incident (Raisi Helicopter Incident). I would love to test it for you but first I should make wplus work.

Edit: It works again with v1.2.2. Ill try to test the TUN functionality

Who can give a example about "tun-experimental: true" in openwrt, appreciate

Unfortunately, Warp-Plus stopped working for me after a recent incident (Raisi Helicopter Incident). I would love to test it for you but first I should make wplus work.

Edit: It works again with v1.2.2. Ill try to test the TUN functionality

From my testing, tun works on linux, but you need to configure ip addressing and routing manually. I've also included the ability to set fwmark so that you can reliably prevent looping if you set the tun interface to be the default route.

I've included some notes here: https://github.com/bepass-org/warp-plus/issues/66#issuecomment-2080407042

euphoria360 commented 6 months ago

Who can give a example about "tun-experimental: true" in openwrt, appreciate

I can Confirm It's working.

root@a-r:~# cat /etc/wplus/config.json
{
  "verbose": false,
  "bind": "0.0.0.0:8086",
  "endpoint": "",
  "key": "",
  "gool": true,
  "cfon": false,
  "country": "US",
  "scan": true,
  "cache-dir": "/tmp/wplus/cache",
  "tun-experimental": true,
  "rtt": "1000ms"
}
root@a-r:~# /opt/wplus/warp-plus -4 -c /etc/wplus/config.json
time=2024-05-28T18:29:38.103Z level=INFO msg="scanner mode enabled" max-rtt=1s
time=2024-05-28T18:29:38.104Z level=INFO msg="tun mode enabled"
time=2024-05-28T18:29:38.106Z level=INFO msg="successfully loaded warp identity" subsystem=warp/account
time=2024-05-28T18:29:43.108Z level=INFO msg="scan results" endpoints="[{AddrPort:188.114.99.73:928 RTT:200.291207ms CreatedAt:2024-05-28 18:29:40.054781314 +0000 UTC m=+1.966538200} {AddrPort:162.159.192.129:903 RTT:209.120521ms CreatedAt:2024-05-28 18:29:42.317749119 +0000 UTC m=+4.229506004}]"
time=2024-05-28T18:29:43.108Z level=INFO msg="using warp endpoints" endpoints="[188.114.99.73:928 162.159.192.129:903]"
time=2024-05-28T18:29:43.108Z level=INFO msg="running in warp-in-warp (gool) mode"
time=2024-05-28T18:29:43.109Z level=INFO msg="successfully loaded warp identity" subsystem=warp/account
time=2024-05-28T18:29:47.854Z level=INFO msg="connection test successful"
time=2024-05-28T18:29:47.856Z level=INFO msg="successfully loaded warp identity" subsystem=warp/account
time=2024-05-28T18:29:47.888Z level=INFO msg="serving tun" interface=warp0
root@a-r:~# ping -I warp0 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=59 time=127.704 ms
64 bytes from 8.8.8.8: seq=1 ttl=59 time=121.846 ms
64 bytes from 8.8.8.8: seq=2 ttl=59 time=125.321 ms
64 bytes from 8.8.8.8: seq=3 ttl=59 time=119.947 ms
euphoria360 commented 6 months ago

Who can give a example about "tun-experimental: true" in openwrt, appreciate

Unfortunately, Warp-Plus stopped working for me after a recent incident (Raisi Helicopter Incident). I would love to test it for you but first I should make wplus work. Edit: It works again with v1.2.2. Ill try to test the TUN functionality

Who can give a example about "tun-experimental: true" in openwrt, appreciate

Unfortunately, Warp-Plus stopped working for me after a recent incident (Raisi Helicopter Incident). I would love to test it for you but first I should make wplus work. Edit: It works again with v1.2.2. Ill try to test the TUN functionality

From my testing, tun works on linux, but you need to configure ip addressing and routing manually. I've also included the ability to set fwmark so that you can reliably prevent looping if you set the tun interface to be the default route.

I've included some notes here: #66 (comment)

A suggestion: Is it possible to keep sock proxy listening even while TUN option is enabled?

markpash commented 6 months ago

A suggestion: Is it possible to keep sock proxy listening even while TUN option is enabled?

It's not a priority. But I will think about it.

fakhamatia commented 2 months ago

If I have system proxy (transparent proxy) and run warp, warp pass through proxy or not?