80 lines
2.6 KiB
Ruby
80 lines
2.6 KiB
Ruby
class Stubby < Formula
|
|
desc "DNS privacy enabled stub resolver service based on getdns"
|
|
homepage "https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Daemon+-+Stubby"
|
|
url "https://github.com/getdnsapi/stubby/archive/v0.3.0.tar.gz"
|
|
sha256 "b37a0e0ec2b7cfcdcb596066a6fd6109e91a2766b17a42c47d3703d9be41d000"
|
|
license "BSD-3-Clause"
|
|
head "https://github.com/getdnsapi/stubby.git", branch: "develop"
|
|
|
|
bottle do
|
|
rebuild 1
|
|
sha256 "aaa2e665539768e5095b04cdbbf61b8b865334770e4608f144096f010631d47c" => :catalina
|
|
sha256 "be2d27bc1ceb52f5728c34b179ba4b57593ded2e66c87c4ab26fa6e89ac26ece" => :mojave
|
|
sha256 "437687f0eebd8218424dbefd61988a5ebb9c2a4487c779c36a329deaf2c2ad92" => :high_sierra
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "libtool" => :build
|
|
depends_on "getdns"
|
|
depends_on "libyaml"
|
|
|
|
def install
|
|
system "cmake", "-DCMAKE_INSTALL_RUNSTATEDIR=#{HOMEBREW_PREFIX}/var/run/", \
|
|
"-DCMAKE_INSTALL_SYSCONFDIR=#{HOMEBREW_PREFIX}/etc", ".", *std_cmake_args
|
|
system "make", "install"
|
|
end
|
|
|
|
plist_options startup: true, manual: "sudo stubby -C #{HOMEBREW_PREFIX}/etc/stubby/stubby.yml"
|
|
|
|
def plist
|
|
<<~EOS
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>Label</key>
|
|
<string>#{plist_name}</string>
|
|
<key>KeepAlive</key>
|
|
<true/>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>#{opt_bin}/stubby</string>
|
|
<string>-C</string>
|
|
<string>#{etc}/stubby/stubby.yml</string>
|
|
</array>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
assert_predicate etc/"stubby/stubby.yml", :exist?
|
|
(testpath/"stubby_test.yml").write <<~EOS
|
|
resolution_type: GETDNS_RESOLUTION_STUB
|
|
dns_transport_list:
|
|
- GETDNS_TRANSPORT_TLS
|
|
- GETDNS_TRANSPORT_UDP
|
|
- GETDNS_TRANSPORT_TCP
|
|
listen_addresses:
|
|
- 127.0.0.1@5553
|
|
idle_timeout: 0
|
|
upstream_recursive_servers:
|
|
- address_data: 145.100.185.15
|
|
- address_data: 145.100.185.16
|
|
- address_data: 185.49.141.37
|
|
EOS
|
|
output = shell_output("#{bin}/stubby -i -C stubby_test.yml")
|
|
assert_match "bindata for 145.100.185.15", output
|
|
|
|
fork do
|
|
exec "#{bin}/stubby", "-C", testpath/"stubby_test.yml"
|
|
end
|
|
sleep 2
|
|
|
|
output = shell_output("dig @127.0.0.1 -p 5553 getdnsapi.net")
|
|
assert_match "status: NOERROR", output
|
|
end
|
|
end
|