Xray-0.2.0

[update] 添加配置自动应用,重复IP判断
pull/411/head
wulabing 2022-06-02 17:35:48 +08:00
parent 8ff4bb7b6e
commit b63794757a
No known key found for this signature in database
GPG Key ID: 213391AFDF73AE00
1 changed files with 11 additions and 3 deletions

View File

@ -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")
}
}
}
}