v2ray-core icon indicating copy to clipboard operation
v2ray-core copied to clipboard

VS CODE一个扩展(KILO-CODE)与V2RAY通信异常烦请大佬帮看

Open pChaoXP opened this issue 3 months ago • 4 comments

What version of V2Ray are you using?

V2RAY 5.28.0,WS TLS VLESS V2RAYN 7.14.6 X64

What's your scenario of using V2Ray?

VS CODE带KILO-CODE、ROO CODE两个扩展,通过本机HTTP代理调用AI模型的API ENDPOINTS

What problems have you encountered?

ROO CODE运行正常,跟AI模型的对话都正常。 KILO-CODE启动正常,一旦开始跟AI模型交互,KILO-CODE立即发起几十条连接,然后从V2RAYN的日志里看到连接中断(可能是自我保护措施),形如: app/proxyman/inbound: connection ends > proxy/http: connection ends > proxy/http: failed to write response > readfrom tcp 127.0.0.1:10808->127.0.0.1:7532: io: read/write on closed pipe

在ACCESS日志里形如:

2025/09/09 23:47:23 tcp:127.0.0.1:12478 rejected  proxy/socks: unknown Socks version: 67
2025/09/09 23:47:23 tcp:127.0.0.1:12479 rejected  proxy/socks: unknown Socks version: 71

What's your expectation?

感觉应该是KILO-CODE处理连接方面有些“独到之处”,应该不是V2RAY的BUG,但多数KILO用户可能没有通过V2RAY使用,所以我只好到V2RAY的地盘来请教了。

我希望各位大神能帮我判断一下,这KILO是犯了什么毛病,或者说我应该调整我的V2RAY的什么配置,能让我顺利地使用KILO-CODE。

Please attach your configuration here

Server configuration: 抱歉我没有SERVER的V2RAY配置。但我保证只有KILO-CODE有此问题,其他应用通过V2RAY都能与Internet很好通讯。

Client configuration:

