Skip to content

Commit

Permalink
warp-plus: update and fix bugs
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Pashmfouroush <[email protected]>
  • Loading branch information
markpash committed Jun 3, 2024
1 parent abcf26c commit 2c90c5b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/libs/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.22.2
replace github.com/eycorsican/go-tun2socks => github.com/trojan-gfw/go-tun2socks v1.16.3-0.20210702214000-083d49176e05

require (
github.com/bepass-org/warp-plus v1.2.3
github.com/bepass-org/warp-plus v1.2.4-0.20240603141320-b3f8c9953e10
github.com/eycorsican/go-tun2socks v1.16.11
github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8
github.com/xjasonlyu/tun2socks/v2 v2.5.2
Expand Down
4 changes: 4 additions & 0 deletions app/libs/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ github.com/armon/go-proxyproto v0.0.0-20180202201750-5b7edb60ff5f h1:SaJ6yqg936T
github.com/armon/go-proxyproto v0.0.0-20180202201750-5b7edb60ff5f/go.mod h1:QmP9hvJ91BbJmGVGSbutW19IC0Q9phDCLGaomwTJbgU=
github.com/bepass-org/warp-plus v1.2.3 h1:Ql9I74k3IgzQ+UEI0Za17O0o0+7vpmlTn0Uz90DIXIw=
github.com/bepass-org/warp-plus v1.2.3/go.mod h1:uSRUbr1CcvFrEV69FTvuJFwpzEmwO8N4knb6+Zq3Ys4=
github.com/bepass-org/warp-plus v1.2.4-0.20240603140428-115bbf414559 h1:2BzuNBkcvxj2J+XAw0eI3lJ/rfzjIcBhx34Q8GITAog=
github.com/bepass-org/warp-plus v1.2.4-0.20240603140428-115bbf414559/go.mod h1:uSRUbr1CcvFrEV69FTvuJFwpzEmwO8N4knb6+Zq3Ys4=
github.com/bepass-org/warp-plus v1.2.4-0.20240603141320-b3f8c9953e10 h1:5SGhg+n2ACNFh6xzSfEs8BR9qVW9ApSlQCpFuhWCyws=
github.com/bepass-org/warp-plus v1.2.4-0.20240603141320-b3f8c9953e10/go.mod h1:uSRUbr1CcvFrEV69FTvuJFwpzEmwO8N4knb6+Zq3Ys4=
github.com/bifurcation/mint v0.0.0-20180306135233-198357931e61 h1:BU+NxuoaYPIvvp8NNkNlLr8aA0utGyuunf4Q3LJ0bh0=
github.com/bifurcation/mint v0.0.0-20180306135233-198357931e61/go.mod h1:zVt7zX3K/aDCk9Tj+VM7YymsX66ERvzCJzw8rFCX2JU=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
Expand Down
2 changes: 2 additions & 0 deletions app/libs/tun2socks.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type StartOptions struct {
Country string
PsiphonEnabled bool
Gool bool
DNS string
}

var global StartOptions
Expand Down Expand Up @@ -115,6 +116,7 @@ func Start(opt *StartOptions) {

err := app.RunWarp(ctx, l, app.WarpOptions{
Bind: netip.MustParseAddrPort(global.BindAddress),
DnsAddr: netip.MustParseAddr(opt.DNS),
Endpoint: global.Endpoint,
License: global.License,
Psiphon: psiphonOpts,
Expand Down
45 changes: 23 additions & 22 deletions app/src/main/java/org/bepass/oblivion/OblivionVpnService.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,27 +180,27 @@ private static int findFreePort() {

public static boolean pingOverHTTP(String bindAddress) {
System.out.println("Pinging");
Map<String, Integer> result = splitHostAndPort(bindAddress);
if (result == null) {
throw new RuntimeException("Could not split host and port of " + bindAddress);
}
String socksHost = result.keySet().iterator().next();
int socksPort = result.values().iterator().next();
Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(socksHost, socksPort));
OkHttpClient client = new OkHttpClient.Builder()
.proxy(proxy)
.connectTimeout(5, TimeUnit.SECONDS) // 5 seconds connection timeout
.readTimeout(5, TimeUnit.SECONDS) // 5 seconds read timeout
.build();
Request request = new Request.Builder()
.url("https://1.1.1.1")
.build();
try (Response response = client.newCall(request).execute()) {
return response.isSuccessful();
} catch (IOException e) {
//e.printStackTrace();
return false;
}
Map<String, Integer> result = splitHostAndPort(bindAddress);
if (result == null) {
throw new RuntimeException("Could not split host and port of " + bindAddress);
}
String socksHost = result.keySet().iterator().next();
int socksPort = result.values().iterator().next();
Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(socksHost, socksPort));
OkHttpClient client = new OkHttpClient.Builder()
.proxy(proxy)
.connectTimeout(5, TimeUnit.SECONDS) // 5 seconds connection timeout
.readTimeout(5, TimeUnit.SECONDS) // 5 seconds read timeout
.build();
Request request = new Request.Builder()
.url("https://www.gstatic.com/generate_204")
.build();
try (Response response = client.newCall(request).execute()) {
return response.isSuccessful();
} catch (IOException e) {
//e.printStackTrace();
return false;
}
}


Expand Down Expand Up @@ -392,7 +392,7 @@ public void onRevoke() {
}
}

executorService.execute(Tun2socks::stop);
Tun2socks.stop();
}

private void publishConnectionState(ConnectionState state) {
Expand Down Expand Up @@ -515,6 +515,7 @@ private void configure() throws Exception {
so.setEndpoint(endpoint);
so.setBindAddress(bindAddress);
so.setLicense(license);
so.setDNS("1.1.1.1");

if (enablePsiphon && !enableGool) {
so.setPsiphonEnabled(true);
Expand Down

0 comments on commit 2c90c5b

Please sign in to comment.