From 0e7c5fb7ab637be1ea0de47f644fdf399b35bcb2 Mon Sep 17 00:00:00 2001 From: Zakk Date: Sun, 15 Nov 2026 18:38:53 +1100 Subject: [PATCH] net-proxy/clash-rs: add 0.10.12, drop 0.10.10 Upstream moved TUIC to the rust-proxy/wind git crates, shadowsocks to crates.io, and added tailscale-rs from git; GIT_CRATES follows Cargo.lock. The tailscale and ts_netmon entries of [patch.crates-io] are replaced with local paths like rustls, because cargo runs offline. Signed-off-by: Zakk --- net-proxy/clash-rs/Manifest | 13 +- net-proxy/clash-rs/clash-rs-0.10.10.ebuild | 120 ---------------- net-proxy/clash-rs/clash-rs-0.10.12.ebuild | 154 +++++++++++++++++++++ 3 files changed, 160 insertions(+), 127 deletions(-) delete mode 100644 net-proxy/clash-rs/clash-rs-0.10.10.ebuild create mode 100644 net-proxy/clash-rs/clash-rs-0.10.12.ebuild diff --git a/net-proxy/clash-rs/Manifest b/net-proxy/clash-rs/Manifest index 0921cc5ff0..3da87ed295 100644 --- a/net-proxy/clash-rs/Manifest +++ b/net-proxy/clash-rs/Manifest @@ -1,15 +1,14 @@ DIST boring-noise-9ddf1b54d0c9679e7bc50e9151f72d526190db1a.gh.tar.gz 25670 BLAKE2B 7aa4e75cbb64dba7a82ff253102a251d6a8f33a91b78afcf63d9d127eff8b385e86e07548c5294fcfc6daa31fde955306931ab2da6f9d599b11a9ad0d3d9fafa SHA512 11ca5c63802132118dfb2950ec31709b50e6f17a8ac3d7f3bda81c4045dcf4dce638ca9ae1c78b508e48e0bb475c14837b2cc13ad17b9c8a6ec868d36110e68e -DIST clash-rs-0.10.10-crates.tar.xz 80477228 BLAKE2B 925662af427452c39ffd8c61f3ab3c6c15cabe142fcf6dee3bd429f2c03bda5d46f386456cd3e67fa1c0a9e1d26747c4568f77940b57eea96e76d381708935f2 SHA512 f0a23c1a80b32621254f9db2d69c8975b4f78193ea6343c70afe5e1eb754508b85cb02dcf70b456036f6263573253f98ba5f61a09f1b1292751221e3d1e9a265 -DIST clash-rs-0.10.10.tar.gz 984637 BLAKE2B 6276cc5359cb7b9b30b214a4aa8292bae30196c887df685f8eb69e9dcdf8835322b669cb5b9fc420b3bda0c7f1680e3660a55d73555c99a1fd678bc3d21783dd SHA512 614280e5e8ba8dc2f8aada4e81d89f531b28c1a100e45a44f6db4d830356c1a38d1c6e4d27dc2267d0f4b5595473c7ebe31ff22185ca741f3cf84112f681701a +DIST clash-rs-0.10.12-crates.tar.xz 69260572 BLAKE2B ef73d69e86bf234ea8f96967a1c88a7c1724718e93b61cce83996653ef35ca2ae28379e09eea95c92052bf8cfd54dfc54d05e84090ac4192cf69ac0ca0c00357 SHA512 25ea159250a92905cc90ffa612ebaf2ccba469cd3ef1e53b693841440e053886bfddd52c223d821b9fb13b355433f2d04803d3cd7d1ec7647732475dd6a5ed17 +DIST clash-rs-0.10.12.tar.gz 983635 BLAKE2B 3a3d2a4cf387ee3a4e353a91bc9d8bb0bd0bc5087821f8d5272e58fc725f67f0eef263d676b4593c6cb4310a9a740511aae4df28854305267ce3484f01a88cf1 SHA512 5155cf48ec8433b8f4e852709fd2ecf5fd71b698ec3e9f5b723c16c210b51870d609aa8e02e239f2ce6a7450a8ca8bb1358e2f94c7baf2335f5b471f10abf22c DIST console-b59758e5a6effe3a9df3ec84a2f28d319d178234.gh.tar.gz 5636974 BLAKE2B 049292fc77041ebe936501ab6317f21de659a84ca4b90164716a91b49f4e0d833318994a1f9d3044c89bbb01fd313c2acaa553e99ed681970aa1f18aa6aa8c4d SHA512 10e7cffb3486517bfc6cb1e35afc41fcca9d50182a09472e756d751eba266d8d3163ddeca0837019bd6bc751ba26ba7dbb3a291802b70480a2c8862ba124ef9e DIST dhcproto-eece41c9a13b0e4912fb9a8f08401ab01b4123d4.gh.tar.gz 68698 BLAKE2B 6a147ff0919f32ac0e0a559eaf5c958172a152c17f41b16f2ca7e345cef5c668f5412e42c53ab98d044fc21d6172a99d4ecbc286a4a1625557d0bce54a896359 SHA512 72dec7a1929435caa0f5a9d2601e020f0ec286e523b290e076e1ab5385cf3c834b9ec3b3d4628523bc3df5549f550f1241268999bb93bce35e387a16d80937b7 DIST netstack-lwip-f434fefd6c227c9dfbec84c364452ba6c1532779.gh.tar.gz 521894 BLAKE2B fac833d46a7cf66e3f43f0b798537c069155df81ec2705f35058231efc579500e495e88132d86bca21b644937e6a9cd83c76fe73814dc4ab9b94ba3f786b7872 SHA512 99f1408e3d2ffb945b43268ffbac183a606f73fe17b4a35289492562cfa9ead36c8427a9201c37aca94aa06a5525e9667459a1e79a70679ac5c8d2c789597cf9 -DIST quinn-ce60e5b5c115db2a6053f4e0ca7fc52103cb76b9.gh.tar.gz 794520 BLAKE2B 83cd80d11f1595df69cfebec82b40320bcb16cae2d54ce90f9a02c94d12c277b10808d4e8c4be46a4f93b4b8337827f1d4e40f4166359c12df4de4af073d718e SHA512 3a2c22086eb7bed36ffeda2a796fa5d10599bbb7551d44617d7ebf51e19bc78a69cb49c552a8e90ea3a2617481a09b0350e400eb9a4bb2a8a640c2a6e71cda8c -DIST quinn-congestions-2bdc356f57a7fc3ae1a49ab963a221f42d61012f.gh.tar.gz 25563 BLAKE2B fbe2073e192f0aad54e3b815a832e5bba5f1e00ec5011bcf78958b94be4f5a601219cd76ad48c7beb6f1cca99bce22d948a9ea44aaceeaf3564be95d9b6e27dc SHA512 fddf3983e4641d8c2438d8016ccb46ad2891ab8cbc9e4858274fb6bd1189c669b1703e95ee21bcd1cbe2b4a9719f4326243ec54b7c1918891f3c18174c24ded9 +DIST quinn-762128e9e8017e8ffde51dc207edfc8cff7f59db.gh.tar.gz 869187 BLAKE2B 9338589747fbb78d3c37396bf2c1bb8346489677a4387df551232d6b39371059d100d81890a3871bbb1e1a532589c577d5030dfa95422c9b65a0537315183e59 SHA512 df40accc34afed742f4a0d5676242ebba1d1d2b3822bbc3e6858dfd32e330158ed9c2cc887ea41a3d2cfd25129181c01f171600100d8aaaa4c1f79140f2e864c +DIST quinn-congestions-83052f7da6f59d70792f9abb7b62b171cdc0d443.gh.tar.gz 19442 BLAKE2B bc33a2ab6dd926e42bc986931df831ad025abe40e6f67cbe49f433c4f58b05c2b04d9ef902051ff97e019d4b0dffadc83b9e64421e6d1c10b8d8ddb57e6fa932 SHA512 c8da42c41b017e469181c909c71e07973c58a931807ca0fa5ebdcc544a05042c60bd377de35048146402d1e20f94b155423a4ecf0091c1acf1cf89b576347dd5 DIST rustls-63d10d50f2308478f366f14f9f81e378f5911e3c.gh.tar.gz 3935853 BLAKE2B 9351d96900baf8d9dd850f766e97b09c409b8bc8bcfb0677d6eeccf5987b1cbaa50dcd844cfdd040411a5485a1f872fbb21729092dc88a10786057dd93645fac SHA512 6cd0ca4ad2c090d675a85c47ce4a4263ab30be864736b632129408adc0f40afed1f283a6941d43cddcbdd2a6315007ff7b0a120fae79a7e666729ddd65c17d61 -DIST rustls-acme-a55cbfde0f36d68d6c0ce33a5cbef45bd84036d8.gh.tar.gz 29712 BLAKE2B c86f5f3f747731ec063cd0bbdd78cae742fe1e9d1d34845fc5375b46401a74caf9effbca40621b550c08bdc085cf5c440d92e4bb5f0e709e79ba75c57c2a10b7 SHA512 1a866768f6d98ae2be0beefb95daff9ca245b99bc031e2f2574507aea8671a3a2e1af819f942c418b607f30e8432eb9062828f5db27872f220fef9cfb00e242a -DIST shadowsocks-rust-c4d8d18527289d12470cad1ce718754c908a75fe.gh.tar.gz 547867 BLAKE2B 45679a225be96662cc17e56987ef47ad58054b6b422e5482f460050edd9022d1980580e70fe8800da9f547b88fddb1446718aa67a6f378a9ba97a7eb24123fdd SHA512 2f90af8262a0e0c967a7f37e268e08d53cb0ff8c7a95d7daf192238070153f7c248a12551ec55c2ad6a7860f0b6b0424bdf61c3fe57d6612b9bbfea22e71777b DIST sock2proc-9f9e6304d62285115b2e4fa632527ae563bf0fcc.gh.tar.gz 14954 BLAKE2B 0ef28d67836e72e5223ecc2aa9744d7b0c005956b3973e3f2a5bc7572e6e8994788657cfb6d46e49ce9c7e7635bd908230e545e7ac11040877c635f6cd3fb0aa SHA512 0997981735df279b0ef7f5e00f9bd8ed2af8f47c69a2818b18c4d21243d60e3c38138855da3350d10db3ebfead32ba7b37212db8bfaa78a25059d8dcc1694e6e +DIST tailscale-rs-9f7cec0447df4214fe7bd34a8fb8674c2f639978.gh.tar.gz 3391391 BLAKE2B c9d2914cf8c5c410e852ba52d724a004d352756b034d0f83fc97091bcdc07967dc8e72c778a326ed3a41cb4b65264c21997c4ccb318760a5658715d63729359c SHA512 1b242db2597022f5fd5e14f718255e9124eec275b2dbc9228d1326961da49735ec65796bd4ca53a8933f8159751c344770ce6dec85bbfa4642f956d9524f0d7c DIST tokio-rustls-b26e3e2b7a0161d505fd12d6e545b16463f1a45f.gh.tar.gz 36868 BLAKE2B 7b0ea27a48b67f3b854c75170b232539848dc02955ea8711396d8f567329ad0ddaee51357ea5ca8b34399c2562355715ddf0152638da5dbcf60b703052009fdf SHA512 7ca48b81cb8f2adac57a554e879f6223b5f4b8747c3844c5ba86c06887a8a8eaf2f4ea5524f411316d4d449abcc784b1f46cf26296e31b2a54900c1ccf319e23 -DIST tuic-e4ae97bca5d5386ae964f09631e72c3bd392ca6b.gh.tar.gz 177255 BLAKE2B 3c6df19afc4cab618049e428d9635560010f776688de493f17af67ce987c67d376b617adfa46d48a069486accd9fe84c3f5856ce25c2409b88dbc3ea56d48079 SHA512 36abad198e6f8c3c19e303ed6430949ec840071e93b80c8edb1012a8bc82554c4beacccf6b35819ccd231c6a77807e7814d769466c55c8a5dd5939889445ebe4 DIST unix-udp-sock-847c80b519f0fd8cff5c887ae708429897d08671.gh.tar.gz 15660 BLAKE2B 3ec5d7988006aebc971b3e567abda5e53ddbd389abd3257b92c3b4b21666d96a5bc2c7d1cf874af61b06682df93a53c0c835ed5855b7174c0d132b183edf27b1 SHA512 7e64172a3749baaf06794c6757590f88dc035ec4b3c4c43f3b667b90d32bc245ffe0a7d5ca8c51d4994ed3a27ce6c30de940f243aad017655b3373ddac6450fa +DIST wind-3ab2388761a32337e9f810348869ce68bfcc3067.gh.tar.gz 487439 BLAKE2B 7d1a984891d0a216d1c78c544b71acd92e9587f3e221d10b46b4cc247f3f12da40300b24c12fd7f9e5747ba9e7652463dabc2cba178e56801dc826d7e353a6b2 SHA512 79ac624ee531b321a0bfaaeee66e717a2d4428163ae9a651790042c8f9204b91c6e4a5a9b8c2816b92c6b884c824287f2cf29d0f45902e583bd2eda0b0053bc7 diff --git a/net-proxy/clash-rs/clash-rs-0.10.10.ebuild b/net-proxy/clash-rs/clash-rs-0.10.10.ebuild deleted file mode 100644 index 218ec51c73..0000000000 --- a/net-proxy/clash-rs/clash-rs-0.10.10.ebuild +++ /dev/null @@ -1,120 +0,0 @@ -# Copyright 2025-2026 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -# Autogenerated by pycargoebuild 0.13.4 - -EAPI=8 - -CRATES=" -" - -declare -A GIT_CRATES=( - [boring-noise]='https://github.com/Watfaq/boring-noise;9ddf1b54d0c9679e7bc50e9151f72d526190db1a;boring-noise-%commit%' - [console-api]='https://github.com/tokio-rs/console;b59758e5a6effe3a9df3ec84a2f28d319d178234;console-%commit%/console-api' - [console-subscriber]='https://github.com/tokio-rs/console;b59758e5a6effe3a9df3ec84a2f28d319d178234;console-%commit%/console-subscriber' - [dhcproto-macros]='https://github.com/bluecatengineering/dhcproto;eece41c9a13b0e4912fb9a8f08401ab01b4123d4;dhcproto-%commit%/dhcproto-macros' - [dhcproto]='https://github.com/bluecatengineering/dhcproto;eece41c9a13b0e4912fb9a8f08401ab01b4123d4;dhcproto-%commit%' - [netstack-lwip]='https://github.com/eycorsican/netstack-lwip;f434fefd6c227c9dfbec84c364452ba6c1532779;netstack-lwip-%commit%' - [quinn-congestions]='https://github.com/proxy-rs/quinn-congestions;2bdc356f57a7fc3ae1a49ab963a221f42d61012f;quinn-congestions-%commit%' - [quinn-proto]='https://github.com/Tipuch/quinn;ce60e5b5c115db2a6053f4e0ca7fc52103cb76b9;quinn-%commit%/quinn-proto' - [quinn-udp]='https://github.com/Tipuch/quinn;ce60e5b5c115db2a6053f4e0ca7fc52103cb76b9;quinn-%commit%/quinn-udp' - [quinn]='https://github.com/Tipuch/quinn;ce60e5b5c115db2a6053f4e0ca7fc52103cb76b9;quinn-%commit%/quinn' - [rustls-acme]='https://github.com/rust-proxy/rustls-acme;a55cbfde0f36d68d6c0ce33a5cbef45bd84036d8;rustls-acme-%commit%' - [rustls]='https://github.com/Watfaq/rustls;63d10d50f2308478f366f14f9f81e378f5911e3c;rustls-%commit%/rustls' - [shadowsocks]='https://github.com/shadowsocks/shadowsocks-rust;c4d8d18527289d12470cad1ce718754c908a75fe;shadowsocks-rust-%commit%/crates/shadowsocks' - [sock2proc]='https://github.com/Watfaq/sock2proc;9f9e6304d62285115b2e4fa632527ae563bf0fcc;sock2proc-%commit%' - [tokio-rustls]='https://github.com/Watfaq/tokio-rustls;b26e3e2b7a0161d505fd12d6e545b16463f1a45f;tokio-rustls-%commit%' - [tuic-core]='https://github.com/Itsusinn/tuic;e4ae97bca5d5386ae964f09631e72c3bd392ca6b;tuic-%commit%/tuic-core' - [tuic-server]='https://github.com/Itsusinn/tuic;e4ae97bca5d5386ae964f09631e72c3bd392ca6b;tuic-%commit%/tuic-server' - [unix-udp-sock]='https://github.com/Watfaq/unix-udp-sock;847c80b519f0fd8cff5c887ae708429897d08671;unix-udp-sock-%commit%' -) - -RUST_MIN_VER="1.95.0" - -inherit cargo systemd - -DESCRIPTION="Custom protocol, rule based network proxy" -HOMEPAGE=" - https://watfaq.gitbook.io/clashrs-user-manual/ - https://github.com/Watfaq-legacy/clash-rs/ -" -SRC_URI=" - https://github.com/Watfaq-legacy/clash-rs/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz - https://github.com/gentoo-zh-drafts/${PN}/releases/download/v${PV}/${P}-crates.tar.xz - ${CARGO_CRATE_URIS} -" - -# Dependent crate licenses -LICENSE="Apache-2.0" -# Dependent crate licenses -LICENSE+=" - 0BSD Apache-2.0 BSD-2 BSD CC0-1.0 CDLA-Permissive-2.0 GPL-3+ ISC MIT - MPL-2.0 Unicode-3.0 Unlicense ZLIB -" -SLOT="0" -KEYWORDS="~amd64 ~arm64" - -IUSE="+lto +standard plus perf bench" -REQUIRED_USE=" - debug? ( !lto ) -" - -BDEPEND=" - llvm-core/clang - dev-libs/protobuf -" - -PATCHES=( - "${FILESDIR}/${PN}-0.10.2-remove-default-dashboard.patch" -) - -gen_git_crate_dir() { - # https://github.com/gentoo/gentoo/blob/b09dd88412fe2d5eee5a8891e08bfa2d67848da3/eclass/cargo.eclass#L442 - IFS=';' read -r crate_uri commit crate_dir <<<"${GIT_CRATES[$1]}" - echo "${WORKDIR}/${crate_dir//%commit%/${commit}}" -} - -src_prepare() { - default - # Remove the [patch.crates-io] section and add path-based patches - sed -i '/^\[patch\.crates-io\]/,/^$/d' "${S}/Cargo.toml" || die - - # Add new patch section with local paths - cat >> "${S}/Cargo.toml" <<-EOF || die - [patch.crates-io] - rustls = { path = "$(gen_git_crate_dir rustls)" } - tokio-rustls = { path = "$(gen_git_crate_dir tokio-rustls)" } - EOF -} - -src_configure() { - local myfeatures=( - $(usev standard) - $(usev plus) - $(usev perf) - $(usev bench) - ) - cargo_src_configure -} - -src_compile() { - if use !debug; then - # let portage do the strip - export CARGO_PROFILE_RELEASE_STRIP=false - if use !lto; then - export CARGO_PROFILE_RELEASE_LTO=false - fi - fi - - # enable unstable features - export RUSTC_BOOTSTRAP=1 - cargo_src_compile --package=clash-rs --bin=clash-rs -} - -src_install() { - dobin "$(cargo_target_dir)"/clash-rs - insinto "/etc/clash-rs" - doins "${FILESDIR}/config.example.yaml" - newinitd "${FILESDIR}/${PN}.initd" "${PN}" - systemd_dounit "${FILESDIR}/clash-rs.service" -} diff --git a/net-proxy/clash-rs/clash-rs-0.10.12.ebuild b/net-proxy/clash-rs/clash-rs-0.10.12.ebuild new file mode 100644 index 0000000000..b48fa94897 --- /dev/null +++ b/net-proxy/clash-rs/clash-rs-0.10.12.ebuild @@ -0,0 +1,154 @@ +# Copyright 2025-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# Autogenerated by pycargoebuild 0.13.4 + +EAPI=8 + +CRATES=" +" + +declare -A GIT_CRATES=( + [boring-noise]='https://github.com/Watfaq/boring-noise;9ddf1b54d0c9679e7bc50e9151f72d526190db1a;boring-noise-%commit%' + [console-api]='https://github.com/tokio-rs/console;b59758e5a6effe3a9df3ec84a2f28d319d178234;console-%commit%/console-api' + [console-subscriber]='https://github.com/tokio-rs/console;b59758e5a6effe3a9df3ec84a2f28d319d178234;console-%commit%/console-subscriber' + [dhcproto-macros]='https://github.com/bluecatengineering/dhcproto;eece41c9a13b0e4912fb9a8f08401ab01b4123d4;dhcproto-%commit%/dhcproto-macros' + [dhcproto]='https://github.com/bluecatengineering/dhcproto;eece41c9a13b0e4912fb9a8f08401ab01b4123d4;dhcproto-%commit%' + [netstack-lwip]='https://github.com/eycorsican/netstack-lwip;f434fefd6c227c9dfbec84c364452ba6c1532779;netstack-lwip-%commit%' + [quinn-congestions]='https://github.com/proxy-rs/quinn-congestions;83052f7da6f59d70792f9abb7b62b171cdc0d443;quinn-congestions-%commit%' + [quinn-proto]='https://github.com/Tipuch/quinn;762128e9e8017e8ffde51dc207edfc8cff7f59db;quinn-%commit%/quinn-proto' + [quinn-udp]='https://github.com/Tipuch/quinn;762128e9e8017e8ffde51dc207edfc8cff7f59db;quinn-%commit%/quinn-udp' + [quinn]='https://github.com/Tipuch/quinn;762128e9e8017e8ffde51dc207edfc8cff7f59db;quinn-%commit%/quinn' + [rustls]='https://github.com/Watfaq/rustls;63d10d50f2308478f366f14f9f81e378f5911e3c;rustls-%commit%/rustls' + [sock2proc]='https://github.com/Watfaq/sock2proc;9f9e6304d62285115b2e4fa632527ae563bf0fcc;sock2proc-%commit%' + [tailscale]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%' + [tokio-rustls]='https://github.com/Watfaq/tokio-rustls;b26e3e2b7a0161d505fd12d6e545b16463f1a45f;tokio-rustls-%commit%' + [ts_array256]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/data_structures/ts_array256' + [ts_bart]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/data_structures/ts_bart' + [ts_bart_packetfilter]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/net/overlay/ts_bart_packetfilter' + [ts_bitset]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/data_structures/ts_bitset' + [ts_capabilityversion]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/capabilities/ts_capabilityversion' + [ts_control]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/control_plane/ts_control' + [ts_control_noise]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/control_plane/ts_control_noise' + [ts_control_serde]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/control_plane/ts_control_serde' + [ts_dataplane]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/net/ts_dataplane' + [ts_derp]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/net/underlay/ts_derp' + [ts_disco_protocol]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/net/protocol/ts_disco_protocol' + [ts_dynbitset]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/data_structures/ts_dynbitset' + [ts_http_util]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/utils/ts_http_util' + [ts_keys]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/utils/ts_keys' + [ts_netcheck]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/net/underlay/ts_netcheck' + [ts_netmon]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/net/underlay/ts_netmon' + [ts_netstack_smoltcp]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/net/overlay/ts_netstack_smoltcp' + [ts_nodecapability]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/capabilities/ts_nodecapability' + [ts_noise]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/net/protocol/ts_noise' + [ts_packet]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/utils/ts_packet' + [ts_packetfilter]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/net/overlay/ts_packetfilter' + [ts_packetfilter_serde]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/net/overlay/ts_packetfilter_serde' + [ts_packetfilter_state]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/net/overlay/ts_packetfilter_state' + [ts_peercapability]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/capabilities/ts_peercapability' + [ts_runtime]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/ts_runtime' + [ts_time]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/utils/ts_time' + [ts_tls_util]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/utils/ts_tls_util' + [ts_transport]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/net/ts_transport' + [ts_tunnel]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/net/protocol/ts_tunnel' + [ts_util]='https://github.com/tailscale/tailscale-rs;9f7cec0447df4214fe7bd34a8fb8674c2f639978;tailscale-rs-%commit%/crates/utils/ts_util' + [unix-udp-sock]='https://github.com/Watfaq/unix-udp-sock;847c80b519f0fd8cff5c887ae708429897d08671;unix-udp-sock-%commit%' + [wind-base]='https://github.com/rust-proxy/wind;3ab2388761a32337e9f810348869ce68bfcc3067;wind-%commit%/crates/wind-base' + [wind-core]='https://github.com/rust-proxy/wind;3ab2388761a32337e9f810348869ce68bfcc3067;wind-%commit%/crates/wind-core' + [wind-quic]='https://github.com/rust-proxy/wind;3ab2388761a32337e9f810348869ce68bfcc3067;wind-%commit%/crates/wind-quic' + [wind-rule]='https://github.com/rust-proxy/wind;3ab2388761a32337e9f810348869ce68bfcc3067;wind-%commit%/crates/wind-rule' + [wind-tuic]='https://github.com/rust-proxy/wind;3ab2388761a32337e9f810348869ce68bfcc3067;wind-%commit%/crates/wind-tuic' +) + +RUST_MIN_VER="1.95.0" + +inherit cargo systemd + +DESCRIPTION="Custom protocol, rule based network proxy" +HOMEPAGE=" + https://watfaq.gitbook.io/clashrs-user-manual/ + https://github.com/Watfaq-legacy/clash-rs/ +" +SRC_URI=" + https://github.com/Watfaq-legacy/clash-rs/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz + https://github.com/gentoo-zh-drafts/${PN}/releases/download/v${PV}/${P}-crates.tar.xz + ${CARGO_CRATE_URIS} +" + +# Dependent crate licenses +LICENSE="Apache-2.0" +# Dependent crate licenses +LICENSE+=" + 0BSD Apache-2.0 BSD-2 BSD CC0-1.0 CDLA-Permissive-2.0 ISC MIT + MPL-2.0 Unicode-3.0 Unlicense ZLIB +" +SLOT="0" +KEYWORDS="~amd64 ~arm64" + +IUSE="+lto +standard plus perf bench" +REQUIRED_USE=" + debug? ( !lto ) +" + +BDEPEND=" + llvm-core/clang + dev-libs/protobuf +" + +PATCHES=( + "${FILESDIR}/${PN}-0.10.2-remove-default-dashboard.patch" +) + +gen_git_crate_dir() { + # https://github.com/gentoo/gentoo/blob/b09dd88412fe2d5eee5a8891e08bfa2d67848da3/eclass/cargo.eclass#L442 + IFS=';' read -r crate_uri commit crate_dir <<<"${GIT_CRATES[$1]}" + echo "${WORKDIR}/${crate_dir//%commit%/${commit}}" +} + +src_prepare() { + default + # Remove the [patch.crates-io] section and add path-based patches + sed -i '/^\[patch\.crates-io\]/,/^$/d' "${S}/Cargo.toml" || die + + # Add new patch section with local paths + cat >> "${S}/Cargo.toml" <<-EOF || die + [patch.crates-io] + rustls = { path = "$(gen_git_crate_dir rustls)" } + tokio-rustls = { path = "$(gen_git_crate_dir tokio-rustls)" } + tailscale = { path = "$(gen_git_crate_dir tailscale)" } + ts_netmon = { path = "$(gen_git_crate_dir ts_netmon)" } + EOF +} + +src_configure() { + local myfeatures=( + $(usev standard) + $(usev plus) + $(usev perf) + $(usev bench) + ) + cargo_src_configure +} + +src_compile() { + if use !debug; then + # let portage do the strip + export CARGO_PROFILE_RELEASE_STRIP=false + if use !lto; then + export CARGO_PROFILE_RELEASE_LTO=false + fi + fi + + # enable unstable features + export RUSTC_BOOTSTRAP=1 + cargo_src_compile --package=clash-rs --bin=clash-rs +} + +src_install() { + dobin "$(cargo_target_dir)"/clash-rs + insinto "/etc/clash-rs" + doins "${FILESDIR}/config.example.yaml" + newinitd "${FILESDIR}/${PN}.initd" "${PN}" + systemd_dounit "${FILESDIR}/clash-rs.service" +}