From 88b7d161265f4eb3e6c842ea78d6c64cdd11916c Mon Sep 17 00:00:00 2001 From: MoonFruit Date: Thu, 30 Nov 2023 10:41:54 +0800 Subject: [PATCH] gost@3 3.0.0-nightly.20231129 --- Formula/gost@3.rb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Formula/gost@3.rb diff --git a/Formula/gost@3.rb b/Formula/gost@3.rb new file mode 100644 index 0000000..1dc3b91 --- /dev/null +++ b/Formula/gost@3.rb @@ -0,0 +1,33 @@ +class GostAT3 < Formula + desc "Go simple tunnel" + homepage "https://gost.run/" + url "https://github.com/go-gost/gost/archive/refs/tags/v3.0.0-nightly.20231129.tar.gz" + version "3.0.0-nightly.20231129" + sha256 "7db5094a00d465e2a440f392753d135028d53ad0ed0dd888932d04b2671754fc" + license "MIT" + head "https://github.com/go-gost/gost.git", branch: "master" + + livecheck do + url :stable + end + + keg_only :versioned_formula + + depends_on "go" => :build + + def install + system "go", "build", *std_go_args(ldflags: "-s -w", output: bin/"gost"), "./cmd/gost" + prefix.install "README_en.md" + end + + test do + bind_address = "127.0.0.1:#{free_port}" + fork do + exec "#{bin}/gost -L #{bind_address}" + end + sleep 2 + output = shell_output("curl -I -x #{bind_address} https://github.com") + assert_match %r{HTTP/\d+(?:\.\d+)? 200}, output + assert_match(/Server: GitHub.com/i, output) + end +end