68 lines
2.6 KiB
Ruby
68 lines
2.6 KiB
Ruby
class Frpc < Formula
|
|
desc "Client app of fast reverse proxy to expose a local server to the internet"
|
|
homepage "https://github.com/fatedier/frp"
|
|
url "https://github.com/fatedier/frp.git",
|
|
tag: "v0.36.2",
|
|
revision: "c5c79e4148245a1910c19ee5aba0f9933ac6d2cd"
|
|
license "Apache-2.0"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "c209ea150f7902398c0d1c553824e1f83ba3f7bea01156605052fe1c2ed46f02"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "8d05a073991df069f8653a0c7a64ffe096b834a2858da29a48b0bb5dac2c3198"
|
|
sha256 cellar: :any_skip_relocation, catalina: "a54666994a2deeea8e59a0c76ef1142346b97c40f2cde4dbb062cd7faccb0e6d"
|
|
sha256 cellar: :any_skip_relocation, mojave: "024ae17aa3116e043528002e83f32b5988fcdb94192e3da91c3e71cda9274286"
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
(buildpath/"bin").mkpath
|
|
(etc/"frp").mkpath
|
|
|
|
system "make", "frpc"
|
|
bin.install "bin/frpc"
|
|
etc.install "conf/frpc.ini" => "frp/frpc.ini"
|
|
etc.install "conf/frpc_full.ini" => "frp/frpc_full.ini"
|
|
end
|
|
|
|
plist_options manual: "frpc -c #{HOMEBREW_PREFIX}/etc/frp/frpc.ini"
|
|
|
|
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>ProgramArguments</key>
|
|
<array>
|
|
<string>#{opt_bin}/frpc</string>
|
|
<string>-c</string>
|
|
<string>#{etc}/frp/frpc.ini</string>
|
|
</array>
|
|
<key>StandardErrorPath</key>
|
|
<string>#{var}/log/frpc.log</string>
|
|
<key>StandardOutPath</key>
|
|
<string>#{var}/log/frpc.log</string>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{bin}/frpc -v")
|
|
assert_match "Commands", shell_output("#{bin}/frpc help")
|
|
assert_match "local_port", shell_output("#{bin}/frpc http", 1)
|
|
assert_match "local_port", shell_output("#{bin}/frpc https", 1)
|
|
assert_match "local_port", shell_output("#{bin}/frpc stcp", 1)
|
|
assert_match "local_port", shell_output("#{bin}/frpc tcp", 1)
|
|
assert_match "local_port", shell_output("#{bin}/frpc udp", 1)
|
|
assert_match "local_port", shell_output("#{bin}/frpc xtcp", 1)
|
|
assert_match "admin_port", shell_output("#{bin}/frpc status -c #{etc}/frp/frpc.ini", 1)
|
|
assert_match "admin_port", shell_output("#{bin}/frpc reload -c #{etc}/frp/frpc.ini", 1)
|
|
end
|
|
end
|