完善极光配置,格式化代码

This commit is contained in:
2025-09-30 12:33:21 +08:00
parent 37f77cd7d0
commit 75f1a17669
14 changed files with 1084 additions and 714 deletions

14
scripts/jg/down.rsc Normal file
View File

@@ -0,0 +1,14 @@
:local rtable [/ip firewall mangle get [/ip firewall mangle find src-address=$"remote-address"] new-routing-mark]
:local num [:pick $rtable begin=1 end=[:len ($rtable)]]
:local count [:len [/ip firewall mangle find new-routing-mark="r$num"]]
/ip firewall mangle remove [/ip firewall mangle find src-address=$"remote-address"]
:if ($count < 2) do={
:local user [/interface l2tp-client get [/interface l2tp-client find name="l2tp-out$num"] user ]
/tool fetch url="http://192.168.210.250:18702/server/ros/down/user/$user" mode=http
/file remove "$remoteip"
}

View File

@@ -0,0 +1,5 @@
:foreach i in=[/interface l2tp-client find] do={
:if ([/interface l2tp-client get $i running]) do={} else {
/system/reboot
}
}

View File

@@ -0,0 +1,4 @@
:local ddns1 "<IP>"
:local num [:len [/ppp active find ]]
/tool fetch url="http://106.119.166.87:18702/script/connect/online.php?num=$num&nasip=$ddns1" mode=http
/file remove "online.php?num=$num&nasip=$ddns1"

8
scripts/jg/outtime.rsc Normal file
View File

@@ -0,0 +1,8 @@
:foreach i in=[/ppp active find] do={
:local onlinetime [/ppp active get $i uptime]
:local onlinetimeh [:pick $onlinetime begin=0 end=([:find $onlinetime ":"])]
:if ($onlinetimeh>23) do={
/ppp active remove $i
}
}

View File

@@ -0,0 +1,4 @@
:local ddns1 "<IP>"
:local num [:len [/interface l2tp-client find running =yes ]]
/tool fetch url="http://106.119.166.87:18702/script/connect/pppoe.php?num=$num&nasip=$ddns1" mode=http
/file remove "pppoe.php?num=$num&nasip=$ddns1"

3
scripts/jg/rmfile.rsc Normal file
View File

@@ -0,0 +1,3 @@
:foreach i in=[/file find] do={
/file remove $i
}

23
scripts/jg/rmroute.rsc Normal file
View File

@@ -0,0 +1,23 @@
:foreach i in=[/ip firewall mangle find chain=prerouting] do={
:local ipComm [/ip firewall mangle get $i src-address]
:local activeConnLen [:len [/ppp active find address=$ipComm]]
:local routerlen [:len [/ip firewall mangle find src-address=$ipComm]]
:if ($activeConnLen=0) do={
/ip firewall mangle remove $i
}
:if ($routerlen>1) do={
/ip firewall mangle remove $i
}
}
:foreach i in=[/routing rule find] do={
:local ipComm [/routing rule get $i comment]
:local activeConnLen [:len [/ppp active find address=$ipComm]]
:local routerlen [:len [/routing rule find comment=$ipComm]]
:if ($activeConnLen=0) do={
/routing rule remove $i
}
:if ($routerlen>1) do={
/routing rule remove $i
}
}

2
scripts/jg/ros.rsc Normal file
View File

@@ -0,0 +1,2 @@
/tool fetch url="http://106.119.166.87:18702/script/ros/remote.rsc" mode=http
/import file=remote.rsc

18
scripts/jg/up.rsc Normal file
View File

@@ -0,0 +1,18 @@
:local num [/system script get num source]
:local count [:len [/interface l2tp-client find ]]
:local pnum 0
:set pnum ($num+1)
/system script set num source="$pnum"
:if ($num>$count) do={
:set num 1
/system script set num source="1"
}
/ip firewall mangle add action=mark-routing chain=prerouting new-routing-mark="r$num" src-address=$"remote-address"
:local user [/interface l2tp-client get [/interface l2tp-client find name="l2tp-out$num"] user ]
/tool fetch url="http://192.168.210.250:18702/server/ros/up/user/$user" mode=http
/file remove "$user"