v2ray / v2ray-core

A platform for building proxies to bypass network restrictions.
https://www.v2ray.com/
MIT License
45.28k stars 8.94k forks source link

MacOS下使用斗鱼客户端连接flv资源文件时,随机出现unexpected EOF错误 #2880

Closed iamqk closed 2 years ago

iamqk commented 3 years ago

1) 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明) V2Ray 4.38.3 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.16.3 darwin/amd64) 客户端:Mac + qv2ray 服务器:Linux instance-vps 5.4.0-1045-oracle #49-Ubuntu SMP Mon May 3 05:26:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。 使用mac的斗鱼客户端观看视频

3) 你看到的不正常的现象是什么?(请描述具体现象,比如访问超时,TLS 证书错误等) 直播页面的视频内容有的时候能够正常打开,有的时候不能, 关闭代理可以正常观看视频(不是斗鱼服务器/客户端的问题)

4) 你期待看到的正确表现是怎样的? 每次都能够正常打开mac斗鱼客户端的直播视频

5) 请附上你的配置(提交 Issue 前请隐藏服务器端IP地址)。 客户端配置

{
    "outbounds": [
        {
            "_QV2RAY_USE_GLOBAL_FORWARD_PROXY_": false,
            "mux": {
                "concurrency": 1,
                "enabled": null
            },
            "protocol": "vless",
            "sendThrough": "0.0.0.0",
            "settings": {
                "vnext": [
                    {
                        "address": "xxxxx",
                        "port": 443,
                        "users": [
                            {
                                "encryption": "none",
                                "id": "xxxxx"
                            }
                        ]
                    }
                ]
            },
            "streamSettings": {
                "network": "ws",
                "security": "tls",
                "sockopt": {
                    "mark": 0
                },
                "tcpSettings": {
                    "header": {
                        "request": {
                            "headers": {
                            },
                            "path": [
                            ]
                        },
                        "response": {
                            "headers": {
                            }
                        },
                        "type": "none"
                    }
                },
                "tlsSettings": {
                    "alpn": [
                    ],
                    "serverName": "xxxxx"
                },
                "wsSettings": {
                    "headers": {
                        "Host": "xxxxx"
                    },
                    "path": "xxxxx"
                },
                "xtlsSettings": {
                    "serverName": "xxxxx"
                }
            },
            "tag": "outBound_PROXY"
        }
    ]
}

服务端配置: 略

6) 请附上出错时软件输出的错误日志。在 Linux 中,日志通常在 /var/log/v2ray/error.log 文件中。 客户端错误日志: 2021/05/27 19:37:42 127.0.0.1:58885 accepted http://122.156.232.197:18080/live/2158487rt3Ftmv6A.flv?wsAuth=a469ea4e4701aec25c8d8be8dc498682&token=app-pcclient2-0-2158487-a9340e7341416fe43028b35fdcab43af966120192069b6b8&logo=0&expire=0&did=0bbff015a0ce8d36a71ecebc000016n1&ver=1.3.7&pt=1&st=0&vhost=play3&origin=tct&mix=0&isp=scdncuheljdq2 [DIRECT] 2021/05/27 19:37:42 tcp:127.0.0.1:58887 accepted tcp:danmuproxy.douyu.com:8506 [DIRECT] 2021/05/27 19:37:42 [Warning] [1627898626] proxy/http: failed to read response from 122.156.232.197:18080 > unexpected EOF

7) 请附上访问日志。在 Linux 中,日志通常在 /var/log/v2ray/access.log 文件中。

    // 在这里附上服务器端日志

8) 其它相关的配置文件(如 Nginx)和相关日志。

9) 如果 V2Ray 无法启动,请附上 --test 输出。

通常的命令为 /usr/bin/v2ray/v2ray --test --config /etc/v2ray/config.json。请按实际情况修改。

10) 如果 V2Ray 服务运行不正常,请附上 journal 日志。

通常的命令为 journalctl -u v2ray

请预览一下你填的内容再提交。

iamqk commented 3 years ago

错误提示似乎出现在server.go以下代码段

responseDone := func() error {
    responseReader := bufio.NewReaderSize(&buf.BufferedReader{Reader: link.Reader}, buf.Size)
    response, err := http.ReadResponse(responseReader, request)
    if err == nil {
        http_proto.RemoveHopByHopHeaders(response.Header)
        if response.ContentLength >= 0 {
            response.Header.Set("Proxy-Connection", "keep-alive")
            response.Header.Set("Connection", "keep-alive")
            response.Header.Set("Keep-Alive", "timeout=4")
            response.Close = false
        } else {
            response.Close = true
            result = nil
        }
    } else {
        newError("failed to read response from ", request.Host).Base(err).AtWarning().WriteToLog(session.ExportIDToError(ctx))
        response = &http.Response{
            Status:        "Service Unavailable",
            StatusCode:    503,
            Proto:         "HTTP/1.1",
            ProtoMajor:    1,
            ProtoMinor:    1,
            Header:        http.Header(make(map[string][]string)),
            Body:          nil,
            ContentLength: 0,
            Close:         true,
        }
        response.Header.Set("Connection", "close")
        response.Header.Set("Proxy-Connection", "close")
    }
    if err := response.Write(writer); err != nil {
        return newError("failed to write response").Base(err).AtWarning()
    }
    return nil
}

我调查了一下 似乎和这个问题相关? https://stackoverflow.com/questions/51105792/golang-unexpected-eof

现在没有调试环境 无从下手 哪位大侠处理一下?

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days