luci-app-tinyproxy: error check socks5 upstream (#6303)
Signed-off-by: Paul Donald <newtwen@gmail.com>
This commit is contained in:
parent
fd2d2ac734
commit
b3d1d056f4
1 changed files with 12 additions and 0 deletions
|
@ -236,4 +236,16 @@ v = s:option(Value, "via", translate("Via proxy"),
|
|||
v:depends({type="proxy"})
|
||||
v.placeholder = "10.0.0.1:8080"
|
||||
|
||||
function v.write(self, section, value)
|
||||
|
||||
local pattern1 = "^%d+%.%d+%.%d+%.%d+:%d+$"
|
||||
local pattern2 = "^socks5 %d+%.%d+%.%d+%.%d+:%d+$"
|
||||
|
||||
if string.match(value, pattern1) or string.match(value, pattern2) then
|
||||
Value.write(self, section, value)
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
return m
|
||||
|
|
Loading…
Reference in a new issue