mirror of https://github.com/wulabing/Xray_onekey
parent
8ff4bb7b6e
commit
b63794757a
|
@ -97,11 +97,19 @@ http {
|
|||
file = io.open("/etc/openresty/allow.list","a+")
|
||||
io.input(file)
|
||||
io.output(file)
|
||||
io.write("allow "..clientIP..";\n")
|
||||
ngx.print("当前IP:"..clientIP.."已添加至白名单")
|
||||
for line in file:lines() do
|
||||
if string.find(line,clientIP) then
|
||||
m = string.find(line,clientIP)
|
||||
ngx.print("当前IP:"..clientIP.."已存在,无需添加")
|
||||
end
|
||||
end
|
||||
if m == nil then
|
||||
io.write("allow "..clientIP..";\n")
|
||||
ngx.print("当前IP:"..clientIP.."已添加至白名单")
|
||||
end
|
||||
io.close(file)
|
||||
os.execute("/usr/local/openresty/nginx/sbin/nginx -s reload")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue