Skip to content

Commit e668455

Browse files
committed
2 parents cc097be + a02e1ff commit e668455

File tree

5 files changed

+25
-10
lines changed

5 files changed

+25
-10
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# [v3.5.0](https://github.com/MoIzadloo/tsocks/compare/v3.4.0...v3.5.0) (2024-10-25)
2+
3+
## ✨ New Features
4+
5+
- [`6166ae9`](https://github.com/MoIzadloo/tsocks/commit/6166ae9) feat: new obfs method
6+
7+
## 🐛 Bug Fixes
8+
9+
- [`15264f9`](https://github.com/MoIzadloo/tsocks/commit/15264f9) fix: husky and build
10+
- [`29e34c8`](https://github.com/MoIzadloo/tsocks/commit/29e34c8) fix: husky and build
11+
112
# [v3.4.0](https://github.com/MoIzadloo/tsocks/compare/v3.3.0...v3.4.0) (2023-04-29)
213

314
## ✨ New Features

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tsocks",
3-
"version": "3.4.0",
3+
"version": "3.5.0",
44
"private": false,
55
"browser": false,
66
"author": "Mostafa Izadloo <[email protected]>",

src/client/client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class Client {
6161
version: 4 | 5,
6262
obfs: ObfsBuilder,
6363
userId?: string,
64-
tls?: boolean,
64+
tls?: boolean
6565
) {
6666
this.host = host
6767
this.port = port
@@ -96,8 +96,8 @@ export class Client {
9696
version?: 4 | 5,
9797
userId?: string
9898
) {
99-
let socket;
100-
if (this.tls){
99+
let socket
100+
if (this.tls) {
101101
socket = tls.connect(this.port, this.host, { rejectUnauthorized: false })
102102
} else {
103103
socket = net.connect(this.port, this.host)
@@ -280,7 +280,7 @@ export const connect = (
280280
host: string,
281281
version: 4 | 5,
282282
userId?: string,
283-
tls?: boolean,
283+
tls?: boolean
284284
) => {
285285
return new Client(port, host, version, none(), userId, tls)
286286
}

src/obfs/websocket.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ class WebSocket extends ObfsMethod {
9898
}
9999

100100
private generateWebSocketKey(): string {
101-
const randomBytes = crypto.randomBytes(16);
102-
return randomBytes.toString('base64');
101+
const randomBytes = crypto.randomBytes(16)
102+
return randomBytes.toString('base64')
103103
}
104104

105105
/**
@@ -109,10 +109,14 @@ class WebSocket extends ObfsMethod {
109109
*/
110110
handshake(callback?: () => void): void {
111111
if (this.connection.type === Connection.CLIENT) {
112-
const secWebSocketKey = this.generateWebSocketKey(); // Generate a unique key for the handshake
112+
const secWebSocketKey = this.generateWebSocketKey() // Generate a unique key for the handshake
113113
const handshakeRequest =
114114
`GET ${this.path} HTTP/1.1\r\n` +
115-
`Host: ${this.hostName ? this.hostName : `${this.connection.socket.remoteAddress}:${this.connection.socket.remotePort}`}\r\n` +
115+
`Host: ${
116+
this.hostName
117+
? this.hostName
118+
: `${this.connection.socket.remoteAddress}:${this.connection.socket.remotePort}`
119+
}\r\n` +
116120
'Upgrade: websocket\r\n' +
117121
'Connection: Upgrade\r\n' +
118122
`Sec-WebSocket-Key: ${secWebSocketKey}\r\n` +

src/server/state/socks5.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Request from '../../helper/request'
33
import * as socks4 from './socks4'
44
import { State } from '../../helper/state'
55
import Authenticator from '../auth/authenticator'
6-
import { none, websocket } from '../../obfs'
6+
import { none, websocket } from '../../obfs'
77

88
/**
99
* The ObfsState class identifies the obfuscation method

0 commit comments

Comments
 (0)