Github messages for voidlinux
 help / color / mirror / Atom feed
From: ziggylee0 <ziggylee0@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] New package: xray-1.8.11
Date: Sun, 05 May 2024 08:41:43 +0200	[thread overview]
Message-ID: <20240505064143.9668223E12@inbox.vuxu.org> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-50185@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 775 bytes --]

There is an updated pull request by ziggylee0 against master on the void-packages repository

https://github.com/ziggylee0/void-packages master
https://github.com/void-linux/void-packages/pull/50185

New package: xray-1.8.11


#### Testing the changes
- I tested the changes in this PR: **YES**


#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**



#### Local build testing
- I built this PR locally for my native architecture, (x86_64-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - i686




A patch file from https://github.com/void-linux/void-packages/pull/50185.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-50185.patch --]
[-- Type: text/x-diff, Size: 7939 bytes --]

From f3f76bfee7019f17e94ba51941c7cb36892f70a1 Mon Sep 17 00:00:00 2001
From: ziggylee0 <zgglee@proton.me>
Date: Sat, 4 May 2024 09:53:36 +0800
Subject: [PATCH 1/3] 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 <zgglee@proton.me>"
+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 51b99132dfe0854bde00216321c6749f4c90d12f Mon Sep 17 00:00:00 2001
From: ziggylee0 <zgglee@proton.me>
Date: Sun, 5 May 2024 09:45:50 +0800
Subject: [PATCH 2/3] 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 <zgglee@proton.me>"
 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 4e4fb0633e9f577e0acbc9c6705c2e1e0c1e8dd6 Mon Sep 17 00:00:00 2001
From: ziggylee0 <zgglee@proton.me>
Date: Sun, 5 May 2024 14:40:12 +0800
Subject: [PATCH 3/3] 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
-# }

  parent reply	other threads:[~2024-05-05  6:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-04  2:04 [PR PATCH] " ziggylee0
2024-05-04 12:53 ` [PR PATCH] [Updated] " ziggylee0
2024-05-05  1:51 ` ziggylee0
2024-05-05  6:41 ` ziggylee0 [this message]
2024-05-05 13:35 ` ziggylee0
2024-05-05 13:40 ` ziggylee0
2024-05-17 12:46 ` ziggylee0

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240505064143.9668223E12@inbox.vuxu.org \
    --to=ziggylee0@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).