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

WSL2 system_proxy-to-env_var translation fails to translate 127.0.0.1, making local proxy unreachable #10379

Closed
1 of 2 tasks
Artoria2e5 opened this issue Aug 10, 2023 · 32 comments

Comments

@Artoria2e5
Copy link

Artoria2e5 commented Aug 10, 2023

Windows Version

Microsoft Windows [Version 10.0.22631.2129]

WSL Version

1.3.15.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.90.4-microsoft-standard-WSL2 (root@4b885f886b45)

Distro Version

Debian GNU/Linux trixie/sid

Other Software

Clash For Windows, v0.20.12

Repro Steps

  1. Use CFW to set up a local socks + http proxy.
  2. Tick the "system proxy" box in CFW to make it change Windows proxy settings.
  3. Launch WSL2.
  4. Run apt update.

Expected Behavior

apt update should go through my proxy.

Actual Behavior

Output similar to

E: Failed to fetch http://mirrors.ustc.edu.cn/debian/pool/main/a/aalib/libaa1_1.4p5-50_amd64.deb  Unable to connect to 127.0.0.1:7890:

Diagnostic Logs

This part is not useful. What is useful is:

$ env | grep 7890
https_proxy=http://127.0.0.1:7890
HTTPS_PROXY=http://127.0.0.1:7890
HTTP_PROXY=http://127.0.0.1:7890
http_proxy=http://127.0.0.1:7890

See? WSL took the Windows proxy settings into Debian, but forgot that 127.0.0.1 means something else here. The snippet in /etc/profile.d/proxy.sh fixes the problem in shell, but not in WSL VSCode:

unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY
export all_proxy="socks5://127.27.16.1:7890"

Recommended fix

All forms of localhost, [::1], 127.0.0.1 should be replaced with a reference to the parent machine, preferably using a hostname, and not this ad-hoc nameserver trick currently documented.

$HOSTNAME.local is almost sufficient: my Windows hostname being "Arisu", running nslookup arisu.local and nslookup arisu does correctly return the needed name 127.27.16.1, except also returns a lot of useless addresses for other Windows network adapters like "192.168.56.1", "192.168.53.2", "172.19.64.1", and finally my LAN "10.0.1.212".

@Artoria2e5 Artoria2e5 changed the title WSL2 system_proxy-to-env_var translation fails to translate 127.0.0.1 WSL2 system_proxy-to-env_var translation fails to translate 127.0.0.1, making local proxy unreachable Aug 10, 2023
@tohsaka888
Copy link

image

I face the same problem.I must manually edit .zshrc and add following config.

unset http_proxy
unset https_proxy
unset HTTP_PROXY
unset HTTPS_PROXY

Now i can use the proxy,but i don't want to use this way to solve the problem,because i can't deal with vscode plugins using this way.

@Artoria2e5
Copy link
Author

Same -- shell works, but copilot chokes.

@Rollinon
Copy link

I had the same problem.

@ghost
Copy link

ghost commented Aug 15, 2023

I'm a little fuzzy on details here? Is the proxy running on the host(windows)? And you want to access the proxy from the guest(WSL)?

@Rollinon
Copy link

Yes, if you open the Clash system proxy on Windows, wsl will automatically set the environment variable to http://127.0.0.1:7890, https://127.0.0.1:7890. so you cannot access the windows proxy from wsl. For example, you must manually set http://172.30.192.1:7890, https://172.30.192.1:7890 on wsl to override the environment variables automatically set for wsl to use the proxy on windows through LAN.

@tohsaka888
Copy link

I'm a little fuzzy on details here? Is the proxy running on the host(windows)? And you want to access the proxy from the guest(WSL)?

Yes.I set proxy using Clash for Windows,and i want to use access it in WSL.The question is that i don't set http_proxy and https_proxy in WSL,it seems that WSL will auto set these env, eg http_proxy = 127.0.0.1:7890, because of this, i can't visit any website.I must manul unset these env.

@tohsaka888
Copy link

Yes, if you open the Clash system proxy on Windows, wsl will automatically set the environment variable to http://127.0.0.1:7890, https://127.0.0.1:7890. so you cannot access the windows proxy from wsl. For example, you must manually set http://172.30.192.1:7890, https://172.30.192.1:7890 on wsl to override the environment variables automatically set for wsl to use the proxy on windows through LAN.

