22 มิถุนายน 2567

Mikrotik RouterOS donwload script

Script download latest RouterOS (Main Package and Extra Package)
for architectures
- x86
- arm64
- arm
- mipsbe
- mmips
- ppc
- smips

and check existing local file before download

https://github.com/leakung/getRouterOS

17 มิถุนายน 2567

Mikrotik script monitor wireguard connection and reconnect with new listen port

wireguard name : wg1
port range : 13232 - 13239

/system script
add dont-require-permissions=no name=checkWireguard owner=admin source=":local wgName wg1;\r\
    \n:local newPort [:rndstr length=1 from=\"23456789\"];\r\
    \n:local newPort (\"1323\".\$newPort);\r\
    \n\r\
    \n:if ([/interface wireguard get [find name=\$wgName] running] = true) do={\r\
    \n\r\
    \n  :local pingResult [/ping count=1 10.10.10.1];\r\
    \n\r\
    \n  :if (\$pingResult = 0) do={\r\
    \n\r\
    \n    :log warning \"\$wgName connection lost. Changing listen port...\";\r\
    \n\r\
    \n    /interface wireguard set [find name=\$wgName] disabled=yes\r\
    \n    /interface wireguard set [find name=\$wgName] listen-port=\$newPort;\r\
    \n    /interface wireguard set [find name=\$wgName] disabled=no\r\
    \n\r\
    \n    :local currentPort [/interface wireguard get [find name=\$wgName] listen-port];\r\
    \n    :log warning \"WireGuard \$wgName listen port changed to \$currentPort\";\r\
    \n\r\
    \n  }\r\
    \n  \r\
    \n}"

/system scheduler
add interval=1m name=checkWireguard on-event=checkWireguard start-time=startup

15 มิถุนายน 2567

Cloudflare Tunnel docker compose

docker-compose.yml
services:
  cloudflared:
    image: cloudflare/cloudflared
    container_name: cloudflared
    restart: unless-stopped
    command: tunnel run
    environment:
      - TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN}
    network_mode: host

.env
CLOUDFLARE_TUNNEL_TOKEN=XXXX


git clone https://github.com/leakung/cf-compose cloudflare-tunnel