add luci-app-ddns-go

This commit is contained in:
SirPdboy 2022-09-26 01:19:13 +08:00 committed by GitHub
parent 633e74ba47
commit 05c3c6f6ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 410 additions and 0 deletions

View File

@ -0,0 +1,39 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021-2022 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/luci-app-ddnsgo
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ddnsgo
PKG_VERSION:=4.0.4
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=multimedia
CATEGORY:=Multimedia
DEPENDS:=@(aarch64||arm||i386||mips||mipsel||x86_64)
TITLE:=A plug-in DDNS-GO by sirpdboy
URL:=https://github.com/sirpdboy/luci-app-ddns-go
endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
[ -f /etc/uci-defaults/luci-ddns-go ] && /etc/uci-defaults/luci-ddns-go && rm -f /etc/uci-defaults/luci-ddns-go
fi
endef
define Build/Compile
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d $(1)/etc/uci-defaults
$(INSTALL_BIN) ./file/ddnsgo.init $(1)/etc/init.d/ddnsgo
$(INSTALL_BIN) ./file/luci-ddns-go.uci-default $(1)/etc/uci-defaults/luci-ddns-go
$(INSTALL_BIN) ./file/x86_64 $(1)/usr/bin/ddns-go
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

Binary file not shown.

View File

@ -0,0 +1,54 @@
#!/bin/sh /etc/rc.common
#
# Copyright (C) 2021-2022 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/luci-app-ddns-go
#
# This file is part of ddns-go .
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
START=99
USE_PROCD=1
PROG=/usr/bin/ddns-go
CONFDIR=/etc/ddns-go
CONF=/etc/ddns-go/ddnsgo-config.yaml
get_config() {
config_get_bool enabled $1 enabled 1
config_get_bool logger $1 logger 1
config_get port $1 port 9876
}
ddnsgo_prepare() {
pgrep -f /usr/bin/ddns-go | xargs kill -9 >/dev/null 2>&1
logger -t ddns-go -p warn "ddns-go is stop."
}
init_yaml(){
[ -d $CONFDIR ] || mkdir -p $CONFDIR 2>/dev/null
cat /usr/share/ddns-go/ddnsgo-default.yaml > $CONF
}
stop_service() {
ddnsgo_prepare
}
start_service() {
ddnsgo_prepare
config_load ddnsgo
config_foreach get_config ddnsgo
[ x$enabled == x1 ] || return 1
[ -s ${CONF} ] || init_yaml
logger -t ddns-go -p warn "ddns-go is start."
echo "ddns-go is start."
procd_open_instance
procd_set_param command $PROG -l :$port -f 300 -c "$CONF"
[ "x$logger" == x1 ] && procd_set_param stderr 1
procd_set_param respawn
procd_close_instance
}
service_triggers() {
procd_add_reload_trigger "ddns-go"
}

Binary file not shown.

View File

