我正在使用 Golang 库 cloud.google.com/go/logging 并希望发送运行时日志记录。
已经有一个 GOOGLE_APPLICATION_CREDENTIALS .json 文件 - 并且正在使用谷歌存储和 firebase - 所以我知道凭据正在工作。
通过日志记录,我收到错误“错误 403:调用者没有权限,禁止”
应用程序凭证中的帐户是一个服务帐户,我一直在查看 IAM 权限。没有明显的日志记录权限(还有其他堆栈驱动程序权限,用于调试、跟踪等,但这些似乎不起作用)。
因此,假设到目前为止我处于正确的位置 - 服务帐户需要什么权限才能将日志记录数据发送到 stackdriver 日志记录?
我在 64 位 Linux 上尝试编译 PHP --with-interbase=/opt/firebird
这导致
checking for InterBase support... yes
checking for isc_detach_database in -lfbclient... no
checking for isc_detach_database in -lgds... no
checking for isc_detach_database in -lib_util... no
configure: error: libgds, libib_util or libfbclient not found! Check config.log for more information.
Run Code Online (Sandbox Code Playgroud)
libfclient 等都在那里。查看 config.log,当它尝试检查 interbase 时,会出现很多错误:
configure:50792: gcc -o conftest -I/usr/include -g -O2 -fvisibility=hidden -pthread -D_REENTRANT -L/opt/firebird//lib -L/usr/lib -L/usr/local/lib conftest.c -lfbclient $
/opt/firebird//lib/libfbclient.so: undefined reference to `std::bad_alloc::~bad_alloc()'
/opt/firebird//lib/libfbclient.so: undefined reference to `__cxa_pure_virtual'
/opt/firebird//lib/libfbclient.so: undefined reference to `__cxa_rethrow' …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用股票代码在 nginx 中重定向:
server {
listen 80;
server_name www.example.com;
return 301 $scheme://example.com$request_uri;
}
Run Code Online (Sandbox Code Playgroud)
但出现此错误:
nginx unknown directive "return"
Nginx 是最新的,使用 apt install 安装在 ubuntu 上,而不是从源代码编译。
nginx version: nginx/1.19.0
built by gcc 9.3.0 (Ubuntu 9.3.0-10ubuntu2)
built with OpenSSL 1.1.0h 27 Mar 2018
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -m64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -march=native -mtune=native -fasynchronous-unwind-tables' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --error-log-path=/var/log/nginx/nginx_error --http-log-path=/var/log/nginx/nginx_log --user=nginx --group=nginx --sbin-path=/usr/local/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --with-http_ssl_module --with-file-aio --with-openssl=/src/openssl --with-poll_module --with-http_stub_status_module --with-http_v2_module --with-threads --with-zlib=/src/zlib-1.2.11 …Run Code Online (Sandbox Code Playgroud) 带有客户端和服务器的Golang应用程序。
服务器使用net.ListenUDP-客户端也使用net.ListenUDP,连接到服务器并发送带有服务器地址conn.WriteToUDP的数据包。
服务器使用ReadFromUDP接收数据包并获取返回地址。然后,使用此返回地址,它将大量数据包发送回客户端。
在本地计算机上同时运行客户端和服务器时,这可以完美运行。使用Wireshark,我可以检查UDP数据包,并查看它们包含源端口和目标端口-在应用程序中,我可以看到它们到达并且我的各种校验和测试表明数据是准确的。
然后,我将服务器从站点移到了远程计算机上。该应用程序停止工作。我可以成功地将第一条消息从客户端发送到服务器-很好。服务器将响应“向”客户端发送回-但客户端从未收到。
使用Wireshark,我可以看到数据包确实以正确的IP地址返回到本地计算机上。看来我的网络路由器已对传出数据包执行了NAT-并将正确的响应数据包重新寻址到内部IP。但是没有端口。
所以我有UDP数据包到达正确的机器上,但是没有端口-因此客户端应用程序没有收到它们。应用程序在ReadFromUDP上超时。
我不知道它是否相关,但是在本地计算机上,Wireshark将数据包标记为BT-uTP Utorrent数据包。当它们从远程服务器进入时,这就是我在Wireshark中看到的-请注意缺少端口。
有什么想法我可以解决这个问题。我不认为这是UDP打孔问题,因为尽管我正在通过NAT建立连接,但它与服务器而不是对等服务器建立连接。