From 8cb99aa89482f216eb3ec31077e6bbfb0589b00e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E9=AD=9A=28iFish=29?= Date: Tue, 27 Jul 2021 17:02:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0smartdns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- smartdns/Makefile | 59 ++++++++++++++++++++++++++++++++++++++++ smartdns/ReadMe.md | 68 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 smartdns/Makefile create mode 100644 smartdns/ReadMe.md diff --git a/smartdns/Makefile b/smartdns/Makefile new file mode 100644 index 0000000..27bed84 --- /dev/null +++ b/smartdns/Makefile @@ -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 +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)) diff --git a/smartdns/ReadMe.md b/smartdns/ReadMe.md new file mode 100644 index 0000000..4d039b7 --- /dev/null +++ b/smartdns/ReadMe.md @@ -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 + +``` + +上述命令完成后,可执行编译。