mirror of
https://github.com/lush2020/edgetunnel.git
synced 2026-03-21 17:04:08 +08:00
add comment
This commit is contained in:
@@ -141,6 +141,7 @@ vlessWServer.on('connection', async function connection(ws, request) {
|
||||
} `;
|
||||
if (hasError) {
|
||||
controller.error(`[${address}:${portWithRandomLog}] ${message} `);
|
||||
return;
|
||||
}
|
||||
// const addressType = requestAddr >> 42
|
||||
// const addressLength = requestAddr & 0x0f;
|
||||
@@ -148,6 +149,10 @@ vlessWServer.on('connection', async function connection(ws, request) {
|
||||
vlessResponseHeader = new Uint8Array([vlessVersion![0], 0]);
|
||||
const rawClientData = vlessBuffer.slice(rawDataIndex!);
|
||||
if (isUDP) {
|
||||
// 如果仅仅是针对DNS, 这样是没有必要的。因为xray 客户端 DNS A/AAA query 都有长度 header,
|
||||
// 所以直接和 DNS server over TCP。所以无需 runtime 支持 UDP API。
|
||||
// DNS over UDP 和 TCP 唯一的区别就是 Header section format 多了长度
|
||||
// https://www.rfc-editor.org/rfc/rfc1035#section-4.2.2
|
||||
udpClientStream = makeUDPSocketStream(portRemote, address);
|
||||
const writer = udpClientStream.writable.getWriter();
|
||||
writer.write(rawClientData).catch((error) => console.log);
|
||||
|
||||
72
client-config/config-client-with-dns-lcoal.json
Normal file
72
client-config/config-client-with-dns-lcoal.json
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"log": {
|
||||
"loglevel": "debug"
|
||||
},
|
||||
"inbounds": [
|
||||
{
|
||||
"listen": "0.0.0.0",
|
||||
"port": "4080",
|
||||
"protocol": "socks",
|
||||
"settings": {
|
||||
"auth": "noauth",
|
||||
"udp": true,
|
||||
"ip": "0.0.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"listen": "0.0.0.0",
|
||||
"port": "4081",
|
||||
"protocol": "http"
|
||||
}
|
||||
],
|
||||
"dns": {
|
||||
"servers": ["8.8.8.8"]
|
||||
},
|
||||
"outbounds": [
|
||||
{
|
||||
"protocol": "vless",
|
||||
"settings": {
|
||||
"vnext": [
|
||||
{
|
||||
"address": "127.0.0.1",
|
||||
"port": 4200,
|
||||
"users": [
|
||||
{
|
||||
"id": "e2839021-2313-427f-977c-a1b1dec79ace",
|
||||
"encryption": "none",
|
||||
"level": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "ws"
|
||||
// "wsSettings": {
|
||||
// "path": "/node-vless"
|
||||
// }
|
||||
// "security": "tls"
|
||||
},
|
||||
"tag": "zizi-ws"
|
||||
},
|
||||
{
|
||||
"protocol": "freedom",
|
||||
"tag": "direct"
|
||||
}
|
||||
],
|
||||
"routing": {
|
||||
"domainStrategy": "IPIfNonMatch",
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"ip": ["8.8.8.8"],
|
||||
"outboundTag": "zizi-ws"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"ip": ["geoip:private"],
|
||||
"outboundTag": "zizi-ws"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
1
client-config/readme.md
Normal file
1
client-config/readme.md
Normal file
@@ -0,0 +1 @@
|
||||
# Test local with DNS proxy
|
||||
5
dist/apps/node-vless/main.js
vendored
5
dist/apps/node-vless/main.js
vendored
@@ -6158,6 +6158,7 @@ vlessWServer.on('connection', function connection(ws, request) {
|
||||
portWithRandomLog = `${portRemote}--${Math.random()} ${isUDP ? 'udp ' : 'tcp '} `;
|
||||
if (hasError) {
|
||||
controller.error(`[${address}:${portWithRandomLog}] ${message} `);
|
||||
return;
|
||||
}
|
||||
// const addressType = requestAddr >> 42
|
||||
// const addressLength = requestAddr & 0x0f;
|
||||
@@ -6165,6 +6166,10 @@ vlessWServer.on('connection', function connection(ws, request) {
|
||||
vlessResponseHeader = new Uint8Array([vlessVersion[0], 0]);
|
||||
const rawClientData = vlessBuffer.slice(rawDataIndex);
|
||||
if (isUDP) {
|
||||
// 如果仅仅是针对DNS, 这样是没有必要的。因为xray 客户端 DNS A/AAA query 都有长度,
|
||||
// 所以直接和 DNS server 建立 TCP 就可以。所以无需 runtime 支持 UDP API。
|
||||
// DNS over UDP 和 TCP 唯一的区别就是 Header section format 多了长度
|
||||
// https://www.rfc-editor.org/rfc/rfc1035#section-4.2.2
|
||||
udpClientStream = makeUDPSocketStream(portRemote, address);
|
||||
const writer = udpClientStream.writable.getWriter();
|
||||
writer.write(rawClientData).catch((error) => console.log);
|
||||
|
||||
2
dist/apps/node-vless/main.js.map
vendored
2
dist/apps/node-vless/main.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user