Skip to content

Commit

Permalink
upgpatch: v2ray
Browse files Browse the repository at this point in the history
Resolved `go test` error; however, due to the current incompatibility
of v2ray-core 5.7.0 with go version 1.21, the compilation is still failing.

This patch has been reported to the upstream as issue [v2ray/v2ray-core#2720](v2fly/v2ray-core#2720)
  • Loading branch information
Xunop authored and felixonmars committed Oct 27, 2023
1 parent a384a4a commit 18cb217
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 3 deletions.
20 changes: 17 additions & 3 deletions v2ray/riscv64.patch
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
--- PKGBUILD
+++ PKGBUILD
@@ -12,12 +12,17 @@ license=('MIT')
@@ -12,12 +12,31 @@ license=('MIT')
depends=('glibc' 'v2ray-domain-list-community' 'v2ray-geoip')
makedepends=('go' 'git')
backup=(etc/v2ray/config.json)
-source=("git+https://github.com/v2fly/v2ray-core.git#commit=$_commit")
-sha512sums=('SKIP')
+source=("git+https://github.com/v2fly/v2ray-core.git#commit=$_commit"
+ "$pkgname-InitializeServerConfig-sleep.patch::https://github.com/v2fly/v2ray-core/pull/1786.patch")
+ "$pkgname-InitializeServerConfig-sleep.patch::https://github.com/v2fly/v2ray-core/pull/1786.patch"
+ "v2ray-testTCPConn2-timeout.patch"
+ "v2ray-testVMessKCP.patch"
+ "v2ray-kcpTest.patch")
+
+sha512sums=('SKIP'
+ '36553288b92bbf7d1ae65cc9efec95f1ca695f73e17804a72270e96382c685dea1dcae69ecfd9603bf7af0cf730080ac59c61c4b91cb724191e985032d5a5a03')
+ '36553288b92bbf7d1ae65cc9efec95f1ca695f73e17804a72270e96382c685dea1dcae69ecfd9603bf7af0cf730080ac59c61c4b91cb724191e985032d5a5a03'
+ 'd681916026c2a224097c715cf21bfa53b0d61f496de828a38c94170d1a115081917e42cf3848f94ca76bdd5491be97c56f84cb6996584f204561f8f10796ce78'
+ '247d22813eddccca5585efa0be3f6b3a4b00e5ca31f0ace3f8ad71015b688a4b41b7b65d639ca1632bb788849ff3e7c26cf6469fa39ffd0e728f23244d2714d6'
+ '1949b4082a7a710619b8d46c50b19f002f9dc68a77d1ccde368a7e8bac872292f14fb60d34088776fdfeef5eea800ca68a0f86e0a0454f096c1df9e73f67b76c')

prepare() {
cd v2ray-core
sed -i 's|/usr/local/bin|/usr/bin|;s|/usr/local/etc|/etc|' release/config/systemd/system/*.service
+
+ # wait enough time for v2ray to start
+ patch -Np1 -i $srcdir/$pkgname-InitializeServerConfig-sleep.patch
+
+ # reported to upstream as https://github.com/v2fly/v2ray-core/issues/1830
+ patch -Np1 -i $srcdir/v2ray-testTCPConn2-timeout.patch
+
+ # reported to upstream as https://github.com/v2fly/v2ray-core/issues/2720
+ patch -Np1 -i $srcdir/v2ray-testVMessKCP.patch
+ patch -Np1 -i $srcdir/v2ray-kcpTest.patch
}

build() {
13 changes: 13 additions & 0 deletions v2ray/v2ray-kcpTest.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/transport/internet/kcp/kcp_test.go b/transport/internet/kcp/kcp_test.go
index d10534a2..43ea9db3 100644
--- a/transport/internet/kcp/kcp_test.go
+++ b/transport/internet/kcp/kcp_test.go
@@ -77,7 +77,7 @@ func TestDialAndListen(t *testing.T) {
}

for i := 0; i < 60 && listener.ActiveConnections() > 0; i++ {
- time.Sleep(500 * time.Millisecond)
+ time.Sleep(1000 * time.Millisecond)
}
if v := listener.ActiveConnections(); v != 0 {
t.Error("active connections: ", v)
13 changes: 13 additions & 0 deletions v2ray/v2ray-testTCPConn2-timeout.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/testing/scenarios/common.go b/testing/scenarios/common.go
index ffa00006..c15a34a1 100644
--- a/testing/scenarios/common.go
+++ b/testing/scenarios/common.go
@@ -201,6 +201,8 @@ func testUDPConn(port net.Port, payloadSize int, timeout time.Duration) func() e
}

func testTCPConn2(conn net.Conn, payloadSize int, timeout time.Duration) func() error {
+ timeout *= 20
+
return func() (err1 error) {
start := time.Now()
defer func() {
12 changes: 12 additions & 0 deletions v2ray/v2ray-testVMessKCP.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/testing/scenarios/vmess_test.go b/testing/scenarios/vmess_test.go
index e1acd455..7dfc8466 100644
--- a/testing/scenarios/vmess_test.go
+++ b/testing/scenarios/vmess_test.go
@@ -806,6 +806,7 @@ func TestVMessKCP(t *testing.T) {

var errg errgroup.Group
for i := 0; i < 10; i++ {
+ time.Sleep(time.Second * 8)
errg.Go(testTCPConn(clientPort, 10240*1024, time.Minute*2))
}
if err := errg.Wait(); err != nil {

0 comments on commit 18cb217

Please sign in to comment.