Pcap_DNSProxy 0.4.2 (new formula)
Closes Homebrew/homebrew#40381. Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
parent
e996a3e2ee
commit
4cbac9faae
1 changed files with 65 additions and 0 deletions
65
Formula/pcap_dnsproxy.rb
Normal file
65
Formula/pcap_dnsproxy.rb
Normal file
|
@ -0,0 +1,65 @@
|
|||
class PcapDnsproxy < Formula
|
||||
desc "A powerful DNS proxy designed to anti DNS spoofing"
|
||||
homepage "https://github.com/chengr28/Pcap_DNSProxy"
|
||||
url "https://github.com/chengr28/Pcap_DNSProxy/archive/v0.4.2.tar.gz"
|
||||
sha256 "0737b16283e84bc94f63066f448ba84416141b8d5a86b5e01f1f97164d9d44f2"
|
||||
head "https://github.com/chengr28/Pcap_DNSProxy.git"
|
||||
|
||||
depends_on :xcode => :build
|
||||
depends_on "libsodium" => :build
|
||||
|
||||
def install
|
||||
rm Dir[buildpath/"Source/LibSodium/*"]
|
||||
ln_s "#{Formula["libsodium"].opt_lib}/libsodium.a", "#{buildpath}/Source/LibSodium/LibSodium_Mac.a"
|
||||
ln_s Dir[Formula["libsodium"].opt_include/"*"], "#{buildpath}/Source/LibSodium/"
|
||||
xcodebuild "-project", "./Source/KeyPairGenerator.xcodeproj", "-target", "KeyPairGenerator", "-configuration", "Release", "SYMROOT=build"
|
||||
xcodebuild "-project", "./Source/Pcap_DNSProxy.xcodeproj", "-target", "Pcap_DNSProxy", "-configuration", "Release", "SYMROOT=build"
|
||||
|
||||
bin.install "Source/build/Release/KeyPairGenerator"
|
||||
bin.install "Source/build/Release/Pcap_DNSProxy"
|
||||
(etc/"pcap_DNSproxy").install Dir["Source/ExampleConfig/*.{ini,txt}"]
|
||||
end
|
||||
|
||||
test do
|
||||
mkdir testpath/"pcap_dnsproxy"
|
||||
cp Dir[etc/"pcap_dnsproxy/*"], testpath/"pcap_dnsproxy/"
|
||||
inreplace testpath/"pcap_dnsproxy/Config.ini" do |s|
|
||||
s.gsub! /^Hosts Only.*/, "Hosts Only = 1"
|
||||
s.gsub! /^Listen Port.*/, "Listen Port = 9999"
|
||||
end
|
||||
pid = fork { exec bin/"Pcap_DNSProxy", "-c", testpath/"pcap_dnsproxy/" }
|
||||
begin
|
||||
system "dig", "google.com", "@127.0.0.1", "-p", "9999", "+short"
|
||||
ensure
|
||||
Process.kill 9, pid
|
||||
Process.wait pid
|
||||
end
|
||||
end
|
||||
|
||||
plist_options :startup => true, :manual => "sudo #{HOMEBREW_PREFIX}/opt/pcap_dnsproxy/bin/Pcap_DNSProxy -c #{HOMEBREW_PREFIX}/etc/pcap_dnsproxy/"
|
||||
|
||||
def plist; <<-EOS.undent
|
||||
<?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>ProgramArguments</key>
|
||||
<array>
|
||||
<string>#{opt_bin}/Pcap_DNSProxy</string>
|
||||
<string>-c</string>
|
||||
<string>#{etc}/pcap_dnsproxy/</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>KeepAlive</key>
|
||||
<dict>
|
||||
<key>SuccessfulExit</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
EOS
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue