homebrew-core/Formula/v2ray-plugin.rb

35 lines
1.2 KiB
Ruby
Raw Normal View History

class V2rayPlugin < Formula
desc "SIP003 plugin based on v2ray for shadowsocks"
homepage "https://github.com/shadowsocks/v2ray-plugin"
url "https://github.com/shadowsocks/v2ray-plugin/archive/v1.1.0.tar.gz"
sha256 "87e708f54f46bf5c29ea257303037f1c22b4b5750bc5ef94e9d4630a4ba3df1a"
head "https://github.com/shadowsocks/v2ray-plugin.git"
2019-02-27 19:13:58 +00:00
bottle do
cellar :any_skip_relocation
2019-03-03 17:37:13 +00:00
sha256 "23213349b935a05f0ae927631598fa7295dc1cf2112abacd0f6bc27964062334" => :mojave
sha256 "c3c69fecbecc40ecc495eca5253b922f205fa91f20cd2e09f4e3d3522065d0af" => :high_sierra
sha256 "e1c311e9aa7ae802a2b3740458167d00b66693c73d92b2db7f85d4302ad4c256" => :sierra
2019-02-27 19:13:58 +00:00
end
depends_on "go" => :build
def install
system "go", "build", "-o", bin/"v2ray-plugin"
end
test do
server = fork { exec bin/"v2ray-plugin", "-localPort", "54000", "-remoteAddr", "github.com", "-remotePort", "80", "-server" }
client = fork { exec bin/"v2ray-plugin", "-localPort", "54001", "-remotePort", "54000" }
sleep 2
begin
system "curl", "localhost:54001"
ensure
Process.kill 9, server
Process.wait server
Process.kill 9, client
Process.wait client
end
end
end