Created
December 17, 2016 15:53
-
-
Save foxundermoon/acd1c0a058215d079a86e83efda3aed6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ShadowsocksGetui < Formula | |
desc "Kcptun for speed up shadowsocks over gt3d" | |
# homepage "https://github.com/xtaci/kcptun" | |
# url "https://github.com/xtaci/kcptun/releases/download/v20161207/kcptun-darwin-amd64-20161207.tar.gz" | |
url "http://data.vvfox.com/tools/shadowsocks-getui-1.0.0.tar" | |
# sha256 "751f79884e83510d6052f6d04908115f6e141b779f2b00882e4019ea2b0bbd58" | |
# head "https://github.com/xtaci/kcptun.git" | |
# bottle do | |
# cellar :any | |
# sha256 "751f79884e83510d6052f6d04908115f6e141b779f2b00882e4019ea2b0bbd58" => :sierra | |
# sha256 "751f79884e83510d6052f6d04908115f6e141b779f2b00882e4019ea2b0bbd58" => :el_capitan | |
# sha256 "751f79884e83510d6052f6d04908115f6e141b779f2b00882e4019ea2b0bbd58" => :yosemite | |
# end | |
# depends_on "asciidoc" => :build | |
# depends_on "xmlto" => :build | |
# depends_on "openssl" | |
# depends_on "pcre" | |
depends_on "shadowsocks-libev" => :run | |
depends_on "kcptun" => :run | |
def install | |
# ENV["XML_CATALOG_FILES"] = etc/"xml/catalog" | |
# | |
# system "./configure", "--prefix=#{prefix}" | |
# system "make" | |
(buildpath/"shadowsocks-getui.json").write <<-EOS.undent | |
{ | |
"server":"3d.logful.top", | |
"server_port":8384, | |
"local_port":8385, | |
"local_address":"0.0.0.0", | |
"password":"vvfox", | |
"timeout":600, | |
"method":"aes-128-cfb" | |
} | |
EOS | |
bin.install "shadowsocks-getui.sh" | |
etc.install "shadowsocks-getui.json" | |
# bin.install "client_darwin_amd64" | |
inreplace Dir["man/*"], "/etc/shadowsocks-getui/config.json", "#{etc}/shadowsocks-getui.json" | |
# system "make", "install" | |
end | |
# kcptun = Formula["kcptun"] | |
# kcp_bin=kcptun.bin | |
shadowsocks = Formula["shadowsocks-libev"] | |
ss_bin=shadowsocks.bin | |
plist_options :startup => false | |
plist_options :manual => "#{ss_bin}/ss-local -c #{HOMEBREW_PREFIX}/etc/shadowsocks-getui.json" | |
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>#{Formula["shadowsocks-libev"].bin}/ss-local</string> | |
<string>-c</string> | |
<string>#{etc}/shadowsocks-getui.json</string> | |
</array> | |
<key>RunAtLoad</key> | |
<false/> | |
<key>KeepAlive</key> | |
<true/> | |
</dict> | |
</plist> | |
EOS | |
end | |
test do | |
(testpath/"shadowsocks-getui.json").write <<-EOS.undent | |
{ | |
"server":"3d.logful.top", | |
"server_port":8384, | |
"local_port":8385, | |
"local_address":"0.0.0.0", | |
"password":"vvfox", | |
"timeout":600, | |
"method":"aes-128-cfb" | |
} | |
EOS | |
# server = fork { exec bin/"ss-server", "-c", testpath/"shadowsocks-libev.json" } | |
client = fork { exec bin/"ss-local", "-c", testpath/"shadowsocks-getui.json" } | |
sleep 3 | |
begin | |
system "curl", "--socks5", "127.0.0.1:8385", "github.com" | |
ensure | |
# Process.kill 9, server | |
# Process.wait server | |
Process.kill 9, client | |
Process.wait client | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment