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

[Feature request]: 如何在使用http代理上网的环境下使用 #4896

Closed
1 task done
darkelf123 opened this issue Mar 29, 2024 · 18 comments
Closed
1 task done
Labels
enhancement New feature or request

Comments

@darkelf123
Copy link

相关问题

目前所在的网络需要通过一个有账号和密码认证的http代理才能上网,v2rayn本身没有找到在哪里可以设置使用http代理,或者在哪里可以修改设置文件使用代理服务器?

描述你希望的解决方案

在哪里可以设置使用代理服务器

描述你所考虑的替代方案

No response

我确认已查询历史issues

@darkelf123 darkelf123 added the enhancement New feature or request label Mar 29, 2024
@Lsyx-Good
Copy link
Contributor

可以考虑自定义配置

@darkelf123
Copy link
Author

可以考虑自定义配置

能否详细指导一下怎么操作?在issue里翻了半天没找到类似的情况

@Lsyx-Good
Copy link
Contributor

Lsyx-Good commented Mar 29, 2024

你是要通过http连接到国外网站,还是说直接上网呢,如果是不需要连接到国外的话,可以删除第一个出站,如果需要代理,换成你自己的协议detour字段保持不变,http出站换成自己server以及验证,以下为sing-box配置(主要关注出站部分

{
  "log": {
    "level": "info"
  },
  "dns": {
    "servers": [
      {
        "tag": "dns-remote",
        "address": "tls://8.8.8.8",
        "detour": "proxy"
      },
      {
        "tag": "dns-direct",
        "address": "h3://223.6.6.6/dns-query",
        "detour": "direct"
      },
      {
        "tag": "dns-block",
        "address": "rcode://success"
      }
    ],
    "rules": [
      {
        "geosite": "cn",
        "server": "dns-direct"
      },
      {
        "query_type": [
          "NIMLOC",
          "SRV"
        ],
        "server": "dns-block"
      },
      {
        "domain_suffix": ".lan",
        "server": "dns-block"
      }
    ],
    "independent_cache": true
  },
  "inbounds": [
    {
      "type": "mixed",
      "tag": "mixed-in",
      "listen": "127.0.0.1",
      "listen_port": 2080,
      "sniff": true
    }
  ],
  "outbounds": [
    {
      "type": "vmess",
      "tag": "proxy",
      "detour": "g-16433",
      "server": "",
      "server_port": 3389,
      "uuid": "9c050a86-d612-48f1-ec32-e73df08b7",
      "security": "auto",
      "transport": {
        "type": "http"
      }
    },
    {
      "type": "http",
      "tag": "g-16433",
      "server": "127.0.0.1",
      "server_port": 1080,
      "username": "user",
      "password": "pd"
    },
    {
      "type": "direct",
      "tag": "direct"
    },
    {
      "type": "direct",
      "tag": "bypass"
    },
    {
      "type": "block",
      "tag": "block"
    },
    {
      "type": "dns",
      "tag": "dns-out"
    }
  ],
  "route": {
    "rules": [
      {
        "protocol": "dns",
        "outbound": "dns-out"
      },
      {
        "domain_suffix": [
          "appcenter.ms",
          "app-measurement.com",
          "firebase.io",
          "crashlytics.com",
          "google-analytics.com",
          "media-match.com",
          "adclick.g.doublecklick.net",
          "www.googleadservices.com",
          "open.spotify.com",
          "pagead2.googlesyndication.com",
          "desktop.spotify.com",
          "googleads.g.doubleclick.net",
          "pubads.g.doubleclick.net",
          "audio2.spotify.com",
          "www.omaze.com",
          "omaze.com",
          "bounceexchange.com",
          "securepubads.g.doubleclick.net",
          "8.126.154.104.bc.googleusercontent.com",
          "104.154.126.8"
        ],
        "geosite": "category-ads-all",
        "outbound": "block"
      },
      {
        "geosite": "cn",
        "outbound": "bypass"
      },
      {
        "geoip": [
          "cn",
          "private"
        ],
        "outbound": "bypass"
      },
      {
        "network": "udp",
        "port": [
          135,
          137,
          138,
          139,
          5353
        ],
        "outbound": "block"
      },
      {
        "ip_cidr": [
          "224.0.0.0/3",
          "ff00::/8"
        ],
        "outbound": "block"
      },
      {
        "source_ip_cidr": [
          "224.0.0.0/3",
          "ff00::/8"
        ],
        "outbound": "block"
      }
    ]
  }
}

@darkelf123
Copy link
Author

你是要通过http连接到国外网站,还是说直接上网呢,如果是不需要连接到国外的话,可以删除第一个出站,如果需要代理,换成你自己的协议detour字段保持不变,http出站换成自己server以及验证,以下为sing-box配置(主要关注出站部分

{
  "log": {
    "level": "info"
  },
  "dns": {
    "servers": [
      {
        "tag": "dns-remote",
        "address": "tls://8.8.8.8",
        "detour": "proxy"
      },
      {
        "tag": "dns-direct",
        "address": "h3://223.6.6.6/dns-query",
        "detour": "direct"
      },
      {
        "tag": "dns-block",
        "address": "rcode://success"
      }
    ],
    "rules": [
      {
        "geosite": "cn",
        "server": "dns-direct"
      },
      {
        "query_type": [
          "NIMLOC",
          "SRV"
        ],
        "server": "dns-block"
      },
      {
        "domain_suffix": ".lan",
        "server": "dns-block"
      }
    ],
    "independent_cache": true
  },
  "inbounds": [
    {
      "type": "mixed",
      "tag": "mixed-in",
      "listen": "127.0.0.1",
      "listen_port": 2080,
      "sniff": true
    }
  ],
  "outbounds": [
    {
      "type": "vmess",
      "tag": "proxy",
      "detour": "g-16433",
      "server": "",
      "server_port": 3389,
      "uuid": "9c050a86-d612-48f1-ec32-e73df08b7",
      "security": "auto",
      "transport": {
        "type": "http"
      }
    },
    {
      "type": "http",
      "tag": "g-16433",
      "server": "127.0.0.1",
      "server_port": 1080,
      "username": "user",
      "password": "pd"
    },
    {
      "type": "direct",
      "tag": "direct"
    },
    {
      "type": "direct",
      "tag": "bypass"
    },
    {
      "type": "block",
      "tag": "block"
    },
    {
      "type": "dns",
      "tag": "dns-out"
    }
  ],
  "route": {
    "rules": [
      {
        "protocol": "dns",
        "outbound": "dns-out"
      },
      {
        "domain_suffix": [
          "appcenter.ms",
          "app-measurement.com",
          "firebase.io",
          "crashlytics.com",
          "google-analytics.com",
          "media-match.com",
          "adclick.g.doublecklick.net",
          "www.googleadservices.com",
          "open.spotify.com",
          "pagead2.googlesyndication.com",
          "desktop.spotify.com",
          "googleads.g.doubleclick.net",
          "pubads.g.doubleclick.net",
          "audio2.spotify.com",
          "www.omaze.com",
          "omaze.com",
          "bounceexchange.com",
          "securepubads.g.doubleclick.net",
          "8.126.154.104.bc.googleusercontent.com",
          "104.154.126.8"
        ],
        "geosite": "category-ads-all",
        "outbound": "block"
      },
      {
        "geosite": "cn",
        "outbound": "bypass"
      },
      {
        "geoip": [
          "cn",
          "private"
        ],
        "outbound": "bypass"
      },
      {
        "network": "udp",
        "port": [
          135,
          137,
          138,
          139,
          5353
        ],
        "outbound": "block"
      },
      {
        "ip_cidr": [
          "224.0.0.0/3",
          "ff00::/8"
        ],
        "outbound": "block"
      },
      {
        "source_ip_cidr": [
          "224.0.0.0/3",
          "ff00::/8"
        ],
        "outbound": "block"
      }
    ]
  }
}

目前就是直接打开v2rayn,无法更新机场的订阅地址,提示目标计算机积极拒绝。我希望能正常使用v2rayn,不用v2rayn的代理上网,而靠浏览器的switch插件来切换是否翻墙

@Lsyx-Good
Copy link
Contributor

我感觉我俩没在一个频道,您的意思是本身电脑可以正常上网是吧,然后你想在浏览器中通过插件进行切换是否需要代理?

@darkelf123
Copy link
Author

我感觉我俩没在一个频道,您的意思是本身电脑可以正常上网是吧,然后你想在浏览器中通过插件进行切换是否需要代理?

是的,电脑本身浏览器是通过公司的一个http代理服务器正常上网,直接用v2rayn是没办法更新订阅的。也没找到在哪里设置让v2rayn使用http代理服务器,目前我希望让v2rayN作为一个本地的sock5代理,浏览器通过插件来控制切换是使用公司的http代理访问国内网址还是通过v2rayn的socket5代理访问墙外网址

@Lsyx-Good
Copy link
Contributor

我感觉我俩没在一个频道,您的意思是本身电脑可以正常上网是吧,然后你想在浏览器中通过插件进行切换是否需要代理?

是的,电脑本身浏览器是通过公司的一个http代理服务器正常上网,直接用v2rayn是没办法更新订阅的。也没找到在哪里设置让v2rayn使用http代理服务器,目前我希望让v2rayN作为一个本地的sock5代理,浏览器通过插件来控制切换是使用公司的http代理访问国内网址还是通过v2rayn的socket5代理访问墙外网址

这样说的话,你在v2rayn自定义一个http配置不就好了,看你用什么内核,就到相关内核的http的配置进行配置

@darkelf123
Copy link
Author

我感觉我俩没在一个频道,您的意思是本身电脑可以正常上网是吧,然后你想在浏览器中通过插件进行切换是否需要代理?

是的,电脑本身浏览器是通过公司的一个http代理服务器正常上网,直接用v2rayn是没办法更新订阅的。也没找到在哪里设置让v2rayn使用http代理服务器,目前我希望让v2rayN作为一个本地的sock5代理,浏览器通过插件来控制切换是使用公司的http代理访问国内网址还是通过v2rayn的socket5代理访问墙外网址

这样说的话,你在v2rayn自定义一个http配置不就好了,看你用什么内核,就到相关内核的http的配置进行配置

我使用的是v2rayN-With-Core-SelfContained,用的xray的内核,麻烦请指导一下在哪里配置?没找到设置文件所在的路径。

@2dust
Copy link
Owner

2dust commented Mar 29, 2024

先用自定义配置实现
就是普通节点前置一个http代理, 你可以先把正常的节点导出成客户端配置,然后把前置http加到outbounds中

@darkelf123
Copy link
Author

先用自定义配置实现 就是普通节点前置一个http代理, 你可以先把正常的节点导出成客户端配置,然后把前置http加到outbounds中

我在导出的配置中修改加入了http代理,不知道对不对?在63到70行:{
"policy": {
"system": {
"statsOutboundUplink": true,
"statsOutboundDownlink": true
}
},
"log": {
"access": "",
"error": "",
"loglevel": "warning"
},
"inbounds": [
{
"tag": "socks",
"port": 10808,
"listen": "127.0.0.1",
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"auth": "noauth",
"udp": true,
"allowTransparent": false
}
},
{
"tag": "http",
"port": 10809,
"listen": "127.0.0.1",
"protocol": "http",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"auth": "noauth",
"udp": true,
"allowTransparent": false
}
},
{
"tag": "api",
"port": 54370,
"listen": "127.0.0.1",
"protocol": "dokodemo-door",
"settings": {
"udp": false,
"address": "127.0.0.1",
"allowTransparent": false
}
}
],
"outbounds": [
{
"type": "http",
"tag": "g-16433",
"server": "10.51.1.230",
"server_port": 8008,
"username": "user",
"password": "password"
},
{
"tag": "proxy",
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "example.com",
"port": 555,
"users": [
{
"id": "example",
"alterId": 0,
"email": "[email protected]",
"security": "auto"
}
]
}
]
},
"streamSettings": {
"network": "tcp"
},
"mux": {
"enabled": true,
"concurrency": 8
}
},
{
"tag": "direct",
"protocol": "freedom",
"settings": {}
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
}
}
],
"stats": {},
"api": {
"tag": "api",
"services": [
"StatsService"
]
},
"dns": {
"servers": [
"8.8.4.4",
"8.8.8.8"
]
},
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"inboundTag": [
"api"
],
"outboundTag": "api",
"enabled": true
},
{
"type": "field",
"outboundTag": "proxy",
"domain": [
"geosite:google"
],
"enabled": true
},
{
"type": "field",
"outboundTag": "direct",
"domain": [
"domain:example-example.com",
"domain:example-example2.com"
],
"enabled": true
},
{
"type": "field",
"outboundTag": "block",
"domain": [
"geosite:category-ads-all"
],
"enabled": true
}
]
}
}

@2dust
Copy link
Owner

2dust commented Mar 29, 2024

大概这样,你可以去文档里面找 dialerProxy

{
    "policy": {
        "system": {
            "statsOutboundUplink": true,
            "statsOutboundDownlink": true
        }
    },
    "log": {
        "access": "",
        "error": "",
        "loglevel": "warning"
    },
    "inbounds": [
        {
            "tag": "socks",
            "port": 10808,
            "listen": "127.0.0.1",
            "protocol": "socks",
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "http",
                    "tls"
                ]
            },
            "settings": {
                "auth": "noauth",
                "udp": true,
                "allowTransparent": false
            }
        },
        {
            "tag": "http",
            "port": 10809,
            "listen": "127.0.0.1",
            "protocol": "http",
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "http",
                    "tls"
                ]
            },
            "settings": {
                "auth": "noauth",
                "udp": true,
                "allowTransparent": false
            }
        },
        {
            "tag": "api",
            "port": 54370,
            "listen": "127.0.0.1",
            "protocol": "dokodemo-door",
            "settings": {
                "udp": false,
                "address": "127.0.0.1",
                "allowTransparent": false
            }
        }
    ],
    "outbounds": [
      
        {
            "tag": "proxy",
            "protocol": "vmess",
            "settings": {
                "vnext": [
                    {
                        "address": "example.com",
                        "port": 555,
                        "users": [
                            {
                                "id": "example",
                                "alterId": 0,
                                "email": "[email protected]",
                                "security": "auto"
                            }
                        ]
                    }
                ]
            },
            "streamSettings": {
                "network": "tcp",
                "sockopt": {
                    "dialerProxy": "g-16433"  
                }
            },
            "mux": {
                "enabled": true,
                "concurrency": 8
            }
        },
        {
            "type": "http",
            "tag": "g-16433",
            "server": "10.51.1.230",
            "server_port": 8008,
            "username": "user",
            "password": "password"
        },
        {
            "tag": "direct",
            "protocol": "freedom",
            "settings": {}
        },
        {
            "tag": "block",
            "protocol": "blackhole",
            "settings": {
                "response": {
                    "type": "http"
                }
            }
        }
    ],
    "stats": {},
    "api": {
        "tag": "api",
        "services": [
            "StatsService"
        ]
    },
    "dns": {
        "servers": [
            "8.8.4.4",
            "8.8.8.8"
        ]
    },
    "routing": {
        "domainStrategy": "AsIs",
        "rules": [
            {
                "type": "field",
                "inboundTag": [
                    "api"
                ],
                "outboundTag": "api",
                "enabled": true
            },
            {
                "type": "field",
                "outboundTag": "proxy",
                "domain": [
                    "geosite:google"
                ],
                "enabled": true
            },
            {
                "type": "field",
                "outboundTag": "direct",
                "domain": [
                    "domain:example-example.com",
                    "domain:example-example2.com"
                ],
                "enabled": true
            },
            {
                "type": "field",
                "outboundTag": "block",
                "domain": [
                    "geosite:category-ads-all"
                ],
                "enabled": true
            }
        ]
    }
}

