diff --git a/package/lienol/luci-app-fileassistant/Makefile b/package/lienol/luci-app-fileassistant/Makefile
new file mode 100644
index 0000000000..f9c2df58f3
--- /dev/null
+++ b/package/lienol/luci-app-fileassistant/Makefile
@@ -0,0 +1,14 @@
+# From https://github.com/DarkDean89/luci-app-filebrowser
+# From https://github.com/stuarthua/oh-my-openwrt/tree/master/stuart/luci-app-fileassistant
+# This is free software, licensed under the Apache License, Version 2.0 .
+
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:=LuCI support for Fileassistant
+LUCI_PKGARCH:=all
+PKG_VERSION:=1.0
+PKG_RELEASE:=2
+
+include $(TOPDIR)/feeds/luci/luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
diff --git a/package/lienol/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/fb.css b/package/lienol/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/fb.css
new file mode 100644
index 0000000000..96cbbb3fc5
--- /dev/null
+++ b/package/lienol/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/fb.css
@@ -0,0 +1,68 @@
+.fb-container {
+ margin-top: 1rem;
+}
+.fb-container .cbi-button {
+ height: 1.8rem;
+}
+.fb-container .cbi-input-text {
+ margin-bottom: 1rem;
+ width: 100%;
+}
+.fb-container .panel-title {
+ padding-bottom: 0;
+ width: 50%;
+ border-bottom: none;
+}
+.fb-container .panel-container {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding-bottom: 1rem;
+ border-bottom: 1px solid #eee;
+}
+.fb-container .upload-container {
+ display: none;
+ margin: 1rem 0;
+}
+.fb-container .upload-file {
+ margin-right: 2rem;
+}
+.fb-container .cbi-value-field {
+ text-align: left;
+}
+.fb-container .parent-icon strong {
+ margin-left: 1rem;
+}
+.fb-container td[class$="-icon"] {
+ cursor: pointer;
+}
+.fb-container .file-icon, .fb-container .folder-icon, .fb-container .link-icon {
+ position: relative;
+}
+.fb-container .file-icon:before, .fb-container .folder-icon:before, .fb-container .link-icon:before {
+ display: inline-block;
+ width: 1.5rem;
+ height: 1.5rem;
+ content: '';
+ background-size: contain;
+ margin: 0 0.5rem 0 1rem;
+ vertical-align: middle;
+}
+.fb-container .file-icon:before {
+ background-image: url(file-icon.png);
+}
+.fb-container .folder-icon:before {
+ background-image: url(folder-icon.png);
+}
+.fb-container .link-icon:before {
+ background-image: url(link-icon.png);
+}
+@media screen and (max-width: 480px) {
+ .fb-container .upload-file {
+ width: 14.6rem;
+ }
+ .fb-container .cbi-value-owner,
+ .fb-container .cbi-value-perm {
+ display: none;
+ }
+}
diff --git a/package/lienol/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/fb.js b/package/lienol/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/fb.js
new file mode 100644
index 0000000000..2e3addef81
--- /dev/null
+++ b/package/lienol/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/fb.js
@@ -0,0 +1,288 @@
+String.prototype.replaceAll = function(search, replacement) {
+ var target = this;
+ return target.replace(new RegExp(search, 'g'), replacement);
+};
+(function () {
+ var iwxhr = new XHR();
+ var listElem = document.getElementById("list-content");
+ listElem.onclick = handleClick;
+ var currentPath;
+ var pathElem = document.getElementById("current-path");
+ pathElem.onblur = function () {
+ update_list(this.value.trim());
+ };
+ pathElem.onkeyup = function (evt) {
+ if (evt.keyCode == 13) {
+ this.blur();
+ }
+ };
+ function removePath(filename, isdir) {
+ var c = confirm('你确定要删除 ' + filename + ' 吗?');
+ if (c) {
+ iwxhr.get('/cgi-bin/luci/admin/nas/fileassistant/delete',
+ {
+ path: concatPath(currentPath, filename),
+ isdir: isdir
+ },
+ function (x, res) {
+ if (res.ec === 0) {
+ refresh_list(res.data, currentPath);
+ }
+ });
+ }
+ }
+
+ function installPath(filename, isdir) {
+ if (isdir === "1") {
+ alert('这是一个目录,请选择 ipk 文件进行安装!');
+ return;
+ }
+ var isipk = isIPK(filename);
+ if (isipk === 0) {
+ alert('只允许安装 ipk 格式的文件!');
+ return;
+ }
+ var c = confirm('你确定要安装 ' + filename + ' 吗?');
+ if (c) {
+ iwxhr.get('/cgi-bin/luci/admin/nas/fileassistant/install',
+ {
+ filepath: concatPath(currentPath, filename),
+ isdir: isdir
+ },
+ function (x, res) {
+ if (res.ec === 0) {
+ location.reload();
+ alert('安装成功!');
+ } else {
+ alert('安装失败,请检查文件格式!');
+ }
+ });
+ }
+ }
+
+ function isIPK(filename) {
+ var index= filename.lastIndexOf(".");
+ var ext = filename.substr(index+1);
+ if (ext === 'ipk') {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ function renamePath(filename) {
+ var newname = prompt('请输入新的文件名:', filename);
+ if (newname) {
+ newname = newname.trim();
+ if (newname != filename) {
+ var newpath = concatPath(currentPath, newname);
+ iwxhr.get('/cgi-bin/luci/admin/nas/fileassistant/rename',
+ {
+ filepath: concatPath(currentPath, filename),
+ newpath: newpath
+ },
+ function (x, res) {
+ if (res.ec === 0) {
+ refresh_list(res.data, currentPath);
+ }
+ }
+ );
+ }
+ }
+ }
+
+ function openpath(filename, dirname) {
+ dirname = dirname || currentPath;
+ window.open('/cgi-bin/luci/admin/nas/fileassistant/open?path='
+ + encodeURIComponent(dirname) + '&filename='
+ + encodeURIComponent(filename));
+ }
+
+ function getFileElem(elem) {
+ if (elem.className.indexOf('-icon') > -1) {
+ return elem;
+ }
+ else if (elem.parentNode.className.indexOf('-icon') > -1) {
+ return elem.parentNode;
+ }
+ }
+
+ function concatPath(path, filename) {
+ if (path === '/') {
+ return path + filename;
+ }
+ else {
+ return path.replace(/\/$/, '') + '/' + filename;
+ }
+ }
+
+ function handleClick(evt) {
+ var targetElem = evt.target;
+ var infoElem;
+ if (targetElem.className.indexOf('cbi-button-remove') > -1) {
+ infoElem = targetElem.parentNode.parentNode;
+ removePath(infoElem.dataset['filename'] , infoElem.dataset['isdir'])
+ }
+ else if (targetElem.className.indexOf('cbi-button-install') > -1) {
+ infoElem = targetElem.parentNode.parentNode;
+ installPath(infoElem.dataset['filename'] , infoElem.dataset['isdir'])
+ }
+ else if (targetElem.className.indexOf('cbi-button-edit') > -1) {
+ renamePath(targetElem.parentNode.parentNode.dataset['filename']);
+ }
+ else if (targetElem = getFileElem(targetElem)) {
+ if (targetElem.className.indexOf('parent-icon') > -1) {
+ update_list(currentPath.replace(/\/[^/]+($|\/$)/, ''));
+ }
+ else if (targetElem.className.indexOf('file-icon') > -1) {
+ openpath(targetElem.parentNode.dataset['filename']);
+ }
+ else if (targetElem.className.indexOf('link-icon') > -1) {
+ infoElem = targetElem.parentNode;
+ var filepath = infoElem.dataset['linktarget'];
+ if (filepath) {
+ if (infoElem.dataset['isdir'] === "1") {
+ update_list(filepath);
+ }
+ else {
+ var lastSlash = filepath.lastIndexOf('/');
+ openpath(filepath.substring(lastSlash + 1), filepath.substring(0, lastSlash));
+ }
+ }
+ }
+ else if (targetElem.className.indexOf('folder-icon') > -1) {
+ update_list(concatPath(currentPath, targetElem.parentNode.dataset['filename']))
+ }
+ }
+ }
+ function refresh_list(filenames, path) {
+ var listHtml = '
';
+ if (path !== '/') {
+ listHtml += '| .. |
';
+ }
+ if (filenames) {
+ for (var i = 0; i < filenames.length; i++) {
+ var line = filenames[i];
+ if (line) {
+ var f = line.match(/(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+([\S\s]+)/);
+ var isLink = f[1][0] === 'z' || f[1][0] === 'l' || f[1][0] === 'x';
+ var o = {
+ displayname: f[9],
+ filename: isLink ? f[9].split(' -> ')[0] : f[9],
+ perms: f[1],
+ date: f[7] + ' ' + f[6] + ' ' + f[8],
+ size: f[5],
+ owner: f[3],
+ icon: (f[1][0] === 'd') ? "folder-icon" : (isLink ? "link-icon" : "file-icon")
+ };
+
+ var install_btn = '';
+ var index= o.filename.lastIndexOf(".");
+ var ext = o.filename.substr(index+1);
+ if (ext === 'ipk') {
+ install_btn = '';
+ }
+
+ listHtml += ''
+ + '| '
+ + '' + o.displayname + ''
+ + ' | '
+ + ''+o.owner+' | '
+ + ''+o.date+' | '
+ + ''+o.size+' | '
+ + ''+o.perms+' | '
+ + '\
+ \
+ '
+ + install_btn
+ + ' | '
+ + '
';
+ }
+ }
+ }
+ listHtml += "
";
+ listElem.innerHTML = listHtml;
+ }
+ function update_list(path, opt) {
+ opt = opt || {};
+ path = concatPath(path, '');
+ if (currentPath != path) {
+ iwxhr.get('/cgi-bin/luci/admin/nas/fileassistant/list',
+ {path: path},
+ function (x, res) {
+ if (res.ec === 0) {
+ refresh_list(res.data, path);
+ }
+ else {
+ refresh_list([], path);
+ }
+ }
+ );
+ if (!opt.popState) {
+ history.pushState({path: path}, null, '?path=' + path);
+ }
+ currentPath = path;
+ pathElem.value = currentPath;
+ }
+ };
+
+ var uploadToggle = document.getElementById('upload-toggle');
+ var uploadContainer = document.getElementById('upload-container');
+ var isUploadHide = true;
+ uploadToggle.onclick = function() {
+ if (isUploadHide) {
+ uploadContainer.style.display = 'inline-flex';
+ }
+ else {
+ uploadContainer.style.display = 'none';
+ }
+ isUploadHide = !isUploadHide;
+ };
+ var uploadBtn = uploadContainer.getElementsByClassName('cbi-input-apply')[0];
+ uploadBtn.onclick = function (evt) {
+ var uploadinput = document.getElementById('upload-file');
+ var fullPath = uploadinput.value;
+ if (!fullPath) {
+ evt.preventDefault();
+ }
+ else {
+ var formData = new FormData();
+ var startIndex = (fullPath.indexOf('\\') >= 0 ? fullPath.lastIndexOf('\\') : fullPath.lastIndexOf('/'));
+ formData.append('upload-filename', fullPath.substring(startIndex + 1));
+ formData.append('upload-dir', concatPath(currentPath, ''));
+ formData.append('upload-file', uploadinput.files[0]);
+ var xhr = new XMLHttpRequest();
+ xhr.open("POST", "/cgi-bin/luci/admin/nas/fileassistant/upload", true);
+ xhr.onload = function() {
+ if (xhr.status == 200) {
+ var res = JSON.parse(xhr.responseText);
+ refresh_list(res.data, currentPath);
+ uploadinput.value = '';
+ }
+ else {
+ alert('上传失败,请稍后再试...');
+ }
+ };
+ xhr.send(formData);
+ }
+ };
+
+ document.addEventListener('DOMContentLoaded', function(evt) {
+ var initPath = '/';
+ if (/path=([/\w]+)/.test(location.search)) {
+ initPath = RegExp.$1;
+ }
+ update_list(initPath, {popState: true});
+ });
+ window.addEventListener('popstate', function (evt) {
+ var path = '/';
+ if (evt.state && evt.state.path) {
+ path = evt.state.path;
+ }
+ update_list(path, {popState: true});
+ });
+
+})();
\ No newline at end of file
diff --git a/package/lienol/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/file-icon.png b/package/lienol/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/file-icon.png
new file mode 100644
index 0000000000..f156dc1c7c
Binary files /dev/null and b/package/lienol/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/file-icon.png differ
diff --git a/package/lienol/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/folder-icon.png b/package/lienol/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/folder-icon.png
new file mode 100644
index 0000000000..1370df3ad5
Binary files /dev/null and b/package/lienol/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/folder-icon.png differ
diff --git a/package/lienol/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/link-icon.png b/package/lienol/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/link-icon.png
new file mode 100644
index 0000000000..03cc82cdfa
Binary files /dev/null and b/package/lienol/luci-app-fileassistant/htdocs/luci-static/resources/fileassistant/link-icon.png differ
diff --git a/package/lienol/luci-app-fileassistant/luasrc/controller/fileassistant.lua b/package/lienol/luci-app-fileassistant/luasrc/controller/fileassistant.lua
new file mode 100644
index 0000000000..72228a19dc
--- /dev/null
+++ b/package/lienol/luci-app-fileassistant/luasrc/controller/fileassistant.lua
@@ -0,0 +1,230 @@
+module("luci.controller.fileassistant", package.seeall)
+
+function index()
+
+ entry({"admin", "nas"}, firstchild(), "NAS", 44).dependent = false
+
+ local page
+ page = entry({"admin", "nas", "fileassistant"}, template("fileassistant"), _("文件助手"), 1)
+ page.i18n = "base"
+ page.dependent = true
+
+ page = entry({"admin", "nas", "fileassistant", "list"}, call("fileassistant_list"), nil)
+ page.leaf = true
+
+ page = entry({"admin", "nas", "fileassistant", "open"}, call("fileassistant_open"), nil)
+ page.leaf = true
+
+ page = entry({"admin", "nas", "fileassistant", "delete"}, call("fileassistant_delete"), nil)
+ page.leaf = true
+
+ page = entry({"admin", "nas", "fileassistant", "rename"}, call("fileassistant_rename"), nil)
+ page.leaf = true
+
+ page = entry({"admin", "nas", "fileassistant", "upload"}, call("fileassistant_upload"), nil)
+ page.leaf = true
+
+ page = entry({"admin", "nas", "fileassistant", "install"}, call("fileassistant_install"), nil)
+ page.leaf = true
+
+end
+
+function list_response(path, success)
+ luci.http.prepare_content("application/json")
+ local result
+ if success then
+ local rv = scandir(path)
+ result = {
+ ec = 0,
+ data = rv
+ }
+ else
+ result = {
+ ec = 1
+ }
+ end
+ luci.http.write_json(result)
+end
+
+function fileassistant_list()
+ local path = luci.http.formvalue("path")
+ list_response(path, true)
+end
+
+function fileassistant_open()
+ local path = luci.http.formvalue("path")
+ local filename = luci.http.formvalue("filename")
+ local io = require "io"
+ local mime = to_mime(filename)
+
+ file = path..filename
+
+ local download_fpi = io.open(file, "r")
+ luci.http.header('Content-Disposition', 'inline; filename="'..filename..'"' )
+ luci.http.prepare_content(mime)
+ luci.ltn12.pump.all(luci.ltn12.source.file(download_fpi), luci.http.write)
+end
+
+function fileassistant_delete()
+ local path = luci.http.formvalue("path")
+ local isdir = luci.http.formvalue("isdir")
+ path = path:gsub("<>", "/")
+ path = path:gsub(" ", "\ ")
+ local success
+ if isdir then
+ success = os.execute('rm -r "'..path..'"')
+ else
+ success = os.remove(path)
+ end
+ list_response(nixio.fs.dirname(path), success)
+end
+
+function fileassistant_rename()
+ local filepath = luci.http.formvalue("filepath")
+ local newpath = luci.http.formvalue("newpath")
+ local success = os.execute('mv "'..filepath..'" "'..newpath..'"')
+ list_response(nixio.fs.dirname(filepath), success)
+end
+
+function fileassistant_install()
+ local filepath = luci.http.formvalue("filepath")
+ local isdir = luci.http.formvalue("isdir")
+ local ext = filepath:match(".+%.(%w+)$")
+ filepath = filepath:gsub("<>", "/")
+ filepath = filepath:gsub(" ", "\ ")
+ local success
+ if isdir == "1" then
+ success = false
+ elseif ext == "ipk" then
+ success = installIPK(filepath)
+ else
+ success = false
+ end
+ list_response(nixio.fs.dirname(filepath), success)
+end
+
+function installIPK(filepath)
+ luci.sys.exec('opkg --force-depends install "'..filepath..'"')
+ luci.sys.exec('rm -rf /tmp/luci-*')
+ return true;
+end
+
+function fileassistant_upload()
+ local filecontent = luci.http.formvalue("upload-file")
+ local filename = luci.http.formvalue("upload-filename")
+ local uploaddir = luci.http.formvalue("upload-dir")
+ local filepath = uploaddir..filename
+
+ local fp
+ luci.http.setfilehandler(
+ function(meta, chunk, eof)
+ if not fp and meta and meta.name == "upload-file" then
+ fp = io.open(filepath, "w")
+ end
+ if fp and chunk then
+ fp:write(chunk)
+ end
+ if fp and eof then
+ fp:close()
+ end
+ end
+ )
+
+ list_response(uploaddir, true)
+end
+
+function scandir(directory)
+ local i, t, popen = 0, {}, io.popen
+
+ local pfile = popen("ls -lh \""..directory.."\" | egrep '^d' ; ls -lh \""..directory.."\" | egrep -v '^d|^l'")
+ for fileinfo in pfile:lines() do
+ i = i + 1
+ t[i] = fileinfo
+ end
+ pfile:close()
+ pfile = popen("ls -lh \""..directory.."\" | egrep '^l' ;")
+ for fileinfo in pfile:lines() do
+ i = i + 1
+ linkindex, _, linkpath = string.find(fileinfo, "->%s+(.+)$")
+ local finalpath;
+ if string.sub(linkpath, 1, 1) == "/" then
+ finalpath = linkpath
+ else
+ finalpath = nixio.fs.realpath(directory..linkpath)
+ end
+ local linktype;
+ if not finalpath then
+ finalpath = linkpath;
+ linktype = 'x'
+ elseif nixio.fs.stat(finalpath, "type") == "dir" then
+ linktype = 'z'
+ else
+ linktype = 'l'
+ end
+ fileinfo = string.sub(fileinfo, 2, linkindex - 1)
+ fileinfo = linktype..fileinfo.."-> "..finalpath
+ t[i] = fileinfo
+ end
+ pfile:close()
+ return t
+end
+
+MIME_TYPES = {
+ ["txt"] = "text/plain";
+ ["conf"] = "text/plain";
+ ["ovpn"] = "text/plain";
+ ["log"] = "text/plain";
+ ["js"] = "text/javascript";
+ ["json"] = "application/json";
+ ["css"] = "text/css";
+ ["htm"] = "text/html";
+ ["html"] = "text/html";
+ ["patch"] = "text/x-patch";
+ ["c"] = "text/x-csrc";
+ ["h"] = "text/x-chdr";
+ ["o"] = "text/x-object";
+ ["ko"] = "text/x-object";
+
+ ["bmp"] = "image/bmp";
+ ["gif"] = "image/gif";
+ ["png"] = "image/png";
+ ["jpg"] = "image/jpeg";
+ ["jpeg"] = "image/jpeg";
+ ["svg"] = "image/svg+xml";
+
+ ["zip"] = "application/zip";
+ ["pdf"] = "application/pdf";
+ ["xml"] = "application/xml";
+ ["xsl"] = "application/xml";
+ ["doc"] = "application/msword";
+ ["ppt"] = "application/vnd.ms-powerpoint";
+ ["xls"] = "application/vnd.ms-excel";
+ ["odt"] = "application/vnd.oasis.opendocument.text";
+ ["odp"] = "application/vnd.oasis.opendocument.presentation";
+ ["pl"] = "application/x-perl";
+ ["sh"] = "application/x-shellscript";
+ ["php"] = "application/x-php";
+ ["deb"] = "application/x-deb";
+ ["iso"] = "application/x-cd-image";
+ ["tgz"] = "application/x-compressed-tar";
+
+ ["mp3"] = "audio/mpeg";
+ ["ogg"] = "audio/x-vorbis+ogg";
+ ["wav"] = "audio/x-wav";
+
+ ["mpg"] = "video/mpeg";
+ ["mpeg"] = "video/mpeg";
+ ["avi"] = "video/x-msvideo";
+}
+
+function to_mime(filename)
+ if type(filename) == "string" then
+ local ext = filename:match("[^%.]+$")
+
+ if ext and MIME_TYPES[ext:lower()] then
+ return MIME_TYPES[ext:lower()]
+ end
+ end
+
+ return "application/octet-stream"
+end
\ No newline at end of file
diff --git a/package/lienol/luci-app-fileassistant/luasrc/view/fileassistant.htm b/package/lienol/luci-app-fileassistant/luasrc/view/fileassistant.htm
new file mode 100644
index 0000000000..15f069b95a
--- /dev/null
+++ b/package/lienol/luci-app-fileassistant/luasrc/view/fileassistant.htm
@@ -0,0 +1,20 @@
+<%+header%>
+
+
+文件助手
+
+
+
+
+<%+footer%>
diff --git a/package/lienol/luci-app-mia/Makefile b/package/lienol/luci-app-mia/Makefile
new file mode 100644
index 0000000000..80a8e03714
--- /dev/null
+++ b/package/lienol/luci-app-mia/Makefile
@@ -0,0 +1,17 @@
+# Copyright (C) 2016 Openwrt.org
+#
+# This is free software, licensed under the Apache License, Version 2.0 .
+#
+
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:=LuCI support for Mia
+LUCI_PKGARCH:=all
+PKG_VERSION:=1.0
+PKG_RELEASE:=3-20190309
+
+include $(TOPDIR)/feeds/luci/luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
+
+
diff --git a/package/lienol/luci-app-mia/luasrc/controller/mia.lua b/package/lienol/luci-app-mia/luasrc/controller/mia.lua
new file mode 100644
index 0000000000..f91fb120f6
--- /dev/null
+++ b/package/lienol/luci-app-mia/luasrc/controller/mia.lua
@@ -0,0 +1,17 @@
+module("luci.controller.mia", package.seeall)
+
+function index()
+ if not nixio.fs.access("/etc/config/mia") then return end
+
+ entry({"admin", "network"}, firstchild(), "Control", 44).dependent = false
+ entry({"admin", "network", "mia"}, cbi("mia"), _("时间控制"), 10).dependent =
+ true
+ entry({"admin", "network", "mia", "status"}, call("status")).leaf = true
+end
+
+function status()
+ local e = {}
+ e.status = luci.sys.call("iptables -L FORWARD |grep MIA >/dev/null") == 0
+ luci.http.prepare_content("application/json")
+ luci.http.write_json(e)
+end
diff --git a/package/lienol/luci-app-mia/luasrc/model/cbi/mia.lua b/package/lienol/luci-app-mia/luasrc/model/cbi/mia.lua
new file mode 100644
index 0000000000..ab5083bf33
--- /dev/null
+++ b/package/lienol/luci-app-mia/luasrc/model/cbi/mia.lua
@@ -0,0 +1,44 @@
+local o = require "luci.sys"
+local a, t, e
+a = Map("mia", translate("上网时间管理"),
+ translate("上网时间段控制系统。"))
+a.template = "mia/index"
+t = a:section(TypedSection, "basic", translate("Running Status"))
+t.anonymous = true
+e = t:option(DummyValue, "mia_status", translate("当前状态"))
+e.template = "mia/mia"
+e.value = translate("Collecting data...")
+t = a:section(TypedSection, "basic", translate("基本设置"))
+t.anonymous = true
+e = t:option(Flag, "enable", translate("开启"))
+e.rmempty = false
+t = a:section(TypedSection, "macbind", translate("客户端设置"))
+t.template = "cbi/tblsection"
+t.anonymous = true
+t.addremove = true
+e = t:option(Flag, "enable", translate("开启控制"))
+e.rmempty = false
+e = t:option(Value, "macaddr", translate("黑名单MAC"))
+e.rmempty = true
+o.net.mac_hints(function(t, a) e:value(t, "%s (%s)" % {t, a}) end)
+e = t:option(Value, "timeon", translate("禁止上网开始时间"))
+e.default = "00:00"
+e.optional = false
+e = t:option(Value, "timeoff", translate("取消禁止上网时间"))
+e.default = "23:59"
+e.optional = false
+e = t:option(Flag, "z1", translate("周一"))
+e.rmempty = true
+e = t:option(Flag, "z2", translate("周二"))
+e.rmempty = true
+e = t:option(Flag, "z3", translate("周三"))
+e.rmempty = true
+e = t:option(Flag, "z4", translate("周四"))
+e.rmempty = true
+e = t:option(Flag, "z5", translate("周五"))
+e.rmempty = true
+e = t:option(Flag, "z6", translate("周六"))
+e.rmempty = true
+e = t:option(Flag, "z7", translate("周日"))
+e.rmempty = true
+return a
diff --git a/package/lienol/luci-app-mia/luasrc/view/mia/index.htm b/package/lienol/luci-app-mia/luasrc/view/mia/index.htm
new file mode 100644
index 0000000000..b1b54ac5d5
--- /dev/null
+++ b/package/lienol/luci-app-mia/luasrc/view/mia/index.htm
@@ -0,0 +1,17 @@
+<%#
+ Copyright 2016 Chen RuiWei
+ Licensed to the public under the Apache License 2.0.
+-%>
+
+<% include("cbi/map") %>
+
\ No newline at end of file
diff --git a/package/lienol/luci-app-mia/luasrc/view/mia/mia.htm b/package/lienol/luci-app-mia/luasrc/view/mia/mia.htm
new file mode 100644
index 0000000000..5559002773
--- /dev/null
+++ b/package/lienol/luci-app-mia/luasrc/view/mia/mia.htm
@@ -0,0 +1,3 @@
+<%+cbi/valueheader%>
+<%=pcdata(self:cfgvalue(section) or self.default or "")%>
+<%+cbi/valuefooter%>
\ No newline at end of file
diff --git a/package/lienol/luci-app-mia/po/zh-cn/mia.po b/package/lienol/luci-app-mia/po/zh-cn/mia.po
new file mode 100644
index 0000000000..a883cf73ab
--- /dev/null
+++ b/package/lienol/luci-app-mia/po/zh-cn/mia.po
@@ -0,0 +1,2 @@
+msgid "Control"
+msgstr "管控"
diff --git a/package/lienol/luci-app-mia/root/etc/config/mia b/package/lienol/luci-app-mia/root/etc/config/mia
new file mode 100644
index 0000000000..0c4c4f6bcd
--- /dev/null
+++ b/package/lienol/luci-app-mia/root/etc/config/mia
@@ -0,0 +1,3 @@
+
+config basic
+ option enable '0'
diff --git a/package/lienol/luci-app-mia/root/etc/init.d/mia b/package/lienol/luci-app-mia/root/etc/init.d/mia
new file mode 100755
index 0000000000..84990ecec5
--- /dev/null
+++ b/package/lienol/luci-app-mia/root/etc/init.d/mia
@@ -0,0 +1,111 @@
+#!/bin/sh /etc/rc.common
+#
+# Copyright (C) 2015 OpenWrt-dist
+# Copyright (C) 2016 fw867
+#
+# This is free software, licensed under the GNU General Public License v3.
+# See /LICENSE for more information.
+#
+
+START=99
+
+CONFIG=mia
+
+uci_get_by_type() {
+ local index=0
+ if [ -n $4 ]; then
+ index=$4
+ fi
+ local ret=$(uci get $CONFIG.@$1[$index].$2 2>/dev/null)
+ echo ${ret:=$3}
+}
+
+is_true() {
+ case $1 in
+ 1|on|true|yes|enabled) echo 0;;
+ *) echo 1;;
+ esac
+}
+
+load_config() {
+ ENABLED=$(uci_get_by_type basic enable)
+ return $(is_true $ENABLED)
+}
+
+add_rule(){
+local kp_enabled=0
+local ss_enabled=0
+[ `iptables -t nat -L SS 2>/dev/null |wc -l` -gt 0 ] && ss_enabled=1
+[ `iptables -t nat -L KOOLPROXY 2>/dev/null |wc -l` -gt 0 ] && kp_enabled=1
+for i in $(seq 0 100)
+do
+ local enable=$(uci_get_by_type macbind enable '' $i)
+ local macaddr=$(uci_get_by_type macbind macaddr '' $i)
+ local timeon=$(uci_get_by_type macbind timeon '' $i)
+ local timeoff=$(uci_get_by_type macbind timeoff '' $i)
+ local z1=$(uci_get_by_type macbind z1 '' $i)
+ local z2=$(uci_get_by_type macbind z2 '' $i)
+ local z3=$(uci_get_by_type macbind z3 '' $i)
+ local z4=$(uci_get_by_type macbind z4 '' $i)
+ local z5=$(uci_get_by_type macbind z5 '' $i)
+ local z6=$(uci_get_by_type macbind z6 '' $i)
+ local z7=$(uci_get_by_type macbind z7 '' $i)
+ [ "$z1" == "1" ] && Z1="Mon,"
+ [ "$z2" == "1" ] && Z2="Tue,"
+ [ "$z3" == "1" ] && Z3="Wed,"
+ [ "$z4" == "1" ] && Z4="Thu,"
+ [ "$z5" == "1" ] && Z5="Fri,"
+ [ "$z6" == "1" ] && Z6="Sat,"
+ [ "$z7" == "1" ] && Z7="Sun"
+ if [ -z $enable ] || [ -z $macaddr ] || [ -z $timeoff ] || [ -z $timeon ]; then
+ break
+ fi
+ if [ "$enable" == "1" ]; then
+ iptables -t filter -I MIA -m mac --mac-source $macaddr -m time --kerneltz --timestart $timeon --timestop $timeoff --weekdays $Z1$Z2$Z3$Z4$Z5$Z6$Z7 -j DROP
+ [ "$ss_enabled" -eq 1 ] && iptables -t nat -I SS $((i+1)) -m mac --mac-source $macaddr -m time --kerneltz --timestart $timeon --timestop $timeoff --weekdays $Z1$Z2$Z3$Z4$Z5$Z6$Z7 -j RETURN
+ [ "$kp_enabled" -eq 1 ] && [ -z `iptables -t nat -L KOOLPROXY | grep -w RETURN | grep -w "$macaddr"` ] && iptables -t nat -I KOOLPROXY $((i+1)) -m mac --mac-source $macaddr -m time --kerneltz --timestart $timeon --timestop $timeoff --weekdays $Z1$Z2$Z3$Z4$Z5$Z6$Z7 -j RETURN
+ fi
+ for n in $(seq 1 7)
+ do
+ unset "Z$n"
+ done
+done
+}
+
+get_kp_disrule(){
+ macaddr=$1
+ local is_kp_disrule=0
+ index=`uci show koolproxy |grep -w "$macaddr" |awk -F'.' '{print $2}'`
+ [ -n "$indexs" ] && [ `uci -q get koolproxy.$index.filter_mode` == "disable" ] && is_kp_disrule=1
+}
+
+del_rule(){
+ type=$1
+ blackMacAdd=$(iptables -t nat -L $type | grep -w RETURN | grep -w "MAC" | awk '{print $7}')
+ [ -n "$blackMacAdd" ] && {
+ for macaddrb in $blackMacAdd
+ do
+ [ "$type" == "KOOLPROXY" ] && {
+ get_kp_disrule $macaddrb
+ [ "$is_kp_disrule" -eq 1 ] && continue
+ }
+ iptables -t nat -D $type -m mac --mac-source $macaddrb -j RETURN
+ done
+ }
+}
+
+start(){
+ ! load_config && exit 0
+ iptables -L FORWARD|grep -c MIA 2>/dev/null && [ $? -eq 0 ] && exit 0;
+ iptables -t filter -N MIA
+ iptables -t filter -I FORWARD -m comment --comment "Rule For Control" -j MIA
+ add_rule
+}
+stop(){
+ iptables -t filter -D FORWARD -m comment --comment "Rule For Control" -j MIA
+ iptables -t filter -F MIA
+ iptables -t filter -X MIA
+ [ `iptables -t nat -L SS 2>/dev/null |wc -l` -gt 0 ] && del_rule SS
+ [ `iptables -t nat -L KOOLPROXY 2>/dev/null |wc -l` -gt 0 ] && del_rule KOOLPROXY
+}
+
diff --git a/package/lienol/luci-app-mia/root/etc/uci-defaults/luci-app-control-mia b/package/lienol/luci-app-mia/root/etc/uci-defaults/luci-app-control-mia
new file mode 100755
index 0000000000..5ee8ec5283
--- /dev/null
+++ b/package/lienol/luci-app-mia/root/etc/uci-defaults/luci-app-control-mia
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+uci -q batch <<-EOF >/dev/null
+ delete ucitrack.@mia[-1]
+ add ucitrack mia
+ set ucitrack.@mia[-1].init=mia
+ commit ucitrack
+EOF
+
+rm -f /tmp/luci-indexcache
+exit 0
diff --git a/package/lienol/luci-app-passwall/Makefile b/package/lienol/luci-app-passwall/Makefile
index d6c76f2694..88b6f11aab 100644
--- a/package/lienol/luci-app-passwall/Makefile
+++ b/package/lienol/luci-app-passwall/Makefile
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=2.0
-PKG_RELEASE:=86-20191024
+PKG_RELEASE:=89-20191101
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PO2LMO:=./po2lmo
@@ -15,6 +15,7 @@ PO2LMO:=./po2lmo
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)/config
+menu "Configuration"
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks
bool "Include Shadowsocks Redir (ss-redir)"
@@ -64,10 +65,10 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_dns-forwarder
bool "Include dns-forwarder"
default n
+endmenu
endef
define Package/$(PKG_NAME)
- SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=LuCI support for PassWall(fanqiang) By Lienol
diff --git a/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua b/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua
index 53bc0d48a8..c89dcdf492 100644
--- a/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua
+++ b/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua
@@ -91,23 +91,16 @@ function hide_menu()
end
function link_add_server()
- local type = luci.http.formvalue("type")
local link = luci.http.formvalue("link")
- if type == "SSR" then
- luci.sys.call('rm -f /tmp/ssr_links.conf && echo "' .. link ..
- '" >> /tmp/ssr_links.conf')
- luci.sys.call("/usr/share/passwall/subscription_ssr.sh add >/dev/null")
- elseif type == "V2ray" then
- luci.sys.call('rm -f /tmp/v2ray_links.conf && echo "' .. link ..
- '" >> /tmp/v2ray_links.conf')
- luci.sys
- .call("/usr/share/passwall/subscription_v2ray.sh add >/dev/null")
- end
+ luci.sys.call('rm -f /tmp/links.conf && echo "' .. link ..
+ '" >> /tmp/links.conf')
+ luci.sys.call("/usr/share/passwall/subscription.sh add >/dev/null")
end
function get_log()
-- luci.sys.exec("[ -f /var/log/passwall.log ] && sed '1!G;h;$!d' /var/log/passwall.log > /var/log/passwall_show.log")
- luci.http.write(luci.sys.exec("[ -f '/var/log/passwall.log' ] && cat /var/log/passwall.log"))
+ luci.http.write(luci.sys.exec(
+ "[ -f '/var/log/passwall.log' ] && cat /var/log/passwall.log"))
end
function clear_log() luci.sys.call("echo '' > /var/log/passwall.log") end
diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_trojan_client_config_file.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_trojan_client_config_file.lua
new file mode 100644
index 0000000000..2987f5bb43
--- /dev/null
+++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_trojan_client_config_file.lua
@@ -0,0 +1,35 @@
+local ucursor = require"luci.model.uci".cursor()
+local json = require "luci.jsonc"
+local server_section = arg[1]
+local proto = arg[2]
+local redir_port = arg[3]
+local socks5_proxy_port = arg[4]
+local server = ucursor:get_all("passwall", server_section)
+
+local trojan = {
+ run_type = "client",
+ local_addr = "0.0.0.0",
+ local_port = socks5_proxy_port,
+ remote_addr = server.server,
+ remote_port = tonumber(server.server_port),
+ password = {server.password},
+ log_level = 1,
+ ssl = {
+ verify = true,
+ verify_hostname = true,
+ cert = "",
+ cipher = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:RSA-AES128-GCM-SHA256:RSA-AES256-GCM-SHA384:RSA-AES128-SHA:RSA-AES256-SHA:RSA-3DES-EDE-SHA",
+ sni = "",
+ alpn = {"h2", "http/1.1"},
+ reuse_session = true,
+ session_ticket = false,
+ curves = ""
+ },
+ tcp = {
+ no_delay = true,
+ keep_alive = true,
+ fast_open = false,
+ fast_open_qlen = 20
+ }
+}
+print(json.stringify(trojan, 1))
diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/rule.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/rule.lua
index 5651c1fe7e..29bd354e6b 100644
--- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/rule.lua
+++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/rule.lua
@@ -68,10 +68,7 @@ s = m:section(TypedSection, "global_subscribe", translate("Server Subscribe"))
s.anonymous = true
---- Subscribe URL
-o = s:option(DynamicList, "baseurl_ssr", translate("SSR Subscribe URL"),
- translate(
- "Servers unsubscribed will be deleted in next update; Please summit the Subscribe URL first before manually update."))
-o = s:option(DynamicList, "baseurl_v2ray", translate("V2ray Subscribe URL"),
+o = s:option(DynamicList, "subscribe_url", translate("Subscribe URL"),
translate(
"Servers unsubscribed will be deleted in next update; Please summit the Subscribe URL first before manually update."))
diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/serverconfig.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/serverconfig.lua
index 558810df3f..e1a42b8539 100644
--- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/serverconfig.lua
+++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/serverconfig.lua
@@ -70,6 +70,9 @@ end
if is_installed("brook") or is_finded("brook") then
serverType:value("Brook", translate("Brook Server"))
end
+if is_installed("trojan") or is_finded("trojan") then
+ serverType:value("Trojan", translate("Trojan Server"))
+end
o = s:option(ListValue, "v2ray_protocol", translate("V2ray Protocol"))
o:value("vmess", translate("Vmess"))
@@ -92,6 +95,7 @@ o.rmempty = false
o:depends("server_type", "SS")
o:depends("server_type", "SSR")
o:depends("server_type", "Brook")
+o:depends("server_type", "Trojan")
o = s:option(ListValue, "ss_encrypt_method", translate("Encrypt Method"))
for a, t in ipairs(ss_encrypt_method) do o:value(t) end
diff --git a/package/lienol/luci-app-passwall/luasrc/view/passwall/server_list/link_add_server.htm b/package/lienol/luci-app-passwall/luasrc/view/passwall/server_list/link_add_server.htm
index 4b5c4ca2b5..d754a65aba 100644
--- a/package/lienol/luci-app-passwall/luasrc/view/passwall/server_list/link_add_server.htm
+++ b/package/lienol/luci-app-passwall/luasrc/view/passwall/server_list/link_add_server.htm
@@ -23,10 +23,9 @@ local dsp = require "luci.dispatcher"
diff --git a/package/lienol/luci-app-timewol/luasrc/view/timewol/timewol.htm b/package/lienol/luci-app-timewol/luasrc/view/timewol/timewol.htm
new file mode 100644
index 0000000000..57e0aa4f98
--- /dev/null
+++ b/package/lienol/luci-app-timewol/luasrc/view/timewol/timewol.htm
@@ -0,0 +1,3 @@
+<%+cbi/valueheader%>
+<%=pcdata(self:cfgvalue(section) or self.default or "")%>
+<%+cbi/valuefooter%>
diff --git a/package/lienol/luci-app-timewol/po/zh-cn/timewol.po b/package/lienol/luci-app-timewol/po/zh-cn/timewol.po
new file mode 100644
index 0000000000..a883cf73ab
--- /dev/null
+++ b/package/lienol/luci-app-timewol/po/zh-cn/timewol.po
@@ -0,0 +1,2 @@
+msgid "Control"
+msgstr "管控"
diff --git a/package/lienol/luci-app-timewol/root/etc/config/timewol b/package/lienol/luci-app-timewol/root/etc/config/timewol
new file mode 100644
index 0000000000..0c4c4f6bcd
--- /dev/null
+++ b/package/lienol/luci-app-timewol/root/etc/config/timewol
@@ -0,0 +1,3 @@
+
+config basic
+ option enable '0'
diff --git a/package/lienol/luci-app-timewol/root/etc/init.d/timewol b/package/lienol/luci-app-timewol/root/etc/init.d/timewol
new file mode 100755
index 0000000000..362c739574
--- /dev/null
+++ b/package/lienol/luci-app-timewol/root/etc/init.d/timewol
@@ -0,0 +1,74 @@
+#!/bin/sh /etc/rc.common
+#
+# Copyright (C) 2015 OpenWrt-dist
+# Copyright (C) 2016 fw867
+#
+# This is free software, licensed under the GNU General Public License v3.
+# See /LICENSE for more information.
+#
+
+START=99
+
+CONFIG=timewol
+
+uci_get_by_type() {
+ local index=0
+ if [ -n $4 ]; then
+ index=$4
+ fi
+ local ret=$(uci get $CONFIG.@$1[$index].$2 2>/dev/null)
+ echo ${ret:=$3}
+}
+
+is_true() {
+ case $1 in
+ 1|on|true|yes|enabled) echo 0;;
+ *) echo 1;;
+ esac
+}
+
+load_config() {
+ ENABLED=$(uci_get_by_type basic enable)
+ return $(is_true $ENABLED)
+}
+
+add_rule(){
+sed -i '/etherwake/d' /etc/crontabs/root >/dev/null 2>&1
+for i in $(seq 0 100)
+ do
+ local macaddr=$(uci_get_by_type macclient macaddr '' $i)
+ local maceth=$(uci_get_by_type macclient maceth '' $i)
+ local minute=$(uci_get_by_type macclient minute '' $i)
+ local hour=$(uci_get_by_type macclient hour '' $i)
+ local day=$(uci_get_by_type macclient day '' $i)
+ local month=$(uci_get_by_type macclient month '' $i)
+ local weeks=$(uci_get_by_type macclient weeks '' $i)
+ if [ -z $macaddr ] || [ -z $maceth ]; then
+ break
+ fi
+ if [ -z $minute ] ; then
+ minute="0"
+ fi
+ if [ -z $hour ] ; then
+ hour="*"
+ fi
+ if [ -z $day ] ; then
+ day="*"
+ fi
+ if [ -z $month ] ; then
+ month="*"
+ fi
+ if [ -z $weeks ] ; then
+ weeks="*"
+ fi
+ echo "$minute $hour $day $month $weeks /usr/bin/etherwake -D -i $maceth $macaddr" >> /etc/crontabs/root
+done
+}
+
+start() {
+ ! load_config && exit 0
+ add_rule
+}
+stop() {
+ sed -i '/etherwake/d' /etc/crontabs/root >/dev/null 2>&1
+}
diff --git a/package/lienol/luci-app-timewol/root/etc/uci-defaults/luci-app-control-timewol b/package/lienol/luci-app-timewol/root/etc/uci-defaults/luci-app-control-timewol
new file mode 100755
index 0000000000..32595e12f0
--- /dev/null
+++ b/package/lienol/luci-app-timewol/root/etc/uci-defaults/luci-app-control-timewol
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+uci -q batch <<-EOF >/dev/null
+ delete ucitrack.@timewol[-1]
+ add ucitrack timewol
+ set ucitrack.@timewol[-1].init=timewol
+ commit ucitrack
+EOF
+
+rm -f /tmp/luci-indexcache
+exit 0
diff --git a/package/lienol/luci-app-webrestriction/Makefile b/package/lienol/luci-app-webrestriction/Makefile
new file mode 100644
index 0000000000..f3be31f748
--- /dev/null
+++ b/package/lienol/luci-app-webrestriction/Makefile
@@ -0,0 +1,17 @@
+# Copyright (C) 2016 Openwrt.org
+#
+# This is free software, licensed under the Apache License, Version 2.0 .
+#
+
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:=LuCI support for Webrestriction
+LUCI_PKGARCH:=all
+PKG_VERSION:=1.0
+PKG_RELEASE:=3-20190309
+
+include $(TOPDIR)/feeds/luci/luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
+
+
diff --git a/package/lienol/luci-app-webrestriction/luasrc/controller/webrestriction.lua b/package/lienol/luci-app-webrestriction/luasrc/controller/webrestriction.lua
new file mode 100644
index 0000000000..67fb817907
--- /dev/null
+++ b/package/lienol/luci-app-webrestriction/luasrc/controller/webrestriction.lua
@@ -0,0 +1,19 @@
+module("luci.controller.webrestriction", package.seeall)
+
+function index()
+ if not nixio.fs.access("/etc/config/webrestriction") then return end
+
+ entry({"admin", "network"}, firstchild(), "Control", 44).dependent = false
+ entry({"admin", "network", "webrestriction"}, cbi("webrestriction"),
+ _("访问限制"), 11).dependent = true
+ entry({"admin", "network", "webrestriction", "status"}, call("status")).leaf =
+ true
+end
+
+function status()
+ local e = {}
+ e.status = luci.sys.call(
+ "iptables -L FORWARD |grep WEB_RESTRICTION >/dev/null") == 0
+ luci.http.prepare_content("application/json")
+ luci.http.write_json(e)
+end
diff --git a/package/lienol/luci-app-webrestriction/luasrc/model/cbi/webrestriction.lua b/package/lienol/luci-app-webrestriction/luasrc/model/cbi/webrestriction.lua
new file mode 100644
index 0000000000..8727a8ac41
--- /dev/null
+++ b/package/lienol/luci-app-webrestriction/luasrc/model/cbi/webrestriction.lua
@@ -0,0 +1,30 @@
+local o = require "luci.sys"
+local a, e, t
+a = Map("webrestriction", translate("访问限制"), translate(
+ "使用黑名单或者白名单模式控制列表中的客户端是否能够连接到互联网。"))
+a.template = "webrestriction/index"
+e = a:section(TypedSection, "basic", translate("Running Status"))
+e.anonymous = true
+t = e:option(DummyValue, "webrestriction_status", translate("当前状态"))
+t.template = "webrestriction/webrestriction"
+t.value = translate("Collecting data...")
+e = a:section(TypedSection, "basic", translate("全局设置"))
+e.anonymous = true
+t = e:option(Flag, "enable", translate("开启"))
+t.rmempty = false
+t = e:option(ListValue, "limit_type", translate("限制模式"))
+t.default = "blacklist"
+t:value("whitelist", translate("白名单"))
+t:value("blacklist", translate("Blacklist"))
+t.rmempty = false
+e = a:section(TypedSection, "macbind", translate("名单设置"), translate(
+ "如果是黑名单模式,列表中的客户端将被禁止连接到互联网;白名单模式表示仅有列表中的客户端可以连接到互联网。"))
+e.template = "cbi/tblsection"
+e.anonymous = true
+e.addremove = true
+t = e:option(Flag, "enable", translate("开启控制"))
+t.rmempty = false
+t = e:option(Value, "macaddr", translate("MAC地址"))
+t.rmempty = true
+o.net.mac_hints(function(e, a) t:value(e, "%s (%s)" % {e, a}) end)
+return a
diff --git a/package/lienol/luci-app-webrestriction/luasrc/view/webrestriction/index.htm b/package/lienol/luci-app-webrestriction/luasrc/view/webrestriction/index.htm
new file mode 100644
index 0000000000..21f269e79d
--- /dev/null
+++ b/package/lienol/luci-app-webrestriction/luasrc/view/webrestriction/index.htm
@@ -0,0 +1,18 @@
+<%#
+ Copyright 2016 Chen RuiWei
+ Licensed to the public under the Apache License 2.0.
+-%>
+
+<% include("cbi/map") %>
+
diff --git a/package/lienol/luci-app-webrestriction/luasrc/view/webrestriction/webrestriction.htm b/package/lienol/luci-app-webrestriction/luasrc/view/webrestriction/webrestriction.htm
new file mode 100644
index 0000000000..03702cf7e3
--- /dev/null
+++ b/package/lienol/luci-app-webrestriction/luasrc/view/webrestriction/webrestriction.htm
@@ -0,0 +1,3 @@
+<%+cbi/valueheader%>
+<%=pcdata(self:cfgvalue(section) or self.default or "")%>
+<%+cbi/valuefooter%>
diff --git a/package/lienol/luci-app-webrestriction/po/zh-cn/webrestriction.po b/package/lienol/luci-app-webrestriction/po/zh-cn/webrestriction.po
new file mode 100644
index 0000000000..a883cf73ab
--- /dev/null
+++ b/package/lienol/luci-app-webrestriction/po/zh-cn/webrestriction.po
@@ -0,0 +1,2 @@
+msgid "Control"
+msgstr "管控"
diff --git a/package/lienol/luci-app-webrestriction/root/etc/config/webrestriction b/package/lienol/luci-app-webrestriction/root/etc/config/webrestriction
new file mode 100644
index 0000000000..504593945b
--- /dev/null
+++ b/package/lienol/luci-app-webrestriction/root/etc/config/webrestriction
@@ -0,0 +1,5 @@
+
+config basic
+ option enable '0'
+ option limit_type 'blacklist'
+
diff --git a/package/lienol/luci-app-webrestriction/root/etc/init.d/webrestriction b/package/lienol/luci-app-webrestriction/root/etc/init.d/webrestriction
new file mode 100755
index 0000000000..ab1d28cdbb
--- /dev/null
+++ b/package/lienol/luci-app-webrestriction/root/etc/init.d/webrestriction
@@ -0,0 +1,86 @@
+#!/bin/sh /etc/rc.common
+#
+# Copyright (C) 2015 OpenWrt-dist
+# Copyright (C) 2016 fw867
+#
+# This is free software, licensed under the GNU General Public License v3.
+# See /LICENSE for more information.
+#
+
+START=99
+
+CONFIG=webrestriction
+limit_type=$(uci -q get webrestriction.@basic[0].limit_type)
+
+uci_get_by_type() {
+ local index=0
+ if [ -n $4 ]; then
+ index=$4
+ fi
+ local ret=$(uci get $CONFIG.@$1[$index].$2 2>/dev/null)
+ echo ${ret:=$3}
+}
+
+is_true() {
+ case $1 in
+ 1|on|true|yes|enabled) echo 0;;
+ *) echo 1;;
+ esac
+}
+
+load_config() {
+ ENABLED=$(uci_get_by_type basic enable)
+ return $(is_true $ENABLED)
+}
+
+
+add_rule(){
+ action=$1
+ for i in $(seq 0 100)
+ do
+ enable=$(uci_get_by_type macbind enable '' $i)
+ macaddr=$(uci_get_by_type macbind macaddr '' $i)
+ if [ -z $enable ] || [ -z $macaddr ]; then
+ break
+ fi
+ if [ "$enable" == "1" ]; then
+ iptables -t filter -A WEB_RESTRICTION -m mac --mac-source $macaddr -j $action
+ [ "$limit_type" == "blacklist" ] && iptables -t nat -A WEB_RESTRICTION -m mac --mac-source $macaddr -j RETURN
+ #unset "$macaddr"
+ fi
+ done
+}
+
+start(){
+
+ ! load_config && exit 0
+ [ "`iptables -L FORWARD|grep -c WEB_RESTRICTION`" -gt 0 ] && exit 0;
+ iptables -P FORWARD DROP
+ iptables -t filter -N WEB_RESTRICTION
+ if [ "$limit_type" == "blacklist" ]; then
+ iptables -t nat -N WEB_RESTRICTION
+ add_rule DROP
+ else
+ add_rule ACCEPT
+ iptables -t filter -A WEB_RESTRICTION -j DROP
+ fi
+
+ #获取FORWARD ACCEPT规则行号
+ FA_INDEX=`iptables -t filter -L FORWARD|tail -n +3|sed -n -e '/^ACCEPT/='`
+ if [ -n "$FA_INDEX" ]; then
+ let FA_INDEX+=1
+ fi
+ #确保添加到FORWARD ACCEPT规则之后
+ iptables -t filter -I FORWARD $FA_INDEX -m comment --comment "Rule For Control" -j WEB_RESTRICTION
+ [ "$limit_type" == "blacklist" ] && iptables -t nat -I PREROUTING 1 -m comment --comment "Rule For Control" -j WEB_RESTRICTION
+}
+stop(){
+ [ "`iptables -t filter -L | grep -c WEB_RESTRICTION`" -gt 0 ] && {
+ iptables -t filter -D FORWARD -m comment --comment "Rule For Control" -j WEB_RESTRICTION
+ iptables -t nat -D PREROUTING -m comment --comment "Rule For Control" -j WEB_RESTRICTION
+ iptables -t filter -F WEB_RESTRICTION
+ iptables -t filter -X WEB_RESTRICTION
+ iptables -t nat -F WEB_RESTRICTION
+ iptables -t nat -X WEB_RESTRICTION
+ }
+}
\ No newline at end of file
diff --git a/package/lienol/luci-app-webrestriction/root/etc/uci-defaults/luci-app-control-webrestriction b/package/lienol/luci-app-webrestriction/root/etc/uci-defaults/luci-app-control-webrestriction
new file mode 100755
index 0000000000..25ff88a9a6
--- /dev/null
+++ b/package/lienol/luci-app-webrestriction/root/etc/uci-defaults/luci-app-control-webrestriction
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+uci -q batch <<-EOF >/dev/null
+ delete ucitrack.@webrestriction[-1]
+ add ucitrack webrestriction
+ set ucitrack.@webrestriction[-1].init=webrestriction
+ commit ucitrack
+EOF
+
+rm -f /tmp/luci-indexcache
+exit 0
diff --git a/package/lienol/luci-app-weburl/Makefile b/package/lienol/luci-app-weburl/Makefile
new file mode 100644
index 0000000000..3bcf5fb205
--- /dev/null
+++ b/package/lienol/luci-app-weburl/Makefile
@@ -0,0 +1,18 @@
+# Copyright (C) 2016 Openwrt.org
+#
+# This is free software, licensed under the Apache License, Version 2.0 .
+#
+
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:=LuCI support for Weburl
+LUCI_DEPENDS:=+iptables-mod-filter +kmod-ipt-filter
+LUCI_PKGARCH:=all
+PKG_VERSION:=1.0
+PKG_RELEASE:=3-20190309
+
+include $(TOPDIR)/feeds/luci/luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
+
+
diff --git a/package/lienol/luci-app-weburl/luasrc/controller/weburl.lua b/package/lienol/luci-app-weburl/luasrc/controller/weburl.lua
new file mode 100644
index 0000000000..e88c389c4f
--- /dev/null
+++ b/package/lienol/luci-app-weburl/luasrc/controller/weburl.lua
@@ -0,0 +1,17 @@
+module("luci.controller.weburl", package.seeall)
+
+function index()
+ if not nixio.fs.access("/etc/config/weburl") then return end
+
+ entry({"admin", "network"}, firstchild(), "Control", 44).dependent = false
+ entry({"admin", "network", "weburl"}, cbi("weburl"), _("网址过滤"), 12).dependent =
+ true
+ entry({"admin", "network", "weburl", "status"}, call("status")).leaf = true
+end
+
+function status()
+ local e = {}
+ e.status = luci.sys.call("iptables -L FORWARD |grep WEBURL >/dev/null") == 0
+ luci.http.prepare_content("application/json")
+ luci.http.write_json(e)
+end
diff --git a/package/lienol/luci-app-weburl/luasrc/model/cbi/weburl.lua b/package/lienol/luci-app-weburl/luasrc/model/cbi/weburl.lua
new file mode 100644
index 0000000000..699c97ab09
--- /dev/null
+++ b/package/lienol/luci-app-weburl/luasrc/model/cbi/weburl.lua
@@ -0,0 +1,36 @@
+local o = require "luci.sys"
+local a, t, e
+a = Map("weburl", translate("网址过滤"), translate(
+ "在这里设置关键词过滤,可以是URL里任意字符,可以过滤如视频网站、QQ、迅雷、淘宝。。。"))
+a.template = "weburl/index"
+t = a:section(TypedSection, "basic", translate("Running Status"))
+t.anonymous = true
+e = t:option(DummyValue, "weburl_status", translate("当前状态"))
+e.template = "weburl/weburl"
+e.value = translate("Collecting data...")
+t = a:section(TypedSection, "basic", translate("基本设置"), translate(
+ "一般来说普通过滤效果就很好了,强制过滤会使用更复杂的算法导致更高的CPU占用。"))
+t.anonymous = true
+e = t:option(Flag, "enable", translate("开启"))
+e.rmempty = false
+e = t:option(Flag, "algos", translate("强效过滤"))
+e.rmempty = false
+t = a:section(TypedSection, "macbind", translate("关键词设置"), translate(
+ "黑名单MAC不设置为全客户端过滤,如设置只过滤指定的客户端。过滤时间可不设置。"))
+t.template = "cbi/tblsection"
+t.anonymous = true
+t.addremove = true
+e = t:option(Flag, "enable", translate("开启控制"))
+e.rmempty = false
+e = t:option(Value, "macaddr", translate("黑名单MAC"))
+e.rmempty = true
+o.net.mac_hints(function(t, a) e:value(t, "%s (%s)" % {t, a}) end)
+e = t:option(Value, "timeon", translate("开始过滤时间"))
+e.placeholder = "00:00"
+e.rmempty = true
+e = t:option(Value, "timeoff", translate("取消过滤时间"))
+e.placeholder = "23:59"
+e.rmempty = true
+e = t:option(Value, "keyword", translate("网址关键词"))
+e.rmempty = false
+return a
diff --git a/package/lienol/luci-app-weburl/luasrc/view/weburl/index.htm b/package/lienol/luci-app-weburl/luasrc/view/weburl/index.htm
new file mode 100644
index 0000000000..47575a4241
--- /dev/null
+++ b/package/lienol/luci-app-weburl/luasrc/view/weburl/index.htm
@@ -0,0 +1,18 @@
+<%#
+ Copyright 2016 Chen RuiWei
+ Licensed to the public under the Apache License 2.0.
+-%>
+
+<% include("cbi/map") %>
+
diff --git a/package/lienol/luci-app-weburl/luasrc/view/weburl/weburl.htm b/package/lienol/luci-app-weburl/luasrc/view/weburl/weburl.htm
new file mode 100644
index 0000000000..a61ad9b89a
--- /dev/null
+++ b/package/lienol/luci-app-weburl/luasrc/view/weburl/weburl.htm
@@ -0,0 +1,3 @@
+<%+cbi/valueheader%>
+<%=pcdata(self:cfgvalue(section) or self.default or "")%>
+<%+cbi/valuefooter%>
diff --git a/package/lienol/luci-app-weburl/po/zh-cn/weburl.po b/package/lienol/luci-app-weburl/po/zh-cn/weburl.po
new file mode 100644
index 0000000000..a883cf73ab
--- /dev/null
+++ b/package/lienol/luci-app-weburl/po/zh-cn/weburl.po
@@ -0,0 +1,2 @@
+msgid "Control"
+msgstr "管控"
diff --git a/package/lienol/luci-app-weburl/root/etc/config/weburl b/package/lienol/luci-app-weburl/root/etc/config/weburl
new file mode 100644
index 0000000000..5d6d46e6e9
--- /dev/null
+++ b/package/lienol/luci-app-weburl/root/etc/config/weburl
@@ -0,0 +1,22 @@
+
+config basic
+ option enable '0'
+ option algos '0'
+
+config macbind
+ option keyword 'qq.com'
+ option enable '0'
+ option macaddr '00:0C:29:C8:99:9E'
+
+config macbind
+ option keyword 'taobao.com'
+ option enable '0'
+
+config macbind
+ option enable '0'
+ option keyword 'youku.com'
+
+config macbind
+ option enable '0'
+ option keyword 'www'
+
diff --git a/package/lienol/luci-app-weburl/root/etc/init.d/weburl b/package/lienol/luci-app-weburl/root/etc/init.d/weburl
new file mode 100755
index 0000000000..1785abf73d
--- /dev/null
+++ b/package/lienol/luci-app-weburl/root/etc/init.d/weburl
@@ -0,0 +1,88 @@
+#!/bin/sh /etc/rc.common
+#
+# Copyright (C) 2015 OpenWrt-dist
+# Copyright (C) 2016 fw867
+#
+# This is free software, licensed under the GNU General Public License v3.
+# See /LICENSE for more information.
+#
+
+START=99
+
+CONFIG=weburl
+
+uci_get_by_type() {
+ local index=0
+ if [ -n $4 ]; then
+ index=$4
+ fi
+ local ret=$(uci get $CONFIG.@$1[$index].$2 2>/dev/null)
+ echo ${ret:=$3}
+}
+
+is_true() {
+ case $1 in
+ 1|on|true|yes|enabled) echo 0;;
+ *) echo 1;;
+ esac
+}
+
+load_config() {
+ ENABLED=$(uci_get_by_type basic enable)
+ return $(is_true $ENABLED)
+}
+
+get_algo_mode(){
+ case "$1" in
+ 0)
+ echo "bm"
+ ;;
+ 1)
+ echo "kmp"
+ ;;
+ esac
+}
+
+add_rule(){
+ algos=$(uci_get_by_type basic algos)
+ for i in $(seq 0 100)
+ do
+ enable=$(uci_get_by_type macbind enable '' $i)
+ macaddr=$(uci_get_by_type macbind macaddr '' $i)
+ timeon=$(uci_get_by_type macbind timeon '' $i)
+ timeoff=$(uci_get_by_type macbind timeoff '' $i)
+ keyword=$(uci_get_by_type macbind keyword '' $i)
+ if [ -z $enable ] || [ -z $keyword ]; then
+ break
+ fi
+
+ if [ -z $timeon ] || [ -z $timeoff ]; then
+ settime=""
+ else
+ settime="-m time --kerneltz --timestart $timeon --timestop $timeoff"
+ fi
+
+ if [ "$enable" == "1" ]; then
+ if [ -z $macaddr ]; then
+ iptables -t filter -I WEBURL $settime -m string --string "$keyword" --algo $(get_algo_mode $algos) -j DROP
+ else
+ iptables -t filter -I WEBURL $settime -m mac --mac-source $macaddr -m string --string "$keyword" --algo $(get_algo_mode $algos) -j DROP
+ unset "$macaddr"
+ fi
+ fi
+ done
+}
+
+start(){
+ ! load_config && exit 0
+ iptables -L FORWARD | grep -c WEBURL 2>/dev/null && [ $? -eq 0 ] && exit 0;
+ iptables -t filter -N WEBURL
+ iptables -t filter -I FORWARD -m comment --comment "Rule For Control" -j WEBURL
+ add_rule
+}
+stop(){
+ iptables -t filter -D FORWARD -m comment --comment "Rule For Control" -j WEBURL
+ iptables -t filter -F WEBURL
+ iptables -t filter -X WEBURL
+}
+
diff --git a/package/lienol/luci-app-weburl/root/etc/uci-defaults/luci-app-control-weburl b/package/lienol/luci-app-weburl/root/etc/uci-defaults/luci-app-control-weburl
new file mode 100755
index 0000000000..fed8291979
--- /dev/null
+++ b/package/lienol/luci-app-weburl/root/etc/uci-defaults/luci-app-control-weburl
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+uci -q batch <<-EOF >/dev/null
+ delete ucitrack.@weburl[-1]
+ add ucitrack weburl
+ set ucitrack.@weburl[-1].init=weburl
+ commit ucitrack
+EOF
+
+rm -f /tmp/luci-indexcache
+exit 0
diff --git a/package/lienol/trojan/Makefile b/package/lienol/trojan/Makefile
new file mode 100644
index 0000000000..b570edba2e
--- /dev/null
+++ b/package/lienol/trojan/Makefile
@@ -0,0 +1,86 @@
+#
+# Copyright (C) 2018-2019 wongsyrone
+#
+# This is free software, licensed under the GNU General Public License v3.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=trojan
+PKG_VERSION:=1.13.0
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/trojan-gfw/trojan.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=842ad5bb07eb8bce035fb274571e586629a97c99
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+CMAKE_INSTALL:=1
+PKG_BUILD_PARALLEL:=0
+
+PKG_BUILD_DEPENDS:=openssl1.1
+
+PKG_LICENSE:=GPL-3.0
+
+PKG_MAINTAINER:=GreaterFire
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+TARGET_CXXFLAGS += -Wall -Wextra
+TARGET_CXXFLAGS += $(FPIC)
+
+# LTO
+TARGET_CXXFLAGS += -flto
+TARGET_LDFLAGS += -flto
+
+# CXX standard
+TARGET_CXXFLAGS += -std=c++11
+
+TARGET_CXXFLAGS := $(filter-out -O%,$(TARGET_CXXFLAGS)) -O3
+MY_OPENSSL_DIR:=$(BUILD_DIR)/openssl1.1_staging_dir/usr
+
+TARGET_CXXFLAGS += -ffunction-sections -fdata-sections
+TARGET_LDFLAGS += -Wl,--gc-sections
+
+CMAKE_FIND_ROOT_PATH := $(MY_OPENSSL_DIR);$(CMAKE_FIND_ROOT_PATH)
+TARGET_CXXFLAGS := -I$(MY_OPENSSL_DIR)/include $(TARGET_CXXFLAGS)
+TARGET_LDFLAGS := -L$(MY_OPENSSL_DIR)/lib $(TARGET_LDFLAGS)
+
+
+
+CMAKE_OPTIONS += \
+ -DENABLE_MYSQL=OFF \
+ -DENABLE_SSL_KEYLOG=ON \
+ -DENABLE_NAT=ON \
+ -DFORCE_TCP_FASTOPEN=OFF \
+ -DSYSTEMD_SERVICE=OFF \
+ -DOPENSSL_USE_STATIC_LIBS=TRUE \
+ -DBoost_DEBUG=ON \
+ -DBoost_NO_BOOST_CMAKE=ON
+
+
+
+define Package/trojan
+ SECTION:=net
+ CATEGORY:=Network
+ TITLE:=An unidentifiable mechanism that helps you bypass GFW
+ URL:=https://github.com/trojan-gfw/trojan
+ DEPENDS:=+libpthread +libstdcpp \
+ +boost +boost-system +boost-program_options +boost-date_time
+endef
+
+
+
+define Package/trojan/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/trojan $(1)/usr/sbin/trojan
+ $(INSTALL_DIR) $(1)/etc/config
+ $(INSTALL_DATA) ./files/trojan.config $(1)/etc/config/trojan
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/trojan.init $(1)/etc/init.d/trojan
+ $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/trojan/config.json $(1)/etc/trojan.json
+endef
+
+
+$(eval $(call BuildPackage,trojan))
diff --git a/package/lienol/trojan/files/trojan.config b/package/lienol/trojan/files/trojan.config
new file mode 100644
index 0000000000..b53fb62dd6
--- /dev/null
+++ b/package/lienol/trojan/files/trojan.config
@@ -0,0 +1,4 @@
+
+config trojan
+ option enabled '0'
+
diff --git a/package/lienol/trojan/files/trojan.init b/package/lienol/trojan/files/trojan.init
new file mode 100755
index 0000000000..0acff39cd8
--- /dev/null
+++ b/package/lienol/trojan/files/trojan.init
@@ -0,0 +1,37 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2018 wongsyrone
+
+. /lib/functions.sh
+
+START=95
+USE_PROCD=1
+#PROCD_DEBUG=1
+
+PROG=/usr/sbin/trojan
+CONF=/etc/trojan.json
+
+config_load "trojan"
+
+parse_trojan() {
+ config_get ENABLED "$section" "enabled"
+}
+
+config_foreach parse_trojan 'trojan'
+
+
+start_service() {
+ if [ "1" = "$ENABLED" ] || [ "on" = "$ENABLED" ] || [ "true" = "$ENABLED" ]; then
+ procd_open_instance
+ procd_set_param command $PROG --config $CONF
+ procd_set_param user root # run service as user root
+ procd_set_param stdout 1 # forward stdout of the command to logd
+ procd_set_param stderr 1 # same for stderr
+ procd_set_param limits nofile="1048576 1048576" # max allowed value can be fetched via /proc/sys/fs/nr_open
+ [ -e /proc/sys/kernel/core_pattern ] && {
+ procd_append_param limits core="unlimited"
+ }
+ procd_close_instance
+ else
+ echo "trojan is disabled"
+ fi
+}
diff --git a/package/lienol/trojan/patches/001-force-openssl-version.patch b/package/lienol/trojan/patches/001-force-openssl-version.patch
new file mode 100644
index 0000000000..0a7291261b
--- /dev/null
+++ b/package/lienol/trojan/patches/001-force-openssl-version.patch
@@ -0,0 +1,11 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -43,7 +43,7 @@ if(MSVC)
+ add_definitions(-DBOOST_DATE_TIME_NO_LIB)
+ endif()
+
+-find_package(OpenSSL 1.0.2 REQUIRED)
++find_package(OpenSSL 1.1.1 REQUIRED)
+ include_directories(${OPENSSL_INCLUDE_DIR})
+ target_link_libraries(trojan ${OPENSSL_LIBRARIES})
+ if(OPENSSL_VERSION VERSION_GREATER_EQUAL 1.1.1)