Skip to content

Commit 514109c

Browse files
committed
Use just 'metadata' as the SOCKS metadata user/pass username
1 parent 6b5868d commit 514109c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/server/socks-server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface SocksServerOptions {
2323
* field in this metadata is reserved for future use.
2424
* - `user-password-metadata`: Use standard username/password authentication
2525
* method (0x02) to smuggle metadata - this does not really authenticate the
26-
* user. The username must be `mockttp-metadata` and the password
26+
* user. The username must be `metadata` and the password
2727
* must be a JSON object of up to 255 chars in total. All other usernames
2828
* & passwords will be rejected. This metadata is used just like
2929
* `custom-metadata` but this is compatible with existing SOCKS clients.
@@ -288,7 +288,7 @@ async function handleUsernamePasswordMetadata(socket: net.Socket) {
288288
const passwordLength = await readBytes(socket, 1);
289289
const password = await readBytes(socket, passwordLength[0]);
290290

291-
if (username.toString('utf8') !== 'mockttp-metadata') {
291+
if (username.toString('utf8') !== 'metadata') {
292292
socket.end(Buffer.from([
293293
0x05,
294294
0x01 // Generic rejection

test/integration/proxying/socks-proxying.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ nodeOnly(() => {
146146
try {
147147
await openSocksSocket(server, '127.0.0.1', remoteServer.port, {
148148
type: 5,
149-
userId: "mockttp-metadata",
149+
userId: "metadata",
150150
password: "{}"
151151
});
152152
expect.fail("Should have failed");
@@ -258,7 +258,7 @@ nodeOnly(() => {
258258

259259
const socksSocket = await openSocksSocket(server, '127.0.0.1', remoteServer.port, {
260260
type: 5,
261-
userId: "mockttp-metadata",
261+
userId: "metadata",
262262
password: JSON.stringify({ tags: ['response-test-tag'] })
263263
});
264264

@@ -275,7 +275,7 @@ nodeOnly(() => {
275275

276276
const socksSocket = await openSocksSocket(server, '127.0.0.1', remoteServer.port, {
277277
type: 5,
278-
userId: "mockttp-metadata",
278+
userId: "metadata",
279279
password: Buffer.from(
280280
JSON.stringify({ tags: ['base64d-test-tag'] })
281281
).toString('base64url')
@@ -292,7 +292,7 @@ nodeOnly(() => {
292292
try {
293293
await openSocksSocket(server, '127.0.0.1', remoteServer.port, {
294294
type: 5,
295-
userId: "mockttp-metadata",
295+
userId: "metadata",
296296
password: "}}}{{{{{{{{{{{{{{{{{" // Very invalid JSON
297297
});
298298
expect.fail("Should have failed");

0 commit comments

Comments
 (0)