chore: remove UDP console log

This commit is contained in:
zizifn
2023-05-12 22:30:54 +08:00
committed by zizifn
parent 6235ecfb17
commit 258fd97b6e
3 changed files with 19 additions and 13 deletions

View File

@@ -343,10 +343,10 @@ function makeUDPSocketStream(portRemote, address) {
start(controller) { start(controller) {
/* … */ /* … */
udpClient.on('message', (message, info) => { udpClient.on('message', (message, info) => {
console.log( // console.log(
`udp package received ${info.size} bytes from ${info.address}:${info.port}`, // `udp package received ${info.size} bytes from ${info.address}:${info.port}`,
Buffer.from(message).toString('hex') // Buffer.from(message).toString('hex')
); // );
controller.enqueue( controller.enqueue(
Buffer.concat([ Buffer.concat([
new Uint8Array([(info.size >> 8) & 0xff, info.size & 0xff]), new Uint8Array([(info.size >> 8) & 0xff, info.size & 0xff]),
@@ -377,10 +377,10 @@ function makeUDPSocketStream(portRemote, address) {
controller.error(`Failed to send UDP packet !! ${err}`); controller.error(`Failed to send UDP packet !! ${err}`);
safeCloseUDP(udpClient); safeCloseUDP(udpClient);
} }
console.log( // console.log(
'udp package sent', // 'udp package sent',
Buffer.from(udpData).toString('hex') // Buffer.from(udpData).toString('hex')
); // );
resolve(true); resolve(true);
}); });
}); });

View File

@@ -6166,8 +6166,8 @@ vlessWServer.on('connection', function connection(ws, request) {
vlessResponseHeader = new Uint8Array([vlessVersion[0], 0]); vlessResponseHeader = new Uint8Array([vlessVersion[0], 0]);
const rawClientData = vlessBuffer.slice(rawDataIndex); const rawClientData = vlessBuffer.slice(rawDataIndex);
if (isUDP) { if (isUDP) {
// 如果仅仅是针对DNS 这样是没有必要的。因为xray 客户端 DNS A/AAA query 都有长度, // 如果仅仅是针对DNS 这样是没有必要的。因为xray 客户端 DNS A/AAA query 都有长度 header
// 所以直接和 DNS server 建立 TCP 就可以。所以无需 runtime 支持 UDP API。 // 所以直接和 DNS server over TCP。所以无需 runtime 支持 UDP API。
// DNS over UDP 和 TCP 唯一的区别就是 Header section format 多了长度 // DNS over UDP 和 TCP 唯一的区别就是 Header section format 多了长度
// https://www.rfc-editor.org/rfc/rfc1035#section-4.2.2 // https://www.rfc-editor.org/rfc/rfc1035#section-4.2.2
udpClientStream = makeUDPSocketStream(portRemote, address); udpClientStream = makeUDPSocketStream(portRemote, address);
@@ -6341,7 +6341,10 @@ function makeUDPSocketStream(portRemote, address) {
start(controller) { start(controller) {
/* … */ /* … */
udpClient.on('message', (message, info) => { udpClient.on('message', (message, info) => {
console.log(`udp package received ${info.size} bytes from ${info.address}:${info.port}`, Buffer.from(message).toString('hex')); // console.log(
// `udp package received ${info.size} bytes from ${info.address}:${info.port}`,
// Buffer.from(message).toString('hex')
// );
controller.enqueue(Buffer.concat([ controller.enqueue(Buffer.concat([
new Uint8Array([(info.size >> 8) & 0xff, info.size & 0xff]), new Uint8Array([(info.size >> 8) & 0xff, info.size & 0xff]),
message, message,
@@ -6368,7 +6371,10 @@ function makeUDPSocketStream(portRemote, address) {
controller.error(`Failed to send UDP packet !! ${err}`); controller.error(`Failed to send UDP packet !! ${err}`);
safeCloseUDP(udpClient); safeCloseUDP(udpClient);
} }
console.log('udp package sent', Buffer.from(udpData).toString('hex')); // console.log(
// 'udp package sent',
// Buffer.from(udpData).toString('hex')
// );
resolve(true); resolve(true);
}); });
}); });

File diff suppressed because one or more lines are too long