@darkelf123
Copy link
Author

谢谢指导,我去研究一下

@Mapaler
Copy link

Mapaler commented Apr 14, 2024

不是订阅的,自建的不能用吗?

@2dust
Copy link
Owner

2dust commented Apr 14, 2024

不是订阅的,自建的不能用吗?

自建的加入到一个分组中即可

@youngerliyg
Copy link

youngerliyg commented May 9, 2024

大概这样,你可以去文档里面找 dialerProxy

请问一下,在v2rayN.exe的图形界面中服务器配置没找到配置这个选项的地方,所以就手动去修改guiConfigs/config.json. 但是
我手动修改了guiConfigs/config.json (添加dialerProxy部分),但是一运行v2rayN.exe就把我手动增加的部分给覆盖没了。请问是去手动修改guiConfig/config.json,还是其他配置文件?如何避免这个运行v2rayN.exe就覆盖guiConfigs/config.jaon我自己修改内容的问题?谢谢

@Mapaler
Copy link

Mapaler commented May 9, 2024

大概这样,你可以去文档里面找 dialerProxy

请问一下,在v2rayN.exe的图形界面中服务器配置没找到配置这个选项的地方,所以就手动去修改guiConfigs/config.json. 但是 我手动修改了guiConfigs/config.json (添加dialerProxy部分),但是一运行v2rayN.exe就把我手动增加的部分给覆盖没了。请问是去手动修改guiConfig/config.json,还是其他配置文件?如何避免这个运行v2rayN.exe就覆盖guiConfigs/config.jaon我自己修改内容的问题?谢谢

复制一份改个名字,然后用命令行启动。
TotalCMD64_g60j79TtXn

就是非得复制一份geoip.datgeoip.dat到程序文件夹才能启动,不知道 v2rayN 是怎么启动的。

@youngerliyg
Copy link

感谢有帮助的信息分享 👍🏻

目前我用dokodemo的方式在原生 v2rayCore的配置文件中实现了前置代理(就是v2rayCore 的流量先经过一个http proxy再连接提供 VMESS的服务器),看到最新版本v2rayN最新版本“添加出站 HTTP 支持(可以做为分组的前置代理)https://github.com/2dust/v2rayN/issues/4896”,但是在v2rayN配置界面上却找不到对应位置,无奈只好手动修改config.json.

再次感谢分享帮助👍🏻

复制一份改个名字,然后用命令行启动。
就是非得复制一份geoip.datgeoip.dat到程序文件夹才能启动,不知道 v2rayN 是怎么启动的。

@2dust
Copy link
Owner

2dust commented May 12, 2024

感谢有帮助的信息分享 👍🏻

目前我用dokodemo的方式在原生 v2rayCore的配置文件中实现了前置代理(就是v2rayCore 的流量先经过一个http proxy再连接提供 VMESS的服务器),看到最新版本v2rayN最新版本“添加出站 HTTP 支持(可以做为分组的前置代理)https://github.com/2dust/v2rayN/issues/4896”,但是在v2rayN配置界面上却找不到对应位置,无奈只好手动修改config.json.

再次感谢分享帮助👍🏻

复制一份改个名字,然后用命令行启动。
就是非得复制一份geoip.datgeoip.dat到程序文件夹才能启动,不知道 v2rayN 是怎么启动的。

新建一个http出站,
然后新建一个分组,把你要用的节点加入到这个分组中;分组设置中有个前置代理,把上面的http出站名称填进去,这样就行了

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

No branches or pull requests

5 participants