增加本地节点Hash辅助判断信息

This commit is contained in:
wyx2685
2024-02-06 20:26:30 +09:00
parent 0d274bcf61
commit 73f9b19222
3 changed files with 16 additions and 7 deletions

View File

@@ -307,10 +307,8 @@ func extractPortFromAddr(addr string) int {
}
func formatAddress(ip string, port int) string {
// 检查 IP 地址是否为 IPv6
if strings.Contains(ip, ":") {
return fmt.Sprintf("[%s]:%d", ip, port)
}
// 对于 IPv4 地址,直接返回 IP:Port 格式
return fmt.Sprintf("%s:%d", ip, port)
}