v2ray / v2ray-core

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

websocket能代理openvpn吗? #647

Closed funbsd closed 6 years ago

funbsd commented 7 years ago

我配置了一个最简单的websocket。 发现只能代理http和https,不能代理openvpn连接外网。 websocket不支持http/https之外的协议连接外网吗?

funbsd commented 7 years ago

另外,V2Ray的传出代理能用普通的HTTP或SOCKS吗?公司里只能用HTTP代理上外网。

DarienRaymond commented 7 years ago

请贴配置及log。另外传出代理只有socks,不支持 HTTP

zhfreal commented 7 years ago

ws作为v2ray服务器和客户端的传输协议,客户端inbound可任意http或者socks,代理openvpn没有问题。 注意v2ray一般是tcp,所以openvpn也要改成tcp协议。

funbsd commented 7 years ago

第一个测试没问题了,可能我之前哪块配置有问题。websocket,tls都可以代理openvpn。 第二个外发代理问题,我用的ccproxy socks做测试,v2ray客户端无法穿过ccproxy与服务器相连。 ccproxy换成dante socks也是这个问题。

v2ray服务器配置:

{
  "log": {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "info"
  },
  "inbound": {
    "port": 1080,
    "listen": "0.0.0.0",
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "6e8b22a3-ebf0-454d-bd90-d3f115702ce1",
          "alterId": 64
        }
      ]
    },
    "streamSettings": {
      "network": "ws",
      "wsSettings": {
        "path": "/ws"
      }
    }
  },
  "outbound": {
    "protocol": "freedom",
    "settings": {}
  }
}

客户端配置:

{
  "log": {
    //"access": "/var/log/v2ray/access.log",
    //"error": "/var/log/v2ray/error.log",
    "loglevel": "debug"
  },
  "inbound": {
    "port": 1080,
    "listen": "0.0.0.0",
    "protocol": "http",
    "settings": {
      "auth": "noauth",
      "udp": false
    }
  },
  "outbound": {
    "protocol": "vmess",
    "settings": {
      "vnext": [
        {
          "address": "172.31.2.1",
          "port": 1080,
          "users": [
            {
              "id": "6e8b22a3-ebf0-454d-bd90-d3f115702ce1",
              "alterId": 64
            }
          ]
        }
      ]
    },
    "streamSettings": {
      "network": "ws",
      "wsSettings": {
        "path": "/ws"
      }
    },
    "proxySettings": {
      "tag": "outboundProxy"
    }
  },
  "outboundDetour": [
    {
      "protocol": "socks",
      "settings": {
        "servers": [
          {
            "address": "127.0.0.1",
            "port": 8081
          }
        ]
      },
      "tag": "outboundProxy"
    }
  ]
}

客户端日志:

2017/10/27 23:28:33 [Debug]App|Proxyman|Outbound: proxying to outboundProxy
2017/10/27 23:28:33 [Info]Proxy|VMess|Outbound: tunneling request to tcp:push-s.maxthon.com:80 via tcp:172.31.2.1:1080
2017/10/27 23:28:33 [Info]Transport|Internet|TCP: dailing TCP to tcp:127.0.0.1:8081
2017/10/27 23:28:34 [Info]App|Proxyman|Outbound: failed to process outbound traffic > Proxy|VMess|Outbound: connection ends > Proxy|VMess|Encoding: unexpected response header. Expecting 30 but actually 90
2017/10/27 23:28:36 [Info]App|Proxyman|Inbound: connection ends > Proxy|HTTP: connection ends > context canceled
funbsd commented 7 years ago

我大概搞明白了。代理协议、底层协议都得一致。我再想想怎么把这些代理串起来。

funbsd commented 7 years ago

好吧,其实还是没想明白。proxySettings的协议必须跟outbound一致吗? 比如v2ray客户端穿过http代理与v2ray服务器相连。v2ray客户端和服务器之间实际使用vmess。 实际是想达到vpn封装的效果,外层、里层协议相互独立。

funbsd commented 7 years ago

原来用openvpn经过公司http proxy可以连接我的服务器,后来不行了。 所以想在openvpn外面再包装一层,迷惑http proxy,达到穿墙的目的。

nicholascw commented 6 years ago

可以用Dokodemo把远端的OpenVPN映射到本地,参考我转发SSH隧道的记录