@ -0,0 +1,6 @@
#!/bin/sh
/etc/init.d/ddnsgo enable
/etc/init.d/ddnsgo start
rm -f /tmp/luci*
exit 0

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,19 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021-2022 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/luci-app-ddns-go
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ddns-go
PKG_VERSION:=1.1.6
PKG_RELEASE:=1
LUCI_TITLE:=LuCI Support for Dynamic ddns-go Client
LUCI_DEPENDS:=+ddnsgo
LUCI_PKGARCH:=all
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,134 @@
### 访问数:[![](https://visitor-badge.glitch.me/badge?page_id=sirpdboy-visitor-badge)] [![](https://img.shields.io/badge/TG群-点击加入-FFFFFF.svg)](https://t.me/joinchat/AAAAAEpRF88NfOK5vBXGBQ)
欢迎来到sirpdboy的源码仓库
=
# luci-app-ddns-go
luci-app-ddns-go 自动获得你的公网 IPv4 或 IPv6 地址,并解析到对应的域名服务。支持的域名服务商 Alidns(阿里云) Dnspod(腾讯云) Cloudflare 华为云 Callback 百度云 porkbun GoDaddy
[![若部分图片无法正常显示,请挂上机场浏览或点这里到末尾看修复教程](https://visitor-badge.glitch.me/badge?page_id=sirpdboy-visitor-badge)](#解决-github-网页上图片显示失败的问题) [![](https://img.shields.io/badge/TG群-点击加入-FFFFFF.svg)](https://t.me/joinchat/AAAAAEpRF88NfOK5vBXGBQ)
[luci-app-ddns-go ddns-go动态域名插件](https://github.com/sirpdboy/luci-app-ddns-go)
======================
**认真阅读完毕** 本页面,本页面包含注意事项和如何使用。
## 功能说明:
### ddns-go动态域名插件
#### 自动获得你的公网 IPv4 或 IPv6 地址,并解析到对应的域名服务。
<!-- TOC -->
- [ddns-go](#ddns-go)
- [特性](#特性)
- [使用方法](#使用方法)
- [说明](#说明)
- [界面](#界面)
- [捐助](#捐助)
<!-- /TOC -->
## 特性
- 支持Mac、Windows、Linux系统支持ARM、x86架构
- 支持的域名服务商 `Alidns(阿里云)` `Dnspod(腾讯云)` `Cloudflare` `华为云` `Callback` `百度云` `porkbun` `GoDaddy`
- 支持接口/网卡获取IP
- 支持以服务的方式运行
- 默认间隔5分钟同步一次
- 支持多个域名同时解析,公司必备
- 支持多级域名
- 网页中配置,简单又方便,可设置 `登录用户名和密码` / `禁止从公网访问`
- 网页中方便快速查看最近50条日志不需要跑docker中查看
- 支持webhook通知
- 支持TTL
- 支持部分dns服务商传递自定义参数实现地域解析等功能
## 使用方法
- 将luci-app-ddns-go添加至 LEDE/OpenWRT 源码的方法。
### 下载源码方法一:
- 编辑源码文件夹根目录feeds.conf.default并加入如下内容:
```Brach
# feeds获取源码
src-git luci-app-ddns-go https://github.com/sirpdboy/luci-app-ddns-go
```
```Brach
# 更新feeds并安装主题
scripts/feeds update luci-app-ddns-go
scripts/feeds install luci-app-ddns-go
```
### 下载源码方法二:
```Brach
# 下载源码
git clone https://github.com/sirpdboy/luci-app-ddns-go.git package/ddns-go
make menuconfig
```
### 配置菜单
```Brach
make menuconfig
# 找到 LuCI -> Applications, 选择 luci-app-ddns-go, 保存后退出。
```
### 编译
```Brach
# 编译固件
make package/ddns-go/luci-app-ddns-go/compile V=s
```
## 说明
-源码来源https://github.com/sirpdboy/luci-app-ddns-go
-你可以随意使用其中的源码,但请注明出处。
============================
## 界面
![screenshots](https://raw.githubusercontent.com/jeessy2/ddns-go/master/ddns-web.png)
# My other project
网络速度测试 https://github.com/sirpdboy/NetSpeedTest
定时设置插件 : https://github.com/sirpdboy/luci-app-autotimeset
关机功能插件 : https://github.com/sirpdboy/luci-app-poweroffdevice
opentopd主题 : https://github.com/sirpdboy/luci-theme-opentopd
opentoks 主题: https://github.com/sirpdboy/luci-theme-opentoks [仿KOOLSAHRE主题]
btmob 主题: https://github.com/sirpdboy/luci-theme-btmob
系统高级设置 : https://github.com/sirpdboy/luci-app-advanced
## 捐助
-如果你觉得此项目对你有帮助,请捐助我们,以使项目能持续发展,更加完善。··请作者喝杯咖啡~~~**
-你们的支持就是我的动力!**
| <img src="https://img.shields.io/badge/-支付宝-F5F5F5.svg" href="#赞助支持本项目-" height="25" alt="图飞了😂"/> | <img src="https://img.shields.io/badge/-微信-F5F5F5.svg" height="25" alt="图飞了😂" href="#赞助支持本项目-"/> |
| :-----------------: | :-------------: |
|![xm1](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/支付宝.png) | ![xm1](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/微信.png) |
<a href="#readme">
<img src="https://img.shields.io/badge/-返回顶部-orange.svg" alt="图飞了😂" title="返回顶部" align="right"/>
</a>

View File

@ -0,0 +1,25 @@
-- Copyright (C) 2021-2022 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/luci-app-ddnsgo
-- Licensed to the public under the Apache License 2.0.
module("luci.controller.ddnsgo", package.seeall)
function index()
if not nixio.fs.access("/etc/config/ddnsgo") then
return
end
entry({"admin", "services", "ddnsgo"}, cbi("ddnsgo"), _("DDNS-GO"), 58).dependent = true
entry({"admin", "services", "ddnsgo_status"}, call("act_status"))
end
function act_status()
local sys = require "luci.sys"
local uci = require "luci.model.uci".cursor()
local port = tonumber(uci:get_first("ddnsgo", "ddnsgo", "port"))
local e = { }
e.running = sys.call("pidof ddns-go >/dev/null") == 0
e.port = port or 9876
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end

View File

@ -0,0 +1,27 @@
-- Copyright (C) 2021-2022 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/luci-app-ddns-go
local m, s
local m = Map("ddnsgo", translate("DDNS-GO"), translate("DDNS-GO automatically obtains your public IPv4 or IPv6 address and resolves it to the corresponding domain name service.")..translate("</br>For specific usage, see:")..translate("<a href=\'https://github.com/sirpdboy/luci-app-ddns-go.git' target=\'_blank\'>GitHub @sirpdboy/luci-app-ddns-go </a>") )
m:section(SimpleSection).template = "ddnsgo_status"
s = m:section(TypedSection, "ddnsgo", translate("Global Settings"))
s.addremove=false
s.anonymous=true
o=s:option(Flag,"enabled",translate("Enable"))
o.default=0
o=s:option(Value, "port",translate("Set the DDNS-TO access port"))
o.datatype="uinteger"
o.default=9876
o:depends("enabled",1)
local e=luci.http.formvalue("cbi.apply")
if e then
io.popen("/etc/init.d/ddnsgo start")
end
return m

View File

@ -0,0 +1,26 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[services]], [[ddnsgo_status]])%>', null,
function(x, data) {
var tb = document.getElementById('ddnsgo_status');
if (data && tb)
{
if (data.running)
{
tb.innerHTML = '<br/><em style=\"color:green\"><%:The DDNS-GO service is running.%></em>'
+ "<br/><br/><input class=\"btn cbi-button cbi-button-apply\" type=\"button\" value=\" <%:Click to open DDNS-GO%> \" onclick=\"window.open('http://" + window.location.hostname + ":" + data.port + "/')\"/>";
}
else
{
tb.innerHTML = '<br/><em style=\"color:red\"><%:The DDNS-GO service is not running.%></em>';
}
}
}
);
//]]></script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<legend><%:DDNS-GO Status%></legend>
<p id="ddnsgo_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

View File

@ -0,0 +1,33 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "DDNS-GO"
msgstr "DDNS-GO"
msgid "Click to open DDNS-GO"
msgstr "点击打开DDNS-GO"
msgid "DDNS-GO automatically obtains your public IPv4 or IPv6 address and resolves it to the corresponding domain name service."
msgstr "DDNS-GO自动获得你的公网 IPv4 或 IPv6 地址,并解析到对应的域名服务."
msgid "Running state"
msgstr "运行状态"
msgid "The DDNS-GO service is running."
msgstr "DDNS-GO服务已启动"
msgid "The DDNS-GO service is not running."
msgstr "DDNS-GO服务未启动"
msgid "DDNS-GO Status"
msgstr "DDNS-GO服务状态"
msgid "Collecting data..."
msgstr "收集数据..."
msgid "Set the DDNS-TO access port"
msgstr "设置DDNS-TO访问端口"
msgid "</br>For specific usage, see:"
msgstr "</br>具体使用方法参见:"

View File

@ -0,0 +1 @@
zh-cn

View File

@ -0,0 +1,4 @@
config ddnsgo
option enabled '0'
option logger '1'
option port 9876

View File

@ -0,0 +1,4 @@
#!/bin/sh
rm -f /tmp/luci*
exit 0

View File

@ -0,0 +1,27 @@
ipv4:
enable: true
gettype: url
url: https://myip4.ipip.net, https://ddns.oray.com/checkip, https://ip.3322.net
netinterface: br-lan
domains:
- ""
ipv6:
enable: false
gettype: url
url: https://myip6.ipip.net, https://speed.neu6.edu.cn/getIP.php, https://v6.ident.me
netinterface: ""
ipv6reg: ""
domains:
- ""
dns:
name: alidns
id: ""
secret: ""
user:
username: ""
password: ""
webhook:
webhookurl: ""
webhookrequestbody: ""
notallowwanaccess: true
ttl: ""

View File

@ -0,0 +1,11 @@
{
"luci-app-ddns-go": {
"description": "Grant UCI access for luci-app-ddns-go",
"read": {
"uci": [ "ddnsgo" ]
},
"write": {
"uci": [ "ddnsgo" ]
}
}
}