Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

尝试通过V2RAY代理转发网易云流量,连接不上服务器 #148

Closed
lysssssss opened this issue Jul 11, 2019 · 14 comments
Closed

Comments

@lysssssss
Copy link

lysssssss commented Jul 11, 2019

首先大佬感谢付出,实在不要太好用了。
现在直接通过网易云设置代理是可以成功的连上,但是我想通过V2RAY对网易云的流量单独转发到服务器上,服务器上的程序没有报异常,v2一直connect不上程序端口,报403Forbiden。服务器装了nginx不过只监听了80和443端口。v2采用的是websoket或http+tls来转发,试了两天了一直失败,想请教一下思路。
下面是v2报的连接错误,可能对问题帮助不大h哈哈,来请教个思路是我哪里不对了吗,试过tcp,纯http,http+tls,纯websocket,websocket+tls。
谢谢!

2019/07/11 16:56:23 [Info] [422354121] v2ray.com/core/proxy/freedom: opening connection to tcp:lysweb.cn:5200
2019/07/11 16:56:23 [Info] [425670565] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/socks: connection ends > context canceled
2019/07/11 16:56:23 [Info] [425670565] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/freedom: connection ends > context canceled
2019/07/11 16:56:24 [Info] [422354121] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/freedom: failed to open connection to tcp:lysweb.cn:5200 > v2ray.com/core/common/retry: [v2ray.com/core/transport/internet/http: failed to dial to tcp:lysweb.cn:5200 > Put https://lysweb.cn:5200/: http: server gave HTTP response to HTTPS client] > v2ray.com/core/common/retry: all retry attempts failed
2019/07/11 16:56:24 [Info] [422354121] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/socks: connection ends > v2ray.com/core/proxy/socks: failed to transport all TCP response > io: read/write on closed pipe

@lysssssss lysssssss reopened this Jul 11, 2019
@lysssssss lysssssss changed the title 尝试挂在这 尝试通过V2RAY代理转发网易云流量,连接不上服务器 Jul 11, 2019
@nondanee
Copy link
Owner

网易云的流量单独转发是什么意思呢,可不可以通过编辑 PAC 实现?
你的思路是什么啊?比如用 iptables 转发还是设置了什么
(我没用过 v2ray ==)

@lysssssss
Copy link
Author

lysssssss commented Jul 11, 2019

哈哈我说一下单独转发把。v2本身是用来fq的嘛,但我现在想让它多做一件事,就是通过v2把网易云的流量转发到服务器另一个端口上(比如5200),你的程序监听的是5200这个端口。这样就可以实现一个v2既可以fq又可以代理网易云音乐。
我用的不是iptable里转发,我用的是v2的路由配置规则,如下:

 {
        "type": "field",
        "outboundTag": "music",
        "ip": [
		"103.126.92.132",
		"103.126.92.133",
		"223.252.199.67",
		"223.252.199.66",
		"59.111.181.38",
		"59.111.160.197",
		"59.111.181.35",
		"59.111.181.60",
		"59.111.160.195",
		"59.111.181.155"
        ],
        "domain": [
		"baidu.com",
		"music.163.com",
		"interface.music.163.com",
		"interface3.music.163.com",
		"apm.music.163.com",
		"apm3.music.163.com",
		"mam.netease.com",
		"api.iplay.163.com" 
		]
      },

然后通过再配置一下出口就可以把代理的网易云音乐数据转发出去了(应该是这个意思吧哈哈)。
我的出口配置如下:

 "outboundDetour": [
    {
	  "protocol": "freedom",
	  "settings": {
	    "redirect": "******.cn:5200"
	  },
	  "tag": "music",
	  "streamSettings": {
	    "network": "http", //这里尝试过websocket,皆失败了
		"security": "tls" 
	  }
	}
  ]

不知你明白了我的意思了吗hh
不管用http+tls还是websocket+tls都是连不上的,就像上面给的日志一样。你程序 用的是http server,所以我就觉得很奇怪,来跟大佬交流交流

@Sakaizd
Copy link

Sakaizd commented Jul 12, 2019

@nondanee
Copy link
Owner

nondanee commented Jul 12, 2019

@lysssssss
学习了一下,outbound 不应该是 freedom
不过文档里写 http (proxy) 只支持 inbound,不支持 outbound
v2ray 那边有相关讨论 v2ray/v2ray-core#663 你可以参考一下
主要思路应该是加一个 socks to http 的转换 (v2ray 支持 socks outbound)

@nondanee
Copy link
Owner

nondanee commented Jul 12, 2019

关于 socks to http 的转换,之前也有 issue 问过 #63

@lysssssss
Copy link
Author

https://toutyrater.github.io/app/reverse2.html

谢啦,反向代理我也看了很久了,并不是很懂原理,后来z仔细一想好像我这个也不需要反向代理,仅仅为了转发而已,所以就没采用这个方法了。

@lysssssss
Copy link
Author

@lysssssss
学习了一下,outbound 不应该是 freedom
不过文档里写 http (proxy) 只支持 inbound,不支持 outbound
v2ray 那边有相关讨论 v2ray/v2ray-core#663 你可以参考一下
主要思路应该是加一个 socks to http 的转换 (v2ray 支持 socks outbound)

啊,麻烦大佬了,你竟然还花时间学习了一下哈哈。关于http的讨论我也看过了,那边的开发者之前也说过没有计划加入outbound的http。
我对代理这方面的知识不太懂,想了很久没搞通,freedom好像用的tcp协议?所以导致一直连不上。那我只能用socks再转http了,有空再研究研究,十分感谢!😁

@YLaido
Copy link

YLaido commented Jul 31, 2019

楼主问题解决了吗?
其实很简单的。
跟什么入站协议没关系,tls一样没问题,v2本身就是反代服务器。公网服务器上本地跑个127.0.0.1的服务,指定个端口比如说10086,outbounds或者outboundDetour那里就加个出站:

     {
                        "protocol": "freedom",
                        "tag":"netease",   
                         "settings":{
                             "redirect":"127.0.0.1:10086",
                                "userLevel": 0
                  }
}

routing那里rules里面加规则:

                                {
                                       "domain":[
                                     "music.163.com",
                                     "interface.music.163.com"
                                      ],
                                        "type":"field",
                                        "outboundTag":"netease"
                               },

v2rayN的pac.txt里面把music.163.com和interface.music.163.com加上,客户端选走ie代理。
完工。

@lysssssss
Copy link
Author

楼主问题解决了吗?
其实很简单的。
跟什么入站协议没关系,tls一样没问题,v2本身就是反代服务器。公网服务器上本地跑个127.0.0.1的服务,指定个端口比如说10086,outbounds或者outboundDetour那里就加个出站:

     {
                        "protocol": "freedom",
                        "tag":"netease",   
                         "settings":{
                             "redirect":"127.0.0.1:10086",
                                "userLevel": 0
                  }
}

routing那里rules里面加规则:

                                {
                                       "domain":[
                                     "music.163.com",
                                     "interface.music.163.com"
                                      ],
                                        "type":"field",
                                        "outboundTag":"netease"
                               },

v2rayN的pac.txt里面把music.163.com和interface.music.163.com加上,客户端选走ie代理。
完工。

后面没有弄了,现在路由器luci版自带透明代理了,所以我也不用弄了哈哈
你这个方法当时我好像也试过,弄了很久也没有成功所以才放弃的,我也觉得没有那么复杂才对

@lysssssss
Copy link
Author

楼主问题解决了吗?
其实很简单的。
跟什么入站协议没关系,tls一样没问题,v2本身就是反代服务器。公网服务器上本地跑个127.0.0.1的服务,指定个端口比如说10086,outbounds或者outboundDetour那里就加个出站:

     {
                        "protocol": "freedom",
                        "tag":"netease",   
                         "settings":{
                             "redirect":"127.0.0.1:10086",
                                "userLevel": 0
                  }
}

routing那里rules里面加规则:

                                {
                                       "domain":[
                                     "music.163.com",
                                     "interface.music.163.com"
                                      ],
                                        "type":"field",
                                        "outboundTag":"netease"
                               },

v2rayN的pac.txt里面把music.163.com和interface.music.163.com加上,客户端选走ie代理。
完工。

试过了,这个是不行的
会报错
: failed to process outbound traffic > v2ray.com/core/proxy/freedom: connection ends > context canceled

@YLaido
Copy link

YLaido commented Aug 18, 2019

楼主问题解决了吗?
其实很简单的。
跟什么入站协议没关系,tls一样没问题,v2本身就是反代服务器。公网服务器上本地跑个127.0.0.1的服务,指定个端口比如说10086,outbounds或者outboundDetour那里就加个出站:

     {
                        "protocol": "freedom",
                        "tag":"netease",   
                         "settings":{
                             "redirect":"127.0.0.1:10086",
                                "userLevel": 0
                  }
}

routing那里rules里面加规则:

                                {
                                       "domain":[
                                     "music.163.com",
                                     "interface.music.163.com"
                                      ],
                                        "type":"field",
                                        "outboundTag":"netease"
                               },

v2rayN的pac.txt里面把music.163.com和interface.music.163.com加上,客户端选走ie代理。
完工。

试过了,这个是不行的
会报错
: failed to process outbound traffic > v2ray.com/core/proxy/freedom: connection ends > context canceled

配置是没问题的,因为我自己就在用同样配置。你把完整的发上来看看

@YLaido
Copy link

YLaido commented Aug 21, 2019

看不懂你这操作,你这是客户端的配置文件吧?lysweb:5200这是本地才有的域名吧?还走的socks进站的?
我说的配置直接在vps上面弄就行,本地不需要搞

@lysssssss
Copy link
Author

看不懂你这操作,你这是客户端的配置文件吧?lysweb:5200这是本地才有的域名吧?还走的socks进站的?
我说的配置直接在vps上面弄就行,本地不需要搞

哦哦原来是这样,我这个配置的确是客户端的哈哈,谢啦

@fefz
Copy link

fefz commented Oct 18, 2019

很简单,outbound转发到http端口就行

  "inbounds": [
    {
      "settings": {
        "password": "unblock",
        "network": "tcp,udp",
        "method": "aes-256-cfb"
      },
      "port": 6666,
      "protocol": "shadowsocks"
    }
  ],
  "outbounds": [
    {
      "settings": {
      "domainStrategy": "UseIP",
      "redirect": "127.0.0.1:8080",
      "userLevel": 0
    },
      "protocol": "freedom"
    }
  ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants