jointhis.proxy 0.3.0 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +94 -73
- package/dist/main.js +3 -0
- package/package.json +62 -59
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -7,34 +7,9 @@ import UI from './ui.js';
|
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import { Spawn } from 'ink-spawn';
|
|
9
9
|
import { exec } from 'node:child_process';
|
|
10
|
-
|
|
10
|
+
import { clear } from 'node:console';
|
|
11
|
+
export const version = `0.3.3`;
|
|
11
12
|
export var rtun;
|
|
12
|
-
// Get backend executable
|
|
13
|
-
if (process.platform == 'linux') {
|
|
14
|
-
fs.open('./rtun-linux-amd64', 'r', (err, fd) => {
|
|
15
|
-
if (err) {
|
|
16
|
-
exec('wget https://github.com/snsinfu/reverse-tunnel/releases/download/v1.3.2/rtun-linux-amd64').on('exit', function () {
|
|
17
|
-
exec('chmod +x ./rtun-linux-amd64');
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
rtun = './rtun-linux-amd64';
|
|
22
|
-
}
|
|
23
|
-
else if (process.platform == 'win32') {
|
|
24
|
-
fs.open('./rtun-windows-amd64.exe', 'r', (err, fd) => {
|
|
25
|
-
if (err) {
|
|
26
|
-
exec('curl.exe -L -O https://github.com/snsinfu/reverse-tunnel/releases/download/v1.3.2/rtun-windows-amd64.exe');
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
rtun = 'rtun-windows-amd64.exe';
|
|
30
|
-
}
|
|
31
|
-
else if (process.platform == 'darwin') {
|
|
32
|
-
console.log('Mac support is not yet implemented.');
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
console.error('Unsupported Operating System.');
|
|
37
|
-
}
|
|
38
13
|
const cli = meow(`
|
|
39
14
|
Usage
|
|
40
15
|
$ jointhis.proxy
|
|
@@ -71,57 +46,103 @@ const cli = meow(`
|
|
|
71
46
|
},
|
|
72
47
|
},
|
|
73
48
|
});
|
|
74
|
-
//
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
cli.flags.service ||
|
|
78
|
-
cli.flags.key ||
|
|
79
|
-
cli.flags.subdomain) {
|
|
80
|
-
if (!cli.flags.key) {
|
|
81
|
-
render(React.createElement(Error, { message: "Authentication token missing" }));
|
|
82
|
-
process.exit(1);
|
|
83
|
-
}
|
|
84
|
-
if ((!cli.flags.tcp || !cli.flags.udp) && !cli.flags.service) {
|
|
85
|
-
render(React.createElement(Error, { message: "No service or port given." }));
|
|
86
|
-
process.exit(1);
|
|
87
|
-
}
|
|
88
|
-
var tcp;
|
|
89
|
-
var udp;
|
|
90
|
-
if (cli.flags.service == 'mc') {
|
|
91
|
-
tcp = `25565`;
|
|
92
|
-
udp = `19132`;
|
|
93
|
-
}
|
|
94
|
-
else if (cli.flags.service == 'http') {
|
|
95
|
-
tcp = `80`;
|
|
96
|
-
udp = `80`;
|
|
97
|
-
}
|
|
98
|
-
else if (cli.flags.service == 'https') {
|
|
99
|
-
tcp = `443`;
|
|
100
|
-
udp = `443`;
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
tcp = cli.flags.tcp;
|
|
104
|
-
udp = cli.flags.udp;
|
|
105
|
-
}
|
|
106
|
-
const response = await fetch(`https://www.jointhis.party/api/cli/${cli.flags.key}/${tcp}/${udp}`);
|
|
107
|
-
if (!response.ok) {
|
|
108
|
-
console.error('Error fetching configuration file from remote server.', 'ERROR', response.status);
|
|
109
|
-
process.exit(1);
|
|
110
|
-
throw new Error(`${response.status}`);
|
|
111
|
-
}
|
|
112
|
-
const result = await response.json();
|
|
113
|
-
const config = result.config;
|
|
114
|
-
fs.writeFile('./rtun.yml', config, function (err) {
|
|
49
|
+
// Download backend
|
|
50
|
+
if (process.platform == 'linux') {
|
|
51
|
+
fs.open('./rtun-linux-amd64', 'r', (err, fd) => {
|
|
115
52
|
if (err) {
|
|
116
|
-
console.log('
|
|
117
|
-
|
|
53
|
+
console.log('Downloading binary, please wait...');
|
|
54
|
+
exec('wget https://github.com/snsinfu/reverse-tunnel/releases/download/v1.3.2/rtun-linux-amd64').on('exit', function () {
|
|
55
|
+
exec('chmod +x ./rtun-linux-amd64').on('exit', function () {
|
|
56
|
+
// downloaded
|
|
57
|
+
main();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
118
60
|
}
|
|
119
61
|
else {
|
|
120
|
-
|
|
62
|
+
// downloaded
|
|
63
|
+
main();
|
|
121
64
|
}
|
|
122
65
|
});
|
|
66
|
+
rtun = './rtun-linux-amd64';
|
|
67
|
+
}
|
|
68
|
+
else if (process.platform == 'win32') {
|
|
69
|
+
fs.open('./rtun-windows-amd64.exe', 'r', (err, fd) => {
|
|
70
|
+
if (err) {
|
|
71
|
+
console.log('Downloading binary, please wait...');
|
|
72
|
+
exec('curl.exe -L -O https://github.com/snsinfu/reverse-tunnel/releases/download/v1.3.2/rtun-windows-amd64.exe').on('exit', function () {
|
|
73
|
+
// downloaded
|
|
74
|
+
main();
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
// downloaded
|
|
79
|
+
main();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
rtun = 'rtun-windows-amd64.exe';
|
|
83
|
+
}
|
|
84
|
+
else if (process.platform == 'darwin') {
|
|
85
|
+
console.log('Mac support is not yet implemented.');
|
|
86
|
+
process.exit(1);
|
|
123
87
|
}
|
|
124
88
|
else {
|
|
125
|
-
|
|
126
|
-
|
|
89
|
+
console.error('Unsupported Operating System.');
|
|
90
|
+
}
|
|
91
|
+
// END download backend
|
|
92
|
+
async function main() {
|
|
93
|
+
clear();
|
|
94
|
+
// If any flags are given
|
|
95
|
+
if (cli.flags.udp ||
|
|
96
|
+
cli.flags.tcp ||
|
|
97
|
+
cli.flags.service ||
|
|
98
|
+
cli.flags.key ||
|
|
99
|
+
cli.flags.subdomain) {
|
|
100
|
+
if (!cli.flags.key) {
|
|
101
|
+
render(React.createElement(Error, { message: "Authentication token missing" }));
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
if ((!cli.flags.tcp || !cli.flags.udp) && !cli.flags.service) {
|
|
105
|
+
render(React.createElement(Error, { message: "No service or port given." }));
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
var tcp;
|
|
109
|
+
var udp;
|
|
110
|
+
if (cli.flags.service == 'mc') {
|
|
111
|
+
tcp = `25565`;
|
|
112
|
+
udp = `19132`;
|
|
113
|
+
}
|
|
114
|
+
else if (cli.flags.service == 'http') {
|
|
115
|
+
tcp = `80`;
|
|
116
|
+
udp = `80`;
|
|
117
|
+
}
|
|
118
|
+
else if (cli.flags.service == 'https') {
|
|
119
|
+
tcp = `443`;
|
|
120
|
+
udp = `443`;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
tcp = cli.flags.tcp;
|
|
124
|
+
udp = cli.flags.udp;
|
|
125
|
+
}
|
|
126
|
+
const response = await fetch(`https://www.jointhis.party/api/cli/${cli.flags.key}/${tcp}/${udp}`);
|
|
127
|
+
if (!response.ok) {
|
|
128
|
+
console.error('Error fetching configuration file from remote server.', 'ERROR', response.status);
|
|
129
|
+
process.exit(1);
|
|
130
|
+
throw new Error(`${response.status}`);
|
|
131
|
+
}
|
|
132
|
+
const result = await response.json();
|
|
133
|
+
const config = result.config;
|
|
134
|
+
fs.writeFile('./rtun.yml', config, function (err) {
|
|
135
|
+
if (err) {
|
|
136
|
+
console.log('Unable to write configuration file.');
|
|
137
|
+
process.exit(1);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
render(React.createElement(Spawn, { maxOutputLines: 4, runningText: "", command: rtun, args: ['-f ./rtun.yml'], shell: true }));
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
// Start automated guide-through
|
|
146
|
+
render(React.createElement(UI, null));
|
|
147
|
+
}
|
|
127
148
|
}
|
package/dist/main.js
CHANGED
|
@@ -47,6 +47,9 @@ export default function Main({ view }) {
|
|
|
47
47
|
: 'Please wait until everything is set up.')),
|
|
48
48
|
React.createElement(Step, { name: "last" },
|
|
49
49
|
React.createElement(Spawn, { maxOutputLines: 4, runningText: "", command: rtun, args: ['-f ./rtun.yml'], shell: true }),
|
|
50
|
+
service === '1' ? (React.createElement(React.Fragment, null,
|
|
51
|
+
React.createElement(Text, null, "Java IP: proxy.jointhis.party:[tcp remote port]"),
|
|
52
|
+
React.createElement(Text, null, "Bedrock IP: proxy.jointhis.party:[udp remote port]"))) : (React.createElement(Text, null, "Website: 82.38.134.1:[tcp remote port]")),
|
|
50
53
|
React.createElement(Box, { marginTop: 1 },
|
|
51
54
|
React.createElement(Text, { dimColor: true }, "Press enter to quit")))));
|
|
52
55
|
}
|
package/package.json
CHANGED
|
@@ -1,60 +1,63 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
2
|
+
"name": "jointhis.proxy",
|
|
3
|
+
"version": "0.3.3",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"bin": {
|
|
6
|
+
"jointhis.proxy": "dist/cli.js",
|
|
7
|
+
"jointhis-proxy": "dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=16"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"fs": "0.0.1-security",
|
|
18
|
+
"ink": "^6.8.0",
|
|
19
|
+
"ink-select-input": "^6.2.0",
|
|
20
|
+
"ink-spawn": "^0.1.4",
|
|
21
|
+
"ink-stepper": "^0.2.1",
|
|
22
|
+
"ink-text-input": "^6.0.0",
|
|
23
|
+
"meow": "^11.0.0",
|
|
24
|
+
"react": "^19.2.4"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@sindresorhus/tsconfig": "^3.0.1",
|
|
28
|
+
"@types/react": "^19.2.14",
|
|
29
|
+
"@vdemedes/prettier-config": "^2.0.1",
|
|
30
|
+
"ava": "^5.3.1",
|
|
31
|
+
"chalk": "^5.6.2",
|
|
32
|
+
"eslint-config-xo-react": "^0.27.0",
|
|
33
|
+
"eslint-plugin-react": "^7.37.5",
|
|
34
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
35
|
+
"ink-testing-library": "^3.0.0",
|
|
36
|
+
"prettier": "^2.8.8",
|
|
37
|
+
"ts-node": "^10.9.2",
|
|
38
|
+
"typescript": "^5.9.3",
|
|
39
|
+
"xo": "^0.53.1"
|
|
40
|
+
},
|
|
41
|
+
"ava": {
|
|
42
|
+
"extensions": {
|
|
43
|
+
"ts": "module",
|
|
44
|
+
"tsx": "module"
|
|
45
|
+
},
|
|
46
|
+
"nodeArguments": [
|
|
47
|
+
"--loader=ts-node/esm"
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
"xo": {
|
|
51
|
+
"extends": "xo-react",
|
|
52
|
+
"prettier": true,
|
|
53
|
+
"rules": {
|
|
54
|
+
"react/prop-types": "off"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"prettier": "@vdemedes/prettier-config",
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "tsc",
|
|
60
|
+
"dev": "tsc --watch",
|
|
61
|
+
"test": "prettier --check . && xo && ava"
|
|
62
|
+
}
|
|
63
|
+
}
|