添加smartdns

This commit is contained in:
木魚(iFish) 2021-07-27 17:02:42 +08:00
parent cef390eab3
commit 8cb99aa894
2 changed files with 127 additions and 0 deletions

59
smartdns/Makefile Normal file
View File

@ -0,0 +1,59 @@
#
# Copyright (c) 2018-2020 Nick Peng (pymumu@gmail.com)
# This is free software, licensed under the GNU General Public License v3.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=smartdns
PKG_VERSION:=1.2020.30
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://www.github.com/pymumu/smartdns.git
PKG_SOURCE_VERSION:=0aec326d551925a269a960677f4cd432d8e89385
PKG_MIRROR_HASH:=62afc5c94bc357a2848818a10ca1d3e33acef235146822d30916ebfc4abee313
PKG_MAINTAINER:=Nick Peng <pymumu@gmail.com>
PKG_LICENSE:=GPL-3.0-or-later
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
MAKE_VARS += VER=$(PKG_VERSION)
MAKE_PATH:=src
define Package/smartdns
SECTION:=net
CATEGORY:=Network
TITLE:=smartdns server
DEPENDS:=+libpthread +libopenssl
URL:=https://www.github.com/pymumu/smartdns/
endef
define Package/smartdns/description
SmartDNS is a local DNS server which accepts DNS query requests from local network clients,
gets DNS query results from multiple upstream DNS servers concurrently, and returns the fastest IP to clients.
Unlike dnsmasq's all-servers, smartdns returns the fastest IP.
endef
define Package/smartdns/conffiles
/etc/config/smartdns
/etc/smartdns/address.conf
/etc/smartdns/blacklist-ip.conf
/etc/smartdns/custom.conf
endef
define Package/smartdns/install
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d $(1)/etc/smartdns
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/smartdns $(1)/usr/sbin/smartdns
$(INSTALL_BIN) $(PKG_BUILD_DIR)/package/openwrt/files/etc/init.d/smartdns $(1)/etc/init.d/smartdns
$(INSTALL_CONF) $(PKG_BUILD_DIR)/package/openwrt/address.conf $(1)/etc/smartdns/address.conf
$(INSTALL_CONF) $(PKG_BUILD_DIR)/package/openwrt/blacklist-ip.conf $(1)/etc/smartdns/blacklist-ip.conf
$(INSTALL_CONF) $(PKG_BUILD_DIR)/package/openwrt/custom.conf $(1)/etc/smartdns/custom.conf
$(INSTALL_CONF) $(PKG_BUILD_DIR)/package/openwrt/files/etc/config/smartdns $(1)/etc/config/smartdns
endef
$(eval $(call BuildPackage,smartdns))

68
smartdns/ReadMe.md Normal file
View File

@ -0,0 +1,68 @@
# openwrt-smartdns
此仓库为smartdns独立仓库为单独编译使用可配合luci-app-smartdns一起使用。
luci界面[luci-app-smartdns](https://github.com/pymumu/luci-app-smartdns)
## 使用方式
注意如下命令操作路径为openwrt源代码所在目录。
### 复制仓库中的文件到如下目录,并执行安装
```shell
./feeds/packages/net/smartdns/
./scripts/feeds install package -a
```
### 执行openwrt配置, 选中smartdns
执行编译配置:
```shell
make menuconfig
```
* 选择路径:
Network > smartdns
* 编译模式:
1. 若编译独立软件包,选择编译模式为`M`
1. 若编译到固件中,选择编译模式为`*`
### 执行openwrt编译
仅编译软件包:
```shell
make package/feeds/packages/smartdns/compile
```
编译固件以及软件包。
```shell
make -j8
```
## 懒人脚本
也可可执行如下命令一次性下载smartdns。
下列命令可采用复制粘贴的方式执行, 注意目录需要在openwrt源代码目录中。
```shell
WORKINGDIR="`pwd`/feeds/packages/net/smartdns"
mkdir $WORKINGDIR -p
rm $WORKINGDIR/* -fr
wget https://github.com/pymumu/openwrt-smartdns/archive/master.zip -O $WORKINGDIR/master.zip
unzip $WORKINGDIR/master.zip -d $WORKINGDIR
mv $WORKINGDIR/openwrt-smartdns-master/* $WORKINGDIR/
rmdir $WORKINGDIR/openwrt-smartdns-master
rm $WORKINGDIR/master.zip
./scripts/feeds install -a
make menuconfig
```
上述命令完成后,可执行编译。