gpt4 book ai didi

ubuntu - Golang http 服务器不响应 ipv6 请求

转载 作者:行者123 更新时间:2023-12-03 10:09:16 35 4
gpt4 key购买 nike

我的服务器在 Ubuntu 上运行。我可以从外部站点 ping 我的 IPv6 地址。
当我在 https://ipv6-test.com/validate.php 中测试我的域名时我检查了 AAAA DNS 记录、IPv6 DNS 服务器和 IPv6 Web 服务器。 IPv6 服务器的检查带有注释:“无法识别 Web 服务器”。
我的服务器代码:

package main

import (
"log"
"net/http"
)

func main() {
fs := http.FileServer(http.Dir("./html"))
http.Handle("/", fs)
err := http.ListenAndServe(":80", nil)
if err != nil {
log.Fatal(err)
}
}
就像这个问题 Golang IPv6 server ,我可以通过域名、IP 地址加载我的网页,但不能通过 IPv6 地址 (http://[2607:f1c0:1801:1b4::1])。
当我跑
sudo ss -6lp
我明白了

Netid State Recv-Q Send-Q Local Address:Port Peer Address:Porttcp LISTEN 0 128 *:http : users:(("go_webserver",pid=131015,fd=5))

me@localhost:~$ sudo netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 448 1.2.3.4:22 11.12.13.14:49978 ESTABLISHED
tcp6 0 0 :::10000 :::* LISTEN
tcp6 0 0 :::21 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN

最佳答案

您尝试从浏览器访问该站点的客户端计算机是否支持 ipv6?
您可以通过 ping6 google.com 查看?

关于ubuntu - Golang http 服务器不响应 ipv6 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65299594/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com