{
  "log": {
    "access": "",
    "error": "",
    "loglevel": "info"
  },
  "inbounds": [
    {
      "tag": "socks-in",
      "port": 10808,
      "listen": "127.0.0.1",
      "protocol": "socks",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      },
      "settings": {
        "auth": "noauth",
        "udp": true,
        "userLevel": 0
      }
    },
    {
      "tag": "http-in",
      "port": 10809,
      "listen": "127.0.0.1",
      "protocol": "http",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      },
      "settings": {
        "auth": "noauth",
        "udp": false,
        "userLevel": 0
      }
    }
  ],
  "outbounds": [
    {
      "tag": "proxy-out",
      "protocol": "vless",
      "settings": {
        "vnext": [
          {
            "address": "abc.com",
            "port": 443,
            "users": [
              {
                "id": "XXXXXXX-9E8D-447E-A068-23XXXXXXXDD4",
                "encryption": "none",
                "flow": ""
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "security": "tls",
        "tlsSettings": {
          "allowInsecure": true,
          "alpn": [
            "http/1.1"
          ]
        },
        "wsSettings": {
          "path": "/ws",
          "headers": { "Host": "abc.com" }
        }
      },
      "mux": {
        "enabled": false,
        "concurrency": 4
      }
    },
    {
      "tag": "direct",
      "protocol": "freedom",
      "settings": {}
    },
    {
      "tag": "block",
      "protocol": "blackhole",
      "settings": {
        "response": {
          "type": "http"
        }
      }
    }
  ],
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "domainMatcher": "linear",
    "rules": [
      {
        "type": "field",
        "domain": [
          "geosite:cn",
          "tencent.com",
          "qq.com",
          "tpstelemetry.tencent.com",
          "otheve.beacon.qq.com"
        ],
        "ip": ["geoip:cn", "geoip:private"],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "domain": ["geosite:category-ads-all"],
        "outboundTag": "block"
      },
      {
        "type": "field",
        "domain": ["domain:example-example.com", "domain:example-example2.com"],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "inboundTag": ["socks-in", "http-in"],
        "outboundTag": "proxy-out"
      }
    ]
  }
}

Please attach error logs here

2025/09/09 23:47:03 [Debug] app/log: Logger started
2025/09/09 23:47:03 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:10808
2025/09/09 23:47:03 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:10809
2025/09/09 23:47:03 [Info] transport/internet/tcp: listening TCP on 127.0.0.1:10809
2025/09/09 23:47:03 [Info] transport/internet/tcp: listening TCP on 127.0.0.1:10808
2025/09/09 23:47:03 [Info] transport/internet/udp: listening UDP on 127.0.0.1:10808
2025/09/09 23:47:03 [Warning] V2Ray 5.28.0 started
2025/09/09 23:47:03 [Info] [1979426737] proxy/socks: TCP Connect request to tcp:149.154.167.92:443
2025/09/09 23:47:03 [Info] [4001069329] proxy/socks: TCP Connect request to tcp:149.154.167.92:80
2025/09/09 23:47:03 [Info] [1979426737] app/dispatcher: taking detour [proxy-out] for [tcp:149.154.167.92:443]
2025/09/09 23:47:03 [Info] [4001069329] app/dispatcher: sniffed domain: 149.154.167.92 for tcp:149.154.167.92:80
2025/09/09 23:47:03 [Info] [4001069329] app/dispatcher: taking detour [proxy-out] for [tcp:149.154.167.92:80]
2025/09/09 23:47:03 [Info] [4001069329] transport/internet/websocket: creating connection to tcp:abc.com:443
2025/09/09 23:47:03 [Info] [1979426737] transport/internet/websocket: creating connection to tcp:abc.com:443
2025/09/09 23:47:04 [Info] [1979426737] proxy/vless/outbound: tunneling request to tcp:149.154.167.92:443 via abc.com:443
2025/09/09 23:47:04 [Info] [4001069329] proxy/vless/outbound: tunneling request to tcp:149.154.167.92:80 via abc.com:443
2025/09/09 23:47:04 [Info] [1762175721] proxy/socks: TCP Connect request to tcp:clerk.openrouter.ai:443
2025/09/09 23:47:04 [Info] [1762175721] app/dispatcher: sniffed domain: clerk.openrouter.ai for tcp:clerk.openrouter.ai:443
2025/09/09 23:47:04 [Info] [1762175721] app/dispatcher: taking detour [proxy-out] for [tcp:clerk.openrouter.ai:443]
2025/09/09 23:47:04 [Info] [1762175721] transport/internet/websocket: creating connection to tcp:abc.com:443
2025/09/09 23:47:04 [Info] [2809861882] proxy/socks: TCP Connect request to tcp:clerk.openrouter.ai:443
2025/09/09 23:47:04 [Info] [1819191344] proxy/socks: TCP Connect request to tcp:91.108.56.146:443
2025/09/09 23:47:04 [Info] [2809861882] app/dispatcher: taking detour [proxy-out] for [tcp:clerk.openrouter.ai:443]
2025/09/09 23:47:04 [Info] [2809861882] transport/internet/websocket: creating connection to tcp:abc.com:443
2025/09/09 23:47:04 [Info] [1819191344] app/dispatcher: taking detour [proxy-out] for [tcp:91.108.56.146:443]
2025/09/09 23:47:04 [Info] [1819191344] transport/internet/websocket: creating connection to tcp:abc.com:443
2025/09/09 23:47:04 [Info] [2142635321] proxy/socks: TCP Connect request to tcp:91.108.56.146:80
2025/09/09 23:47:04 [Info] [2142635321] app/dispatcher: sniffed domain: 91.108.56.146 for tcp:91.108.56.146:80
2025/09/09 23:47:04 [Info] [2142635321] app/dispatcher: taking detour [proxy-out] for [tcp:91.108.56.146:80]
2025/09/09 23:47:04 [Info] [2142635321] transport/internet/websocket: creating connection to tcp:abc.com:443
2025/09/09 23:47:05 [Info] [1762175721] proxy/vless/outbound: tunneling request to tcp:clerk.openrouter.ai:443 via abc.com:443
2025/09/09 23:47:05 [Info] [2809861882] proxy/vless/outbound: tunneling request to tcp:clerk.openrouter.ai:443 via abc.com:443
2025/09/09 23:47:05 [Info] [2142635321] proxy/vless/outbound: tunneling request to tcp:91.108.56.146:80 via abc.com:443
2025/09/09 23:47:05 [Info] [1819191344] proxy/vless/outbound: tunneling request to tcp:91.108.56.146:443 via abc.com:443
2025/09/09 23:47:06 [Info] [1979426737] app/proxyman/inbound: connection ends > proxy/socks: connection ends > context canceled
2025/09/09 23:47:06 [Info] [1979426737] app/proxyman/outbound: failed to process outbound traffic > proxy/vless/outbound: connection ends > context canceled
2025/09/09 23:47:06 [Info] [4001069329] app/proxyman/inbound: connection ends > proxy/socks: connection ends > context canceled
2025/09/09 23:47:06 [Info] [4001069329] app/proxyman/outbound: failed to process outbound traffic > proxy/vless/outbound: connection ends > context canceled
2025/09/09 23:47:07 [Info] [1991631385] app/proxyman/inbound: connection ends > proxy/socks: failed to read request > proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 [Info] [493510470] app/proxyman/inbound: connection ends > proxy/socks: failed to read request > proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 [Info] [2174283761] app/proxyman/inbound: connection ends > proxy/socks: failed to read request > proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 [Info] [1859463398] app/proxyman/inbound: connection ends > proxy/socks: failed to read request > proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 [Info] [3344069090] app/proxyman/inbound: connection ends > proxy/socks: failed to read request > proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 [Info] [2013553513] app/proxyman/inbound: connection ends > proxy/socks: failed to read request > proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 [Info] [4248648193] app/proxyman/inbound: connection ends > proxy/socks: failed to read request > proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 [Info] [1362971888] app/proxyman/inbound: connection ends > proxy/socks: failed to read request > proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 [Info] [3884472801] app/proxyman/inbound: connection ends > proxy/socks: failed to read request > proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 [Info] [3634755803] app/proxyman/inbound: connection ends > proxy/socks: failed to read request > proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 [Info] [2479505309] app/proxyman/inbound: connection ends > proxy/socks: failed to read request > proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 [Info] [2780565406] app/proxyman/inbound: connection ends > proxy/socks: failed to read request > proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 [Info] [3474959627] app/proxyman/inbound: connection ends > proxy/socks: failed to read request > proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 [Info] [61625218] app/proxyman/inbound: connection ends > proxy/socks: failed to read request > proxy/socks: unknown Socks version: 67

Server error log: 抱歉我没有服务器日志。

Client error log: VS CODE的KILO-CODE出错信息为:

无法完成请求,请确保您已连接并使用所选提供商登录。

Maximum number of redirects exceeded

Please attach access log here

2025/09/09 23:47:03 tcp:127.0.0.1:10656 accepted tcp:149.154.167.92:443 [proxy-out]
2025/09/09 23:47:03 tcp:127.0.0.1:10657 accepted tcp:149.154.167.92:80 [proxy-out]
2025/09/09 23:47:04 tcp:127.0.0.1:10662 accepted tcp:clerk.openrouter.ai:443 [proxy-out]
2025/09/09 23:47:04 tcp:127.0.0.1:10665 accepted tcp:clerk.openrouter.ai:443 [proxy-out]
2025/09/09 23:47:04 tcp:127.0.0.1:10664 accepted tcp:91.108.56.146:443 [proxy-out]
2025/09/09 23:47:04 tcp:127.0.0.1:10666 accepted tcp:91.108.56.146:80 [proxy-out]
2025/09/09 23:47:07 tcp:127.0.0.1:10673 rejected  proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 tcp:127.0.0.1:10674 rejected  proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 tcp:127.0.0.1:10675 rejected  proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 tcp:127.0.0.1:10676 rejected  proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 tcp:127.0.0.1:10677 rejected  proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 tcp:127.0.0.1:10678 rejected  proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 tcp:127.0.0.1:10679 rejected  proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 tcp:127.0.0.1:10680 rejected  proxy/socks: unknown Socks version: 67
2025/09/09 23:47:07 tcp:127.0.0.1:10681 rejected  proxy/socks: unknown Socks version: 67
(后面还有密密麻麻好多行)

##V2RAYN LOG

2025-09-09 08:43:40.3269-INFO v2rayN start up | v2rayN - V7.14.6 - X64 | C:\迅雷下载\v2rayN-Core\ | C:\迅雷下载\v2rayN-Core\v2rayN.exe | Microsoft Windows NT 10.0.26100.0
2025-09-09 08:43:41.5740-INFO Setup Scheduled Tasks
2025-09-09 08:44:46.6074-INFO AppExitAsync Begin
2025-09-09 08:44:47.0095-INFO AppExitAsync End
2025-09-09 08:44:47.0534-INFO OnExit
2025-09-09 12:39:57.0454-INFO v2rayN start up | v2rayN - V7.14.6 - X64 | C:\迅雷下载\v2rayN-Core\ | C:\迅雷下载\v2rayN-Core\v2rayN.exe | Microsoft Windows NT 10.0.26100.0
2025-09-09 12:39:59.8977-INFO Setup Scheduled Tasks
2025-09-09 12:55:01.5591-INFO AppExitAsync Begin
2025-09-09 12:55:01.9858-INFO AppExitAsync End
2025-09-09 12:55:02.0163-INFO OnExit
2025-09-09 18:49:53.0853-INFO v2rayN start up | v2rayN - V7.14.6 - X64 | C:\迅雷下载\v2rayN-Core\ | C:\迅雷下载\v2rayN-Core\v2rayN.exe | Microsoft Windows NT 10.0.26100.0
2025-09-09 18:49:54.2153-INFO Setup Scheduled Tasks

pChaoXP avatar Sep 09 '25 16:09 pChaoXP

unknown Socks version 是不是协议写错了,v2ray 配置的是 socks 代理,但工具配置的是 http 代理。

qianbinbin avatar Sep 18 '25 18:09 qianbinbin

unknown Socks version 是不是协议写错了,v2ray 配置的是 socks 代理,但工具配置的是 http 代理。

V2RAYN开的是个mixed端口,HTTP HTTPS和SOCKS5都是10808,实际使用都没问题,相同环境下VS CODE里面的ROO插件工作得很好。本身VS CODE目前也不支持SOCKS代理的。

pChaoXP avatar Sep 22 '25 00:09 pChaoXP

V2RAYN开的是个mixed端口,HTTP HTTPS和SOCKS5都是10808,实际使用都没问题,相同环境下VS CODE里面的ROO插件工作得很好。本身VS CODE目前也不支持SOCKS代理的。

你指的是 https://github.com/2dust/v2rayN ?我不知道 v2ray-core 除了任意门外的混合端口。

你的 log 看起来就是协议不同导致的问题,也许你需要去 v2rayN 的社区问问。

qianbinbin avatar Sep 22 '25 09:09 qianbinbin

你的 log 看起来就是协议不同导致的问题,也许你需要去 v2rayN 的社区问问。

好的,谢谢大佬指教

pChaoXP avatar Sep 22 '25 12:09 pChaoXP