Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

做了一个luci,建议作者可以集成进去。我把源码一起发上来。 #11

Closed
freeskyfly opened this issue Feb 10, 2020 · 4 comments
Labels
wontfix This will not be worked on

Comments

@freeskyfly
Copy link

freeskyfly commented Feb 10, 2020

基于rampis编译的chinadns-ng,以及luci,可以直接取用。
chinadns-ng_1.0-beta.15-1_mipsel_24kc.ipk
luci-app-chinadnsng_1.0-3_mipsel_24kc.ipk
其中luci与平台无关,各个平台都可以直接用
编译是基于19.07.1的sdk但是没有用到什么特殊的功能,应该从15以后的版本都没问题。
源码放在sdk的package下面,分类在
Utilities-->luci-chinadns-ng
make package/luci-app-chinadnsng/{clean,compile} -j V=99
即可
链接: https://pan.baidu.com/s/10bJbc_I6pM50-fqDilkklg 提取码: hhkc
image
另外目前采用ucitrack的功能希望能够让程序根据config的更改自行reload没办法实现,不知道为什么所以目前就没有添加uci-default文件,而是采用了在luci页面apply的时候执行reload,同时会在日志记录reload的信息。希望作者可以把service-trigger有空看看。

@pexcn
Copy link
Owner

pexcn commented Feb 10, 2020

我不会 luci, 如果合并了上述 code, 如果 chinadns-ng 有一些功能性的变动会导致 luci 模块无法维护。
所以最好还是另外单独新建一个 luci-app-chinadns-ng 库。

@pexcn pexcn added help wanted Extra attention is needed wontfix This will not be worked on labels Feb 10, 2020
@freeskyfly
Copy link
Author

luci本来就是独立的,只跟config/chinadns-ng这个配置文件有关,只要配置文件内容不变就没有关系。只是我没有用github,所以建议作者可以提供个平台。而且因为chinadns-ng本身是你在维护其实正应该你一起维护了,不然哪天变了别人也不一定知道啊。不过我只是自己折腾了一个,顺便给需要的人提供给方便。或者就让这个issue留着也行。需要的自己下载。
其实就算有变化,也很容易改的,贴出来你看下就知道了:
luasrc\model\cbi\chinadns-ng.lua
每个配置一行
flag是单选,Value是输入框,translate是我做了翻译文件,没有的话不要用translate直接用引号放“中文”也可以
o = s:option(Flag, "enable", translate("Enable"))
o.rmempty = false

o = s:option(Flag, "fair_mode",
translate("Enable the Fair_Mode"),
translate("Enable the Fair_Mode or use the Compete_Mode"))
o.rmempty = false

o = s:option(Value, "bind_port", translate("Listen Port"))
o.placeholder = 5253
o.default = 5253
o.datatype = "port"
o.rmempty = false

o = s:option(Value, "bind_addr", translate("Listen Address"))
o.placeholder = "0.0.0.0"
o.default = "0.0.0.0"
o.datatype = "ipaddr"
o.rmempty = false

o = s:option(Value, "chnlist_file", translate("CHNRoute File"))
o.placeholder = "/etc/chinadns-ng/chinalist.txt"
o.default = "/etc/chinadns-ng/chinalist.txt"
o.datatype = "file"
o.rmempty = false

o = s:option(Value, "gfwlist_file", translate("GFWRoute File"))
o.placeholder = "/etc/chinadns-ng/gfwlist.txt"
o.default = "/etc/chinadns-ng/gfwlist.txt"
o.datatype = "file"
o.rmempty = false

o = s:option(Value, "timeout_sec", translate("timeout_sec"))
o.placeholder = "3"
o.default = "3"
o.datatype = "uinteger"
o.rmempty = false

o = s:option(Value, "repeat_times", translate("repeat_times"))
o.placeholder = "1"
o.default = "1"
o.datatype = "uinteger"
o.rmempty = false

o = s:option(Value, "china_dns",
translate("China DNS Servers"),
translate("Use commas to separate multiple ip address,Max 2 Servers"))
o.placeholder = "223.5.5.5,233.6.6.6"
o.default = "223.5.5.5,233.6.6.6"
o.rmempty = false

o = s:option(Value, "trust_dns",
translate("Trusted DNS Servers"),
translate("Use commas to separate multiple ip address,Max 2 Servers"))
o.placeholder = "127.0.0.1#5054,127.0.0.1#5053"
o.default = "127.0.0.1#5054,127.0.0.1#5053"
o.rmempty = false

o = s:option(Flag, "chnlist_first",
translate("match chnlist first"),
translate("match chnlist first,default is gfwfirst"))
o.rmempty = false

o = s:option(Flag, "reuse_port",
translate("reuse_port"),
translate("reuse_port,for Multi-process load balancing"))
o.rmempty = false

o = s:option(Flag, "noip_as_chnip",
translate("accept no ip"),
translate("accept reply without ipaddr (A/AAAA query)"))
o.rmempty = false

最后
local apply=luci.http.formvalue("cbi.apply")
if apply then
luci.sys.call("/etc/init.d/chinadns-ng reload >/dev/null 2>&1;logger -t 'luci-chinadns-ng' -p info 'chinadns-ng reload!'")
end
检测是否有apply,有的话就reload。不输出,同时,写入系统log

pexcn added a commit that referenced this issue Feb 11, 2020
originial version: #11
@pexcn pexcn mentioned this issue Feb 11, 2020
@pexcn
Copy link
Owner

pexcn commented Feb 11, 2020

我已经整理存档到了 luci 分支,但不保证后续的更新。
置顶了一个关于 LuCI 的 issue 供有需要的人参考: #12

@pexcn pexcn closed this as completed Feb 11, 2020
@pexcn pexcn removed the help wanted Extra attention is needed label Feb 19, 2020
@NagaseKouichi
Copy link

基于rampis编译的chinadns-ng,以及luci,可以直接取用。
chinadns-ng_1.0-beta.15-1_mipsel_24kc.ipk
luci-app-chinadnsng_1.0-3_mipsel_24kc.ipk
其中luci与平台无关,各个平台都可以直接用
编译是基于19.07.1的sdk但是没有用到什么特殊的功能,应该从15以后的版本都没问题。
源码放在sdk的package下面,分类在
Utilities-->luci-chinadns-ng
make package/luci-app-chinadnsng/{clean,compile} -j V=99
即可
链接: https://pan.baidu.com/s/10bJbc_I6pM50-fqDilkklg 提取码: hhkc
image
另外目前采用ucitrack的功能希望能够让程序根据config的更改自行reload没办法实现,不知道为什么所以目前就没有添加uci-default文件,而是采用了在luci页面apply的时候执行reload,同时会在日志记录reload的信息。希望作者可以把service-trigger有空看看。

ucitrack这个我倒是实现了,pexcn大已经合并到luci分支了,你可以试试。

你之前不行是不是因为init文件没有加这个:
service_triggers() {
procd_add_reload_trigger "chinadns-ng"
}

我也是只会读代码和拼凑代码的新手……

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants