From f3f76bfee7019f17e94ba51941c7cb36892f70a1 Mon Sep 17 00:00:00 2001 From: ziggylee0 Date: Sat, 4 May 2024 09:53:36 +0800 Subject: [PATCH 1/4] New package: xray-1.8.11 --- srcpkgs/xray/files/config.json | 18 +++++++++++ srcpkgs/xray/files/xray/run | 4 +++ srcpkgs/xray/patches/update-gvisor.diff | 43 +++++++++++++++++++++++++ srcpkgs/xray/template | 38 ++++++++++++++++++++++ 4 files changed, 103 insertions(+) create mode 100644 srcpkgs/xray/files/config.json create mode 100644 srcpkgs/xray/files/xray/run create mode 100644 srcpkgs/xray/patches/update-gvisor.diff create mode 100644 srcpkgs/xray/template diff --git a/srcpkgs/xray/files/config.json b/srcpkgs/xray/files/config.json new file mode 100644 index 00000000000000..30209ffaad8ed9 --- /dev/null +++ b/srcpkgs/xray/files/config.json @@ -0,0 +1,18 @@ +{ + "inbounds": [{ + "port": 9000, + "protocol": "vmess", + "settings": { + "clients": [ + { + "id": "1eb6e917-774b-4a84-aff6-b058577c60a5", + "level": 1 + } + ] + } + }], + "outbounds": [{ + "protocol": "freedom", + "settings": {} + }] +} diff --git a/srcpkgs/xray/files/xray/run b/srcpkgs/xray/files/xray/run new file mode 100644 index 00000000000000..1598e03bd2610f --- /dev/null +++ b/srcpkgs/xray/files/xray/run @@ -0,0 +1,4 @@ +#!/bin/sh +exec 2>&1 + +exec chpst -u _xray xray -c /etc/xray.json 2>&1 diff --git a/srcpkgs/xray/patches/update-gvisor.diff b/srcpkgs/xray/patches/update-gvisor.diff new file mode 100644 index 00000000000000..07277629aa712a --- /dev/null +++ b/srcpkgs/xray/patches/update-gvisor.diff @@ -0,0 +1,43 @@ +"gvisor.dev/gvisor v0.0.0-20231202080848-1f7806d17489" can only get from proxy.golang.org by archive now, it's not in git anymore. +so update it to fit any other proxy servers. + + +diff --git a/go.mod b/go.mod +index 91c1ef0..e55675d 100644 +--- a/go.mod ++++ b/go.mod +@@ -29,7 +29,7 @@ require ( + golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 + google.golang.org/grpc v1.63.2 + google.golang.org/protobuf v1.33.0 +- gvisor.dev/gvisor v0.0.0-20231202080848-1f7806d17489 ++ gvisor.dev/gvisor v0.0.0-20240430175013-479de5f2c545 + h12.io/socks v1.0.3 + lukechampine.com/blake3 v1.2.2 + ) +diff --git a/proxy/wireguard/gvisortun/tun.go b/proxy/wireguard/gvisortun/tun.go +index 9e9a0b2..65677c4 100644 +--- a/proxy/wireguard/gvisortun/tun.go ++++ b/proxy/wireguard/gvisortun/tun.go +@@ -157,7 +157,7 @@ func (tun *netTun) Write(buf [][]byte, offset int) (int, error) { + // WriteNotify implements channel.Notification + func (tun *netTun) WriteNotify() { + pkt := tun.ep.Read() +- if pkt.IsNil() { ++ if pkt == nil { + return + } + +diff --git a/proxy/wireguard/tun.go b/proxy/wireguard/tun.go +index c2d3032..dc9d212 100644 +--- a/proxy/wireguard/tun.go ++++ b/proxy/wireguard/tun.go +@@ -194,7 +194,7 @@ func createGVisorTun(localAddresses []netip.Addr, mtu int, handler promiscuousMo + Timeout: 15 * time.Second, + }) + +- handler(xnet.UDPDestination(xnet.IPAddress(id.LocalAddress.AsSlice()), xnet.Port(id.LocalPort)), gonet.NewUDPConn(stack, &wq, ep)) ++ handler(xnet.UDPDestination(xnet.IPAddress(id.LocalAddress.AsSlice()), xnet.Port(id.LocalPort)), gonet.NewUDPConn(&wq, ep)) + }(r) + }) + stack.SetTransportProtocolHandler(udp.ProtocolNumber, udpForwarder.HandlePacket) diff --git a/srcpkgs/xray/template b/srcpkgs/xray/template new file mode 100644 index 00000000000000..955533d9d0912a --- /dev/null +++ b/srcpkgs/xray/template @@ -0,0 +1,38 @@ +# Template file for 'xray' +pkgname=xray +version=1.8.11 +revision=1 +build_style=go +go_import_path=github.com/xtls/xray-core +go_package="${go_import_path}/main" +hostmakedepends="git" +short_desc="Network proxy tool" +maintainer="ziggylee0 " +license="MPL-2.0" +homepage="https://github.com/XTLS/Xray-core" +distfiles="https://github.com/XTLS/Xray-core/archive/refs/tags/v${version}.tar.gz + https://github.com/Loyalsoldier/v2ray-rules-dat/releases/202404302210/download/geosite.dat + https://github.com/Loyalsoldier/v2ray-rules-dat/releases/202404302210/download/geoip.dat" +checksum="d99ee6008c508abbad6bbb242d058b22efb50fb35867d15447a2b4602ab4b283 + bd819d0e223c431dc405a4141ebbc0828e12a81ff2a0c9289a76f6c4eafed2eb + 0352d736c7678bdaa2f8199fdea9f49d60f82fc9b28c58abd593a34f4df87f9e" +skip_extraction="geosite.dat geoip.dat" + +go_ldflags="-X github.com/xtls/xray-core/core.build=${version} -buildid=" +system_accounts="_xray" + +pre_build() { + go mod tidy +} + +post_install() { + vlicense LICENSE + vmkdir usr/share/xray + vcopy ${XBPS_SRCDISTDIR}/${pkgname}-${version}/*.dat usr/share/xray/ + vconf ${FILESDIR}/config.json xray.json + vsv xray +} + +do_install() { + vbin ${GOPATH}/bin/main xray +} From 3a253d4c760d164ea189b7fbdd6aeaa64ae9b30d Mon Sep 17 00:00:00 2001 From: Eloi Torrents Date: Mon, 18 Mar 2024 16:23:50 +0100 Subject: [PATCH 2/4] hydrus: update to 573, adopt. --- srcpkgs/hydrus/template | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/srcpkgs/hydrus/template b/srcpkgs/hydrus/template index 74f2ebc9dddcdd..761afb0983de76 100644 --- a/srcpkgs/hydrus/template +++ b/srcpkgs/hydrus/template @@ -1,6 +1,6 @@ # Template file for 'hydrus' pkgname=hydrus -version=544 +version=573 revision=1 pycompile_dirs="usr/lib/hydrus" hostmakedepends="python3" @@ -11,11 +11,12 @@ depends="python3 libopencv-python3 python3-BeautifulSoup4 python3-yaml miniupnpc desktop-file-utils python3-cloudscraper python3-openssl python3-packaging" short_desc="Danbooru-like image tagging and searching system for the desktop" -maintainer="fanyx " +maintainer="Eloi Torrents " license="WTFPL" homepage="https://hydrusnetwork.github.io/hydrus/" +changelog="https://raw.githubusercontent.com/hydrusnetwork/hydrus/master/docs/changelog.md" distfiles="https://github.com/hydrusnetwork/hydrus/archive/refs/tags/v${version}.tar.gz" -checksum=7fa642c6139aaac97abaaad96a64c5e481b701c90c503129368b211c87af091c +checksum=80738fcbb67941aaeeddf7e1fe7f0d8f4f28d2286341862a45f970dec8dde1c7 python_version="3" do_install() { @@ -24,6 +25,8 @@ do_install() { chmod +x hydrus_server.py hydrus_client.py vmkdir usr/lib/hydrus + rm -r static/build_files + rm -r static/requirements vcopy hydrus usr/lib/hydrus/ vcopy static usr/lib/hydrus/ From 633e3b10305c380b868dd4050502c4dc2917016b Mon Sep 17 00:00:00 2001 From: ziggylee0 Date: Sun, 5 May 2024 09:45:50 +0800 Subject: [PATCH 3/4] fix: correct geosite and geoip links --- srcpkgs/xray/template | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/srcpkgs/xray/template b/srcpkgs/xray/template index 955533d9d0912a..c2ff983c7b0044 100644 --- a/srcpkgs/xray/template +++ b/srcpkgs/xray/template @@ -11,8 +11,8 @@ maintainer="ziggylee0 " license="MPL-2.0" homepage="https://github.com/XTLS/Xray-core" distfiles="https://github.com/XTLS/Xray-core/archive/refs/tags/v${version}.tar.gz - https://github.com/Loyalsoldier/v2ray-rules-dat/releases/202404302210/download/geosite.dat - https://github.com/Loyalsoldier/v2ray-rules-dat/releases/202404302210/download/geoip.dat" + https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/202404302210/geosite.dat + https://github.com/Loyalsoldier/v2ray-rules-dat/releases/download/202404302210/geoip.dat" checksum="d99ee6008c508abbad6bbb242d058b22efb50fb35867d15447a2b4602ab4b283 bd819d0e223c431dc405a4141ebbc0828e12a81ff2a0c9289a76f6c4eafed2eb 0352d736c7678bdaa2f8199fdea9f49d60f82fc9b28c58abd593a34f4df87f9e" @@ -25,6 +25,10 @@ pre_build() { go mod tidy } +do_build() { + go build -o "${GOPATH}/bin/${pkgname}" -p "$XBPS_MAKEJOBS" -ldflags "${go_ldflags}" ${go_package} +} + post_install() { vlicense LICENSE vmkdir usr/share/xray @@ -33,6 +37,6 @@ post_install() { vsv xray } -do_install() { - vbin ${GOPATH}/bin/main xray -} +# do_install() { +# vbin ${GOPATH}/bin/main xray +# } From 433d32bddb627ba3572f2afccdcd8c1436fa9fd4 Mon Sep 17 00:00:00 2001 From: ziggylee0 Date: Sun, 5 May 2024 14:40:12 +0800 Subject: [PATCH 4/4] fix: rm useless code && add "conf_files" --- srcpkgs/xray/files/xray/run | 4 +--- srcpkgs/xray/template | 10 ++++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/srcpkgs/xray/files/xray/run b/srcpkgs/xray/files/xray/run index 1598e03bd2610f..832bc13ba6189e 100644 --- a/srcpkgs/xray/files/xray/run +++ b/srcpkgs/xray/files/xray/run @@ -1,4 +1,2 @@ #!/bin/sh -exec 2>&1 - -exec chpst -u _xray xray -c /etc/xray.json 2>&1 +exec chpst -u _xray xray -c /etc/xray/config.json 2>$1 diff --git a/srcpkgs/xray/template b/srcpkgs/xray/template index c2ff983c7b0044..ddd85bcd15d35c 100644 --- a/srcpkgs/xray/template +++ b/srcpkgs/xray/template @@ -19,6 +19,7 @@ checksum="d99ee6008c508abbad6bbb242d058b22efb50fb35867d15447a2b4602ab4b283 skip_extraction="geosite.dat geoip.dat" go_ldflags="-X github.com/xtls/xray-core/core.build=${version} -buildid=" +conf_files="/etc/xray/config.json" system_accounts="_xray" pre_build() { @@ -30,13 +31,10 @@ do_build() { } post_install() { - vlicense LICENSE vmkdir usr/share/xray + vmkdir etc/xray + vlicense LICENSE vcopy ${XBPS_SRCDISTDIR}/${pkgname}-${version}/*.dat usr/share/xray/ - vconf ${FILESDIR}/config.json xray.json + vcopy ${FILESDIR}/config.json etc/xray/ vsv xray } - -# do_install() { -# vbin ${GOPATH}/bin/main xray -# }