nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1From b1bc81051810899189b071349443d82fdc1caebe Mon Sep 17 00:00:00 2001
2From: NImaism <nima.gholamyy@gmail.com>
3Date: Sat, 16 Aug 2025 22:20:15 +0330
4Subject: [PATCH] fix: warp endpoints issues
5
6---
7 app/app.go | 18 ++++++++++++++----
8 cmd/warp-plus/rootcmd.go | 10 ----------
9 2 files changed, 14 insertions(+), 14 deletions(-)
10
11diff --git a/app/app.go b/app/app.go
12index 770c58b536e11be3ebdb098c54cf74228139cb51..0197655d681539ed1dd1915ed65107cb7c007b17 100644
13--- a/app/app.go
14+++ b/app/app.go
15@@ -56,6 +56,16 @@ func RunWarp(ctx context.Context, l *slog.Logger, opts WarpOptions) error {
16 return errors.New("must provide country for psiphon")
17 }
18
19+ if opts.Endpoint == "" {
20+ ident, err := warp.LoadOrCreateIdentity(l, path.Join(opts.CacheDir, "primary"), opts.License)
21+ if err != nil {
22+ l.Error("failed to load or create primary warp identity")
23+ return err
24+ }
25+
26+ opts.Endpoint = ident.Config.Peers[0].Endpoint.V4[:len(ident.Config.Peers[0].Endpoint.V4)-2] + ":500"
27+ }
28+
29 // Decide Working Scenario
30 endpoints := []string{opts.Endpoint, opts.Endpoint}
31
32@@ -96,7 +106,7 @@ func RunWarp(ctx context.Context, l *slog.Logger, opts WarpOptions) error {
33 case opts.Gool:
34 l.Info("running in warp-in-warp (gool) mode")
35 // run warp in warp
36- warpErr = runWarpInWarp(ctx, l, opts, endpoints)
37+ warpErr = runWarpInWarp(ctx, l, opts, endpoints[0])
38 default:
39 l.Info("running in normal warp mode")
40 // just run primary warp on bindAddress
41@@ -237,7 +247,7 @@ func runWarp(ctx context.Context, l *slog.Logger, opts WarpOptions, endpoint str
42 return nil
43 }
44
45-func runWarpInWarp(ctx context.Context, l *slog.Logger, opts WarpOptions, endpoints []string) error {
46+func runWarpInWarp(ctx context.Context, l *slog.Logger, opts WarpOptions, endpoint string) error {
47 // make primary identity
48 ident1, err := warp.LoadOrCreateIdentity(l, path.Join(opts.CacheDir, "primary"), opts.License)
49 if err != nil {
50@@ -254,7 +264,7 @@ func runWarpInWarp(ctx context.Context, l *slog.Logger, opts WarpOptions, endpoi
51
52 // Enable trick and keepalive on all peers in config
53 for i, peer := range conf.Peers {
54- peer.Endpoint = endpoints[0]
55+ peer.Endpoint = endpoint
56 peer.Trick = true
57 peer.KeepAlive = 5
58
59@@ -297,7 +307,7 @@ func runWarpInWarp(ctx context.Context, l *slog.Logger, opts WarpOptions, endpoi
60 }
61
62 // Create a UDP port forward between localhost and the remote endpoint
63- addr, err := wiresocks.NewVtunUDPForwarder(ctx, netip.MustParseAddrPort("127.0.0.1:0"), endpoints[0], tnet1, singleMTU)
64+ addr, err := wiresocks.NewVtunUDPForwarder(ctx, netip.MustParseAddrPort("127.0.0.1:0"), endpoint, tnet1, singleMTU)
65 if err != nil {
66 return err
67 }
68diff --git a/cmd/warp-plus/rootcmd.go b/cmd/warp-plus/rootcmd.go
69index 87642c3708d5084d89771808c0ff7e96f6da1014..87eec817a35390cae4b66ad51fd152fce55670f6 100644
70--- a/cmd/warp-plus/rootcmd.go
71+++ b/cmd/warp-plus/rootcmd.go
72@@ -13,7 +13,6 @@ import (
73 "github.com/adrg/xdg"
74 "github.com/bepass-org/warp-plus/app"
75 p "github.com/bepass-org/warp-plus/psiphon"
76- "github.com/bepass-org/warp-plus/warp"
77 "github.com/bepass-org/warp-plus/wiresocks"
78 "github.com/peterbourgon/ff/v4"
79 "github.com/peterbourgon/ff/v4/ffval"
80@@ -205,15 +204,6 @@ func (c *rootConfig) exec(ctx context.Context, args []string) error {
81 opts.Scan = &wiresocks.ScanOptions{V4: c.v4, V6: c.v6, MaxRTT: c.rtt}
82 }
83
84- // If the endpoint is not set, choose a random warp endpoint
85- if opts.Endpoint == "" {
86- addrPort, err := warp.RandomWarpEndpoint(c.v4, c.v6)
87- if err != nil {
88- fatal(l, err)
89- }
90- opts.Endpoint = addrPort.String()
91- }
92-
93 go func() {
94 if err := app.RunWarp(ctx, l, opts); err != nil {
95 fatal(l, err)