From 1e811544717a73c6206e98b1d07af0a879b6bc1e Mon Sep 17 00:00:00 2001 From: Dan Ponte Date: Wed, 14 Sep 2022 21:47:32 -0400 Subject: [PATCH] Blocky --- dns/blocky-amigan/Makefile | 32 +++++++++++++++++ dns/blocky-amigan/distinfo | 3 ++ .../files/blocky-config.yml.sample | 14 ++++++++ dns/blocky-amigan/files/blocky.in | 36 +++++++++++++++++++ dns/blocky-amigan/files/pkg-message.in | 14 ++++++++ dns/blocky-amigan/pkg-descr | 4 +++ dns/blocky-amigan/pkg-plist | 2 ++ 7 files changed, 105 insertions(+) create mode 100644 dns/blocky-amigan/Makefile create mode 100644 dns/blocky-amigan/distinfo create mode 100644 dns/blocky-amigan/files/blocky-config.yml.sample create mode 100644 dns/blocky-amigan/files/blocky.in create mode 100644 dns/blocky-amigan/files/pkg-message.in create mode 100644 dns/blocky-amigan/pkg-descr create mode 100644 dns/blocky-amigan/pkg-plist diff --git a/dns/blocky-amigan/Makefile b/dns/blocky-amigan/Makefile new file mode 100644 index 0000000..1608bcf --- /dev/null +++ b/dns/blocky-amigan/Makefile @@ -0,0 +1,32 @@ +PORTNAME= blocky +DISTVERSIONPREFIX= v +DISTVERSION= 0.19 +PORTREVISION= 6 +CATEGORIES= dns +#MASTER_SITES= https://raw.githubusercontent.com/${GH_ACCOUNT}/${GH_PROJECT}/${DISTVERSIONFULL}/:gomod +MASTER_SITES=https://git.dynatron.me/amigan/blocky/raw/branch/development/:gomod +DISTFILES= go.mod:gomod + +MAINTAINER= eduardo@FreeBSD.org +COMMENT= Fast and lightweight DNS proxy as ad-blocker + +LICENSE= APACHE20 +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= go:modules +USE_RC_SUBR= blocky + +GO_MODULE= pkg.dynatron.me/amigan/blocky +GO_TARGET= main.go:${PREFIX}/sbin/${PORTNAME} +GO_BUILDFLAGS= -ldflags "-w -s \ + -X github.com/0xERR0R/blocky/util.Version=${DISTVERSION} \ + -X github.com/0xERR0R/blocky/util.BuildTime=`date '+%Y%m%d-%H%M%S'`" +SUB_FILES= pkg-message + +do-extract: + git clone https://git.dynatron.me/amigan/blocky.git work/blocky-v0.19 + +post-install: + ${INSTALL_DATA} ${FILESDIR}/blocky-config.yml.sample ${STAGEDIR}${PREFIX}/etc/blocky-config.yml.sample + +.include diff --git a/dns/blocky-amigan/distinfo b/dns/blocky-amigan/distinfo new file mode 100644 index 0000000..7a325e4 --- /dev/null +++ b/dns/blocky-amigan/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1663205933 +SHA256 (go/dns_blocky-amigan/blocky-v0.19/go.mod) = 104ea489e877ff025d56ec0ea2f910b2e991f56f4a3b95fe26a3e7ddd318d2a2 +SIZE (go/dns_blocky-amigan/blocky-v0.19/go.mod) = 12460 diff --git a/dns/blocky-amigan/files/blocky-config.yml.sample b/dns/blocky-amigan/files/blocky-config.yml.sample new file mode 100644 index 0000000..aae167c --- /dev/null +++ b/dns/blocky-amigan/files/blocky-config.yml.sample @@ -0,0 +1,14 @@ +upstream: + default: + - 1.1.1.1 + - tcp-tls:fdns1.dismail.de:853 + - https://dns.digitale-gesellschaft.ch/dns-query +blocking: + blackLists: + ads: + - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts + clientGroupsBlock: + default: + - ads +port: 53 +httpPort: 4000 diff --git a/dns/blocky-amigan/files/blocky.in b/dns/blocky-amigan/files/blocky.in new file mode 100644 index 0000000..24a9202 --- /dev/null +++ b/dns/blocky-amigan/files/blocky.in @@ -0,0 +1,36 @@ +#!/bin/sh + +# PROVIDE: blocky +# REQUIRE: DAEMON NETWORKING +# KEYWORD: shutdown +# +# Add the following to /etc/rc.conf[.local] to enable this service +# +# blocky_enable (bool): Set to NO by default. +# Set it to YES to enable blocky. +# blocky_config (str): Set to /usr/local/etc/blocky/config.yml by default. +# + +. /etc/rc.subr + +name=blocky +rcvar=blocky_enable + +load_rc_config ${name} + +: ${blocky_enable:=NO} +: ${blocky_config:="%%PREFIX%%/etc/blocky-config.yml"} +: ${blocky_flags:=} + +pidfile=/var/run/blocky.pid +command="%%PREFIX%%/sbin/blocky" + +start_cmd="${name}_start" + +blocky_start() +{ + echo -n "Starting ${name}." + /usr/sbin/daemon -p ${pidfile} -f ${command} -c ${blocky_config} ${blocky_flags} +} + +run_rc_command "$1" diff --git a/dns/blocky-amigan/files/pkg-message.in b/dns/blocky-amigan/files/pkg-message.in new file mode 100644 index 0000000..953a51c --- /dev/null +++ b/dns/blocky-amigan/files/pkg-message.in @@ -0,0 +1,14 @@ +[ +{ type: install + message: <