That's it.I found that when i unset http_proxy and https_proxy, i can also use the proxy, so maybe WSL don't need set these env any more now,but in vscode,plugins can not visit any website,such as Source Control,i want know how can i fix it.

@Artoria2e5
Copy link
Author

Artoria2e5 commented Aug 16, 2023

I'm a little fuzzy on details here? Is the proxy running on the host(windows)? And you want to access the proxy from the guest(WSL)?

Yes and yes. It's not uncommon for us in China to speak some weird censorship-resistant proxy protocol over the Internet, but to make them usable by local programs you got to translate it down to SOCKS.1 And to make the whole system respect the thing, you need to change the system proxy settings -- because Windows wants HTTP, you run an additional HTTP proxy over the SOCKS.2 We have neat little graphical tools to both run the local proxy and change system settings like "Clash for Windows".

1 You could of course pretend that the SOCKS is a tunnel adapter, but that doesn't quite work like a real adapter (think VPN) because SOCKS only does TCP and UDP -- you don't get things like ICMP.
2 Clash is a bit special in that it can multiplex HTTP and SOCKS on the same port, so it's all port 7890 here.


Some words of clarification. Other people have answered the question well already.

Yes, if you open the Clash system proxy on Windows

"open" is supposed to be "enable". Same word for "open" "turn on" in Chinese. See https://en.wiktionary.org/wiki/%E6%89%93%E9%96%8B#Chinese.

@microsoft-github-policy-service
Copy link
Contributor

This issue has been automatically closed since it has not had any author activity for the past 7 days. If you're still experiencing this issue please re-open it.

Thank you!

@ghost ghost reopened this Aug 23, 2023
@Artoria2e5
Copy link
Author

Bruv...

@tohsaka888
Copy link

Any solution now?

@labmemzzf

This comment was marked as off-topic.

@labmemzzf
Copy link

Yes, if you open the Clash system proxy on Windows, wsl will automatically set the environment variable to http://127.0.0.1:7890, https://127.0.0.1:7890. so you cannot access the windows proxy from wsl. For example, you must manually set http://172.30.192.1:7890, https://172.30.192.1:7890 on wsl to override the environment variables automatically set for wsl to use the proxy on windows through LAN.

That's it.I found that when i unset http_proxy and https_proxy, i can also use the proxy, so maybe WSL don't need set these env any more now,but in vscode,plugins can not visit any website,such as Source Control,i want know how can i fix it.

@tohsaka888 听着很像WSL1,你确定你的WSL版本是2而不是1吗?我记得以前用WSL1的时候就是这样,windows开着代理,WSL1的流量就会自动走代理,根本不用配置,应该是WSL1存在某种机制,访问宿主机的端口就像访问自己本地的端口一样,但是这个机制在WSL2被砍掉了。powershell中运行一下命令wsl --list --verbose看看你的WSL版本,先确定了版本,再来解决问题。

@tohsaka888 Sounds just like WSL1, are you sure your WSL version is 2 and not 1? I remember this was the case with WSL1, when windows runs the proxy software, internet traffic from WSL1 will automatically go to the proxy, no configuration at all. There should be a mechanism in WSL1, allow access the host port like own local port, however this mechanism was cut in WSL2. Run wsl --list --verbose in powershell to check your WSL version at first, then suit the remedy to the case.

@Artoria2e5
Copy link
Author

Artoria2e5 commented Sep 15, 2023

Why do you just have to write some incoherent machine-translated comment?

总的来说你要把访问宿主机当作访问局域网中的电脑来看待。

OF COURSE I KNOW WSL2 makes a local network. That's the whole reason why I am requesting a translation, because an address other than 127.0.0.1 is needed. I have done manual translations that work, but it should be automated, because the feature is otherwise broken.

当你使用sudo指令的时候已经切换到root用户空间

First of all, I've managed to make it work, so I'm suffering from none of these user issues. Secondly, my WSL opens straight to root. What sudo?

听着很像WSL1,你确定你的WSL版本是2而不是1吗?

Yes that's the problematic translation mechanism.


Your condescending "advice" only shows that you don't understand the situation. Take this stuff somewhere else.

@Aloento
Copy link

Aloento commented Sep 15, 2023

😅好好好,@Artoria2e5 要这么玩是吧😅

@labmemzzf
Copy link

Sorry, I make all misunderstand. I promise to remove the irrelevant answer comment as soon as possible.

In addition,

Sounds just like WSL1, are you sure your WSL version is 2 and not 1?

I means user @tohsaka888 is probably in the WSL1 operating environment. The advice is
only for him, because of his description.

@Artoria2e5
Copy link
Author

Artoria2e5 commented Sep 16, 2023

tohsaka888 is obviously in WSL2 because he described being unable to reach 127.0.0.1:7890. He confirmed that Rollinon's solution, which is WSL2-only, works, for Fred's sake.

In other news, I've found a way to clear that env var in vscode:

HOST=$(grep nameserver /etc/resolv.conf | cut -d ' ' -f 2)
sed -i -e '2i unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY' -e "3i export all_proxy='socks5://$HOST:7890'" .vscode-server/bin/*/bin/code-server

That changes the code-server shell script to unset the variables explicitly. The all_proxy export should also fix copilot (& chat), because vscode, like chromium, takes proxies from env var. You will need to re-run it for each upgrade.

Do make sure your VPN exit node is not blocked by copilot. I tried it on copilot chat and it took it quite a while.


Oooohh thumbs down! very scary!

@tohsaka888
Copy link

Sorry, I make all misunderstand. I promise to remove the irrelevant answer comment as soon as possible.

In addition,

Sounds just like WSL1, are you sure your WSL version is 2 and not 1?

I means user @tohsaka888 is probably in the WSL1 operating environment. The advice is only for him, because of his description.

Thanks for your advice, but i am acturally in WSL2, and i found some solution now.

Edit bashrc or zshrc :

export all_proxy=""
export http_proxy=""
export https_proxy=""
export HTTP_PROXY=""
export HTTPS_PROXY=""

and type env to verify.

HTTPS_PROXY=
HTTP_PROXY=

Then, we can use vscode plugin without any error.

@zid99825
Copy link

zid99825 commented Oct 24, 2023

Maybe set networkingMode to "mirrored" in .wslconfig could resolve this issue

read this Advanced settings configuration in WSL

@tohsaka888
Copy link

Maybe set networkingMode to "mirrored" in .wslconfig could resolve this issue

read this Advanced settings configuration in WSL

I'm sorry, but it doesn't work for me.

@tohsaka888
Copy link

Maybe set networkingMode to "mirrored" in .wslconfig could resolve this issue

read this Advanced settings configuration in WSL

When i use Vscode Plugins,it will show this error:

Failed to establish a socket connection to proxies: ["PROXY 127.0.0.1:7890"]

and here is my .wslconfig

# Settings apply across all Linux distros running on WSL 2
[wsl2]

# Limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB
memory=8GB 

# Sets amount of swap storage space to 8GB, default is 25% of available RAM
swap=8GB

# Turn off default connection to bind WSL 2 localhost to Windows localhost
localhostforwarding=true

# Disables nested virtualization
nestedVirtualization=true

[experimental]
# If the value is mirrored then this turns on mirrored networking mode. Default or unrecognized strings result in NAT networking.
networkingMode=mirrored

# Enforces WSL to use Windows’ HTTP proxy information
autoProxy=false

# Automatically releases cached memory after detecting idle CPU usage. Set to gradual for slow release, and dropcache for instant release of cached memory.
autoMemoryReclaim=gradual

# When set to true, any newly created VHD will be set to sparse automatically.
sparseVhd=true

dnsTunneling=true

hostAddressLoopback=true

@zid99825
Copy link

zid99825 commented Nov 1, 2023

Maybe set networkingMode to "mirrored" in .wslconfig could resolve this issue
read this Advanced settings configuration in WSL

When i use Vscode Plugins,it will show this error:

Failed to establish a socket connection to proxies: ["PROXY 127.0.0.1:7890"]

and here is my .wslconfig

# Settings apply across all Linux distros running on WSL 2
[wsl2]

# Limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB
memory=8GB 

# Sets amount of swap storage space to 8GB, default is 25% of available RAM
swap=8GB

# Turn off default connection to bind WSL 2 localhost to Windows localhost
localhostforwarding=true

# Disables nested virtualization
nestedVirtualization=true

[experimental]
# If the value is mirrored then this turns on mirrored networking mode. Default or unrecognized strings result in NAT networking.
networkingMode=mirrored

# Enforces WSL to use Windows’ HTTP proxy information
autoProxy=false

# Automatically releases cached memory after detecting idle CPU usage. Set to gradual for slow release, and dropcache for instant release of cached memory.
autoMemoryReclaim=gradual

# When set to true, any newly created VHD will be set to sparse automatically.
sparseVhd=true

dnsTunneling=true

hostAddressLoopback=true

Please check ip address in wsl, i think it need to be same with your host.

@JasonHe-WQ
Copy link

I do have this same problem. And I tried to fix it in a not elegant way.

I edited .bashrc to this:

# add proxy
export hostip=$(ip route | grep default | awk '{print $3}')
export socks_hostport=7890
export http_hostport=7890
alias proxy='
    unset ALL_PROXY
    unset HTTPS_PROXY
    unset https_proxy
    unset HTTP_PROXY
    unset http_proxy
    unset all_proxy
    export https_proxy="http://${hostip}:${http_hostport}"
    export http_proxy="http://${hostip}:${http_hostport}"
    export ALL_PROXY="socks5://${hostip}:${socks_hostport}"
    export all_proxy="socks5://${hostip}:${socks_hostport}"
'
alias unproxy='
    unset ALL_PROXY
    unset HTTPS_PROXY
    unset https_proxy
    unset HTTP_PROXY
    unset http_proxy
    unset all_proxy
'
alias echoproxy='
    echo $ALL_PROXY
    echo $all_proxy
    echo $https_proxy
    echo $http_proxy
'

unproxy
#end proxy

在官方有结果之前,这样似乎是一个办法
@tohsaka888

@Artoria2e5
Copy link
Author

Please check ip address in wsl, i think it need to be same with your host.

Mirrored 的目的就是不用折腾这个。

in a not elegant way.

又绕回老办法了(笑)。至少比我 issue description 里面硬写 ip 好,但是建议

  • 直接送进 /etc/profile 免得换用户麻烦
  • proxy(){ } 而不是 alias 做这种多个命令的事情

说起来 @tohsaka888,用 sed 硬改 code-server 脚本试过了吗?

@zid99825
Copy link

zid99825 commented Nov 2, 2023

Please check ip address in wsl, i think it need to be same with your host.

Mirrored 的目的就是不用折腾这个。

in a not elegant way.

又绕回老办法了(笑)。至少比我 issue description 里面硬写 ip 好,但是建议

  • 直接送进 /etc/profile 免得换用户麻烦
  • proxy(){ } 而不是 alias 做这种多个命令的事情

说起来 @tohsaka888,用 sed 硬改 code-server 脚本试过了吗?

Mirrored 的结果是为了保持ip和主机一致啊,如果没生效后面的也没必要查了,至少我这mirrored加上hostAddressLoopback=true后,vscode server不会有问题😂

@JasonHe-WQ
Copy link

Please check ip address in wsl, i think it need to be same with your host.

Mirrored 的目的就是不用折腾这个。

in a not elegant way.

又绕回老办法了(笑)。至少比我 issue description 里面硬写 ip 好,但是建议

  • 直接送进 /etc/profile 免得换用户麻烦
  • proxy(){ } 而不是 alias 做这种多个命令的事情

说起来 @tohsaka888,用 sed 硬改 code-server 脚本试过了吗?

Mirrored 的结果是为了保持ip和主机一致啊,如果没生效后面的也没必要查了,至少我这mirrored加上hostAddressLoopback=true后,vscode server不会有问题😂

同,我最后使用mirror解决了,剩下的不会😢

又绕回老办法了(笑)。至少比我 issue description 里面硬写 ip 好,但是建

这里还有一个小坑😣,使用Goland的之类IDE的时候,如果使用测试用例,还是会走127.0.0.1:7890,如下面的报错

=== RUN TestBiliBili_GetMetadataByCrawl
=== RUN TestBiliBili_GetMetadataByCrawl/bilibili_video
bilibili_test.go:98: BiliBili.GetMetadataByCrawl() error = Get "https://api.bilibili.com/x/web-interface/view?bvid=BV1xx411c7m9": proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused, wantErr false
=== RUN TestBiliBili_GetMetadataByCrawl/bilibili_user
bilibili_test.go:98: BiliBili.GetMetadataByCrawl() error = Get "https://api.bilibili.com/x/space/acc/info?mid=2": proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused, wantErr false
--- FAIL: TestBiliBili_GetMetadataByCrawl (0.01s)
--- FAIL: TestBiliBili_GetMetadataByCrawl/bilibili_video (0.01s)

@tohsaka888
Copy link

Please check ip address in wsl, i think it need to be same with your host.

Mirrored 的目的就是不用折腾这个。

in a not elegant way.

又绕回老办法了(笑)。至少比我 issue description 里面硬写 ip 好,但是建议

  • 直接送进 /etc/profile 免得换用户麻烦
  • proxy(){ } 而不是 alias 做这种多个命令的事情

说起来 @tohsaka888,用 sed 硬改 code-server 脚本试过了吗?

没有,我目前也是用了一种不太优雅的方法解决的。

我在上层路由固定了本机的IP地址,然后在vscode中Http: Proxy设置为固定的ip + 7890端口。

image

通过这种方式,vscode插件确实可以联网了,并且可以使用本机代理,非常的不优雅,但是有用,😂

@tohsaka888
Copy link

Please check ip address in wsl, i think it need to be same with your host.

Mirrored 的目的就是不用折腾这个。

in a not elegant way.

又绕回老办法了(笑)。至少比我 issue description 里面硬写 ip 好,但是建议

  • 直接送进 /etc/profile 免得换用户麻烦
  • proxy(){ } 而不是 alias 做这种多个命令的事情

说起来 @tohsaka888,用 sed 硬改 code-server 脚本试过了吗?

Mirrored 的结果是为了保持ip和主机一致啊,如果没生效后面的也没必要查了,至少我这mirrored加上hostAddressLoopback=true后,vscode server不会有问题😂

同,我最后使用mirror解决了,剩下的不会😢

又绕回老办法了(笑)。至少比我 issue description 里面硬写 ip 好,但是建

这里还有一个小坑😣,使用Goland的之类IDE的时候,如果使用测试用例,还是会走127.0.0.1:7890,如下面的报错

=== RUN TestBiliBili_GetMetadataByCrawl
=== RUN TestBiliBili_GetMetadataByCrawl/bilibili_video
bilibili_test.go:98: BiliBili.GetMetadataByCrawl() error = Get "https://api.bilibili.com/x/web-interface/view?bvid=BV1xx411c7m9": proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused, wantErr false
=== RUN TestBiliBili_GetMetadataByCrawl/bilibili_user
bilibili_test.go:98: BiliBili.GetMetadataByCrawl() error = Get "https://api.bilibili.com/x/space/acc/info?mid=2": proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused, wantErr false
--- FAIL: TestBiliBili_GetMetadataByCrawl (0.01s)
--- FAIL: TestBiliBili_GetMetadataByCrawl/bilibili_video (0.01s)

兄弟,你直接.wslconfig改成mirror就可以了吗,我记得我改成mirror之后vscode插件还是无法联网😂

@JasonHe-WQ
Copy link

Please check ip address in wsl, i think it need to be same with your host.

Mirrored 的目的就是不用折腾这个。

in a not elegant way.

又绕回老办法了(笑)。至少比我 issue description 里面硬写 ip 好,但是建议

  • 直接送进 /etc/profile 免得换用户麻烦
  • proxy(){ } 而不是 alias 做这种多个命令的事情

说起来 @tohsaka888,用 sed 硬改 code-server 脚本试过了吗?

Mirrored 的结果是为了保持ip和主机一致啊,如果没生效后面的也没必要查了,至少我这mirrored加上hostAddressLoopback=true后,vscode server不会有问题😂

同,我最后使用mirror解决了,剩下的不会😢

又绕回老办法了(笑)。至少比我 issue description 里面硬写 ip 好,但是建

这里还有一个小坑😣,使用Goland的之类IDE的时候,如果使用测试用例,还是会走127.0.0.1:7890,如下面的报错

=== RUN TestBiliBili_GetMetadataByCrawl
=== RUN TestBiliBili_GetMetadataByCrawl/bilibili_video
bilibili_test.go:98: BiliBili.GetMetadataByCrawl() error = Get "https://api.bilibili.com/x/web-interface/view?bvid=BV1xx411c7m9": proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused, wantErr false
=== RUN TestBiliBili_GetMetadataByCrawl/bilibili_user
bilibili_test.go:98: BiliBili.GetMetadataByCrawl() error = Get "https://api.bilibili.com/x/space/acc/info?mid=2": proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused, wantErr false
--- FAIL: TestBiliBili_GetMetadataByCrawl (0.01s)
--- FAIL: TestBiliBili_GetMetadataByCrawl/bilibili_video (0.01s)

兄弟,你直接.wslconfig改成mirror就可以了吗,我记得我改成mirror之后vscode插件还是无法联网😂

请问能不能具体说一下你遇到的问题,我没有太明白你说的问题,因为我使用Goland🤣

我记得在powershell中输入下面命令

 $Env:http_proxy="http://127.0.0.1:7890";$Env:https_proxy="http://127.0.0.1:7890"

可以解决大部分问题

@zid99825
Copy link

zid99825 commented Nov 8, 2023

Please check ip address in wsl, i think it need to be same with your host.

Mirrored 的目的就是不用折腾这个。

in a not elegant way.

又绕回老办法了(笑)。至少比我 issue description 里面硬写 ip 好,但是建议

  • 直接送进 /etc/profile 免得换用户麻烦
  • proxy(){ } 而不是 alias 做这种多个命令的事情

说起来 @tohsaka888,用 sed 硬改 code-server 脚本试过了吗?

Mirrored 的结果是为了保持ip和主机一致啊,如果没生效后面的也没必要查了,至少我这mirrored加上hostAddressLoopback=true后,vscode server不会有问题😂

同,我最后使用mirror解决了,剩下的不会😢

又绕回老办法了(笑)。至少比我 issue description 里面硬写 ip 好,但是建

这里还有一个小坑😣,使用Goland的之类IDE的时候,如果使用测试用例,还是会走127.0.0.1:7890,如下面的报错

=== RUN TestBiliBili_GetMetadataByCrawl
=== RUN TestBiliBili_GetMetadataByCrawl/bilibili_video
bilibili_test.go:98: BiliBili.GetMetadataByCrawl() error = Get "https://api.bilibili.com/x/web-interface/view?bvid=BV1xx411c7m9": proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused, wantErr false
=== RUN TestBiliBili_GetMetadataByCrawl/bilibili_user
bilibili_test.go:98: BiliBili.GetMetadataByCrawl() error = Get "https://api.bilibili.com/x/space/acc/info?mid=2": proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused, wantErr false
--- FAIL: TestBiliBili_GetMetadataByCrawl (0.01s)
--- FAIL: TestBiliBili_GetMetadataByCrawl/bilibili_video (0.01s)

兄弟,你直接.wslconfig改成mirror就可以了吗,我记得我改成mirror之后vscode插件还是无法联网😂

hostAddressLoopback设了吗

@tohsaka888
Copy link

Please check ip address in wsl, i think it need to be same with your host.

Mirrored 的目的就是不用折腾这个。

in a not elegant way.

又绕回老办法了(笑)。至少比我 issue description 里面硬写 ip 好,但是建议

  • 直接送进 /etc/profile 免得换用户麻烦
  • proxy(){ } 而不是 alias 做这种多个命令的事情

说起来 @tohsaka888,用 sed 硬改 code-server 脚本试过了吗?

Mirrored 的结果是为了保持ip和主机一致啊,如果没生效后面的也没必要查了,至少我这mirrored加上hostAddressLoopback=true后,vscode server不会有问题😂

同,我最后使用mirror解决了,剩下的不会😢

又绕回老办法了(笑)。至少比我 issue description 里面硬写 ip 好,但是建

这里还有一个小坑😣,使用Goland的之类IDE的时候,如果使用测试用例,还是会走127.0.0.1:7890,如下面的报错

=== RUN TestBiliBili_GetMetadataByCrawl
=== RUN TestBiliBili_GetMetadataByCrawl/bilibili_video
bilibili_test.go:98: BiliBili.GetMetadataByCrawl() error = Get "https://api.bilibili.com/x/web-interface/view?bvid=BV1xx411c7m9": proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused, wantErr false
=== RUN TestBiliBili_GetMetadataByCrawl/bilibili_user
bilibili_test.go:98: BiliBili.GetMetadataByCrawl() error = Get "https://api.bilibili.com/x/space/acc/info?mid=2": proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused, wantErr false
--- FAIL: TestBiliBili_GetMetadataByCrawl (0.01s)
--- FAIL: TestBiliBili_GetMetadataByCrawl/bilibili_video (0.01s)

兄弟,你直接.wslconfig改成mirror就可以了吗,我记得我改成mirror之后vscode插件还是无法联网😂

hostAddressLoopback设了吗
可以了,我改完忘记保存了,焯

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

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

7 participants