Skip to content

Commit 7df94dc

Browse files
committed
added UI to v0.25.0
1 parent 123f0e9 commit 7df94dc

26 files changed

+1332
-173
lines changed

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@conet.project/conet-proxy",
33

4-
"version": "0.16.2",
4+
"version": "0.20.1",
55

66
"license": "UNLICENSED",
77
"files": [
@@ -33,7 +33,7 @@
3333
"ethers": "^6.15.0",
3434
"openpgp": "^5.11.2",
3535
"eth-crypto": "^3.1.0",
36-
"axios": "^1.10.0",
36+
"axios": "^1.11.0",
3737
"unzipper": "^0.12.3"
3838
},
3939

@@ -42,15 +42,15 @@
4242
"@types/express": "^5.0.3",
4343
"@types/fs-extra": "^11.0.4",
4444
"@types/jest": "^30.0.0",
45-
"@types/node": "^24.0.14",
45+
"@types/node": "^24.1.0",
4646
"@types/pouchdb": "^6.4.2",
4747
"@types/uuid": "^10.0.0",
4848
"@types/openpgp": "^5.0.0",
49-
"@typescript-eslint/eslint-plugin": "^8.37.0",
50-
"@typescript-eslint/parser": "^8.37.0",
49+
"@typescript-eslint/eslint-plugin": "^8.38.0",
50+
"@typescript-eslint/parser": "^8.38.0",
5151
"eslint": "^9.31.0",
5252
"eslint-config-airbnb-base": "^15.0.0",
53-
"eslint-config-prettier": "^10.1.5",
53+
"eslint-config-prettier": "^10.1.8",
5454
"jszip": "^3.10.1",
5555
"pouchdb": "^9.0.0",
5656
"ts-jest": "^29.4.0",

src/localServer/define.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ interface requestObj {
691691
}
692692

693693
interface VE_IPptpStream {
694-
type?: string
694+
type?: 'HTTP'
695695
buffer: string
696696
host: string
697697
port: number

src/localServer/httpProxy.ts

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import {createHash } from 'crypto'
1919
import { isIP } from 'net'
20+
import { logger } from './logger'
2021

2122
const cacheFileType = /\.jpeg$|\.html$|\.css$|\.gif$|\.js$|\.jpg$|\.png$|\.svg$|\.xml$/i
2223

@@ -26,8 +27,10 @@ export default class httpProxy {
2627
public text: string
2728
public _parts: string []
2829
public headers: Object
30+
public requestWithoutHostName = '/'
31+
public reBuildRequest = ''
2932
constructor ( public buffer: Buffer ) {
30-
this.text = buffer.toString( 'utf8' )
33+
this.text = buffer.toString()
3134
this._parts = this.text.split ('\r\n\r\n')
3235
this.commandWithLine = this._parts[0].split ( /\r\n/ )
3336
let u = '{'
@@ -46,6 +49,25 @@ export default class httpProxy {
4649
u +='}'
4750

4851
this.headers = JSON.parse ( u )
52+
const com = this.commandWithLine[0].split(' ')
53+
54+
try {
55+
const url = new URL(com[1])
56+
57+
58+
this.requestWithoutHostName = com[1]
59+
if (!/CONNECT /i.test(com[0])) {
60+
this.requestWithoutHostName = (url.pathname || '/') + (url.search || '')
61+
logger(`this.requestWithoutHostName = ${this.requestWithoutHostName}`)
62+
}
63+
64+
} catch (ex) {
65+
logger(`com[1] catch EX!`)
66+
this.requestWithoutHostName = com[1]
67+
}
68+
this.commandWithLine[0] = `${com[0]} ${this.requestWithoutHostName} ${com[2]}`
69+
this.reBuildRequest = this.text.replace(/.*\r\n/, `${this.commandWithLine[0]}\r\n`)
70+
4971
}
5072

5173
get parts () {
@@ -104,6 +126,13 @@ export default class httpProxy {
104126
return this.headers['host'].split(':')[0]
105127
}
106128

129+
get Port () {
130+
if ( !this.headers['host'] ) {
131+
return 80
132+
}
133+
return this.headers['host'].split(':')[1]||80
134+
}
135+
107136
get cachePath () {
108137
if ( !this.isGet || ! this.isCanCacheFile )
109138
return null
@@ -158,26 +187,7 @@ export default class httpProxy {
158187
return body.length
159188
}
160189

161-
get Port () {
162-
//console.log ( this.commandWithLine )
163-
const uu = this.commandWithLine[0].split(/\/\//)
164-
if ( uu.length > 1 ) {
165-
const kk = uu[1].split (':')
166-
if ( kk.length > 1 ) {
167-
const ret = kk[1].split (' ')[0]
168-
console.log ( `ret = [${ ret }]`)
169-
return parseInt ( ret )
170-
}
171-
return 80
172-
}
173-
const vv = this.commandWithLine[0].split(':')
174-
if ( vv.length > 1 ) {
175-
const kk = vv[1].split (' ')[0]
176-
return parseInt ( kk )
177-
}
178190

179-
return 443
180-
}
181191

182192
get BodyLength () {
183193
return parseInt ( this.headers[ 'content-length' ])

src/localServer/localGateway.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ start()
6565
// curl -v -x socks4a://localhost:8888 "https://www.google.com"
6666
// curl -v -x socks4://localhost:8888 "https://www.google.com"
6767
// curl -v -x socks5h://localhost:8888 "https://www.google.com"
68-
// curl -v -x socks5h://localhost:3002 "https://www.google.com"
68+
// curl -v -x http://127.0.0.1:3002 "http://216.225.196.167"
69+
// curl -v -x socks5h://localhost:3002 "http://216.225.196.167"
70+
// curl -v -x http://127.0.0.1:3002 "https://www.google.com"
6971

7072

7173

src/localServer/localServer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ let _proxyServer: proxyServer
174174

175175
const startSilentPass = (vpnObj: Native_StartVPNObj, currentVer: UpdateInfo, reactFolder: string, restart: () => Promise<void> ) => {
176176
logger(inspect(vpnObj, false, 3, true))
177-
177+
logger(`startSilentPass public key ${(new ethers.Wallet(vpnObj.privateKey)).address}`)
178178
_proxyServer = new proxyServer((3002).toString(), vpnObj.entryNodes, vpnObj.exitNode, vpnObj.privateKey, true, '')
179179
runUpdater(vpnObj.entryNodes, currentVer, reactFolder, restart)
180180
return true
@@ -271,6 +271,7 @@ export class Daemon {
271271
// 3. 检查更新路径是否存在,然后决定使用哪个路径
272272
// 如果 updatedPath 存在,就用它;否则,回退到 defaultPath。
273273
let staticFolder = fs.existsSync(updatedPath) ? updatedPath : defaultPath
274+
logger(`staticFolder = ${staticFolder}`)
274275
this.currentVer = await readUpdateInfo(staticFolder, '')
275276
if (!this.currentVer) {
276277
staticFolder = defaultPath

src/localServer/proxy-server.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ export class ProxyServer {
154154
155155
* curl -v -x http://127.0.0.1:3003 "https://www.google.com"
156156
curl -v -x http://127.0.0.1:3003 "http://www.google.com"
157-
// curl -v -x socks4a://localhost:3003 "https://www.google.com"
158-
// curl -v -x socks4://localhost:3003 "https://www.google.com"
159-
// curl -v -x socks5h://localhost:3003 "https://www.google.com"
157+
// curl -v -x socks4a://localhost:3002 "https://www.google.com"
158+
// curl -v -x socks4://localhost:3002 "https://www.google.com"
159+
// curl -v -x socks5h://localhost:3002 "https://www.google.com"
160160
*
161161
*/
162162

@@ -183,5 +183,3 @@ const test = () => {
183183
const layerMinus = new LayerMinus (entryNodes, egressNodes, privateKey)
184184
new ProxyServer(3002, layerMinus)
185185
}
186-
187-

src/localServer/proxyServer.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,16 @@ const httpProxy = ( clientSocket: Net.Socket, _buffer: Buffer, agent: string, pr
6161

6262
const connect = (_data: Buffer) => {
6363
hexDebug(_data)
64+
const request = _data.toString()
6465
const uuuu : VE_IPptpStream = {
6566
uuid: Crypto.randomBytes (10).toString ('hex'),
6667
host: hostName,
6768
buffer: _data.toString ( 'base64' ),
6869
port: httpHead.Port
6970
}
70-
// socks5Connect(uuuu, clientSocket)
71-
// clientSocket.resume ()
71+
logger(Colors.red(`connect ========> ${_data.toString()}`))
72+
logger(inspect(uuuu, false, 3, true))
73+
7274
return proxyServer.requestGetWay ( uuuu, clientSocket )
7375
}
7476

@@ -83,7 +85,9 @@ const httpProxy = ( clientSocket: Net.Socket, _buffer: Buffer, agent: string, pr
8385
return clientSocket.write(response)
8486
}
8587

86-
return connect (_buffer)
88+
const reBuildRequest = Buffer.from(httpHead.reBuildRequest)
89+
logger(`httpHead.reBuildRequest = `, Colors.magenta(httpHead.reBuildRequest))
90+
return connect (reBuildRequest)
8791
}
8892

8993
const getRandomSaaSNode = (saasNodes: nodes_info[]) => {
@@ -195,15 +199,14 @@ const createSock5ConnectCmd = async (wallet: ethers.Wallet, SaaSnode: nodes_info
195199
return (command)
196200
}
197201

198-
const otherRequestForNet = ( data: string, host: string, port: number, UserAgent: string ) => {
199-
200-
return `POST /post HTTP/1.1\r\n` +
202+
const otherRequestForNet = ( data: string, host: string, port: number, UserAgent: string): string => {
203+
const ret= `POST /post HTTP/1.1\r\n` +
201204
`Host: ${ host }${ port !== 80 ? ':'+ port : '' }\r\n` +
202205
`User-Agent: ${ UserAgent ? UserAgent : 'Mozilla/5.0' }\r\n` +
203206
`Content-Type: application/json;charset=UTF-8\r\n` +
204-
`Connection: keep-alive\r\n` +
205207
`Content-Length: ${ data.length }\r\n\r\n` +
206208
data + '\r\n\r\n'
209+
return ret
207210
}
208211

209212

@@ -230,11 +233,16 @@ const ConnectToProxyNode = (cmd : SICommandObj, SaaSnode: nodes_info, entryNode:
230233
if (!entryNode) {
231234
return logger(Colors.red(`ConnectToProxyNode Error! getRandomNode return null nodes!`))
232235
}
236+
237+
logger(`cmd requestData[0] = ${cmd.requestData[0]}`)
238+
239+
240+
233241
const hostInfo = `${uuuu.host}:${uuuu.port}`
234242
const connectID = Colors.gray('Connect to [') + Colors.green(`${hostInfo}`)+Colors.gray(']')
235243

236-
const data = otherRequestForNet(JSON.stringify({data: cmd.requestData[0]}), entryNode.ip_addr, 80, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36')
237-
244+
const data = otherRequestForNet(JSON.stringify({data: cmd.requestData[0]}), entryNode.ip_addr, 80, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36' )
245+
logger(Colors.blue(`ConnectToProxyNode to Node1 => ${data}`))
238246
const infoData: ITypeTransferCount = {
239247
hostInfo: hostInfo,
240248
startTime: new Date().getTime(),
@@ -280,8 +288,9 @@ const ConnectToProxyNode = (cmd : SICommandObj, SaaSnode: nodes_info, entryNode:
280288
remoteSocket.end().destroy()
281289
})
282290

283-
remoteSocket.write(data)
284291

292+
remoteSocket.write(data)
293+
logger(Colors.blue(`ConnectToProxyNode to Node1 => ${data}`))
285294
}
286295

287296
const isLocalhost = (hostname) => {

src/localServer/updateProcess.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { inspect } from "node:util"
77
import os from 'node:os'
88

99
const MAX_REDIRECTS = 5 // 防止无限重定向
10-
const tempUpdatePath = join(os.tmpdir(), `conet-update-${Date.now()}`)
10+
let tempUpdatePath = ''
1111
/**
1212
* 辅助函数:下载文件并流式解压到指定路径
1313
* @param downloadUrl 文件的URL
@@ -261,7 +261,7 @@ export const runUpdater = async (nodes: nodes_info[], currentVer: UpdateInfo, re
261261
logger('🚀 开始执行动态节点更新程序...')
262262

263263
try {
264-
264+
tempUpdatePath = join(reactFolder, `conet-update-${Date.now()}`)
265265

266266
const selectedNode = getRandomNode(nodes)
267267
logger(`✅ 节点列表获取成功!已随机选择节点: ${selectedNode.ip_addr} (位于 ${selectedNode.region})`);

src/localServer/workers/asset-manifest.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
{
22
"files": {
3-
"main.css": "/static/css/main.9c3b20de.css",
4-
"main.js": "/static/js/main.6f600d7d.js",
3+
"main.css": "/static/css/main.a3e920c9.css",
4+
"main.js": "/static/js/main.542f136f.js",
55
"static/js/453.a5cbc0be.chunk.js": "/static/js/453.a5cbc0be.chunk.js",
66
"static/media/GC.svg": "/static/media/GC.32c345f58a5986b6be47a893faa2ccfc.svg",
77
"static/media/sp-token.svg": "/static/media/sp-token.01da7809f36c2002dfb6fd98f3827a44.svg",
88
"static/media/main-wallet.svg": "/static/media/main-wallet.282cf0fe43d81965df2ba5c4ebd19566.svg",
99
"static/media/stripe-white.svg": "/static/media/stripe-white.70e757c20c63caf8e6e9d670f241bb3f.svg",
1010
"static/media/silent-pass-benefits-table.svg": "/static/media/silent-pass-benefits-table.f78f07e8d424889e059829943a65741d.svg",
1111
"static/media/silent-pass-service-table.svg": "/static/media/silent-pass-service-table.cc228d31aeec3dc2c5c9b00a6eeb3951.svg",
12-
"static/media/solana-token.svg": "/static/media/solana-token.259f456cf5dc592b41e4cdc3d354a02a.svg",
12+
"static/media/solana-token.svg": "/static/media/solana-token.a2b311c36fd439b144f59c65924d077c.svg",
1313
"static/media/Referrals.png": "/static/media/Referrals.45a4b5437d546356ff91.png",
14-
"static/media/bnb_usdt_token.png": "/static/media/bnb_usdt_token.964f9a622f24617d2f47.png",
14+
"static/media/bnb_usdt_token.svg": "/static/media/bnb_usdt_token.4f055f3a816ad5f4b2c1946de155664a.svg",
1515
"static/media/wechat.png": "/static/media/wechat.a80d781130f114a32f71.png",
16+
"static/media/usdt-token.svg": "/static/media/usdt-token.86dc782f876eb402610a4e362054c432.svg",
17+
"static/media/bnb_token.svg": "/static/media/bnb_token.b604fd921a99c773496e7adf9d0f2300.svg",
1618
"static/media/blue-badge.svg": "/static/media/blue-badge.5d57a6c7b26829840e518ef98d2a7cf1.svg",
1719
"static/media/strokes-1.svg": "/static/media/strokes-1.9d3ee006289fa0f2f95955faa56cb6ca.svg",
1820
"static/media/strokes-2.svg": "/static/media/strokes-2.79fb5427a9eae694742a36516460f5f5.svg",
1921
"static/media/crown.svg": "/static/media/crown.efa2587303c5f9ba20ef2360f3ff96da.svg",
20-
"static/media/paypal.svg": "/static/media/paypal.b83f15886cc3a694a52a7df7bf89a0e7.svg",
2122
"static/media/conet-token.svg": "/static/media/conet-token.bfd058b390550a59eb001c3a061be91e.svg",
2223
"static/media/clap-hands.svg": "/static/media/clap-hands.848850e8d5282532aeb77dab86a2565a.svg",
2324
"static/media/visibility-off.svg": "/static/media/visibility-off.12c2f0679ae08f45f758744e3ed0fce8.svg",
@@ -47,12 +48,12 @@
4748
"static/media/home-icon-blue.svg": "/static/media/home-icon-blue.df38257e8df35d5d6d3197cc84871954.svg",
4849
"static/media/home-icon-grey.svg": "/static/media/home-icon-grey.7c0953e4572ebe8dd813c4a3cd870b10.svg",
4950
"static/media/split-tunneling.svg": "/static/media/split-tunneling.9e6f6574614b30a8fa5483b6e26b49af.svg",
50-
"main.9c3b20de.css.map": "/static/css/main.9c3b20de.css.map",
51-
"main.6f600d7d.js.map": "/static/js/main.6f600d7d.js.map",
51+
"main.a3e920c9.css.map": "/static/css/main.a3e920c9.css.map",
52+
"main.542f136f.js.map": "/static/js/main.542f136f.js.map",
5253
"453.a5cbc0be.chunk.js.map": "/static/js/453.a5cbc0be.chunk.js.map"
5354
},
5455
"entrypoints": [
55-
"static/css/main.9c3b20de.css",
56-
"static/js/main.6f600d7d.js"
56+
"static/css/main.a3e920c9.css",
57+
"static/js/main.542f136f.js"
5758
]
5859
}

src/localServer/workers/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>Silent Pass</title><script defer="defer" src="/static/js/main.6f600d7d.js"></script><link href="/static/css/main.9c3b20de.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>Silent Pass</title><script defer="defer" src="/static/js/main.542f136f.js"></script><link href="/static/css/main.a3e920c9.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

0 commit comments

Comments
 (0)