草庐IT

docker_engine_linux

全部标签

google-app-engine - 在 Go 中部署到 Google App Engine Standard 时如何获取 RemoteAddr(远程 IP 地址)

我想获取客户端/浏览器IP地址以限制我的GoogleAppEngineStandard/Go网络应用程序中未经身份验证的客户端。在已部署的应用程序中,r.RemoteAddr返回空字符串。枚举请求header(r.Header[string][]string)仅提供以下条目。Content-LengthX-Appengine-CitylatlongX-Appengine-RegionUpgrade-Insecure-RequestsAccept-LanguageX-Cloud-Trace-ContextX-Appengine-CountryX-Appengine-CityHostCac

google-app-engine - 如何在 Google App Engine Standard Env for Go 中获取 request.RemoteAddr 和 X-AppEngine-Country、Region 等的输出?

我有一个在GoogleAppEngine标准环境中运行的服务,该服务是用Go编写的,配置为在部署时使用最新的运行时(api_version:go1-当前为Go1.8)。在这项服务中,我出于各种目的检查请求header。funcextractHeaders(reshttp.ResponseWriter,req*http.Request){ctx:=appengine.NewContext(req)clientIPAddress,_,_:=net.SplitHostPort(req.RemoteAddr)//Outputisblankcountry:=req.Header.Get("X-A

http - 在 App Engine 的灵活环境中发出 HTTP Get 请求

我在AppEngine中使用FlexibleEnvironment我想在我的代码中发送HTTPGet请求。ctx:=appengine.NewContext(r)client:=urlfetch.Client(ctx)req,err:=http.NewRequest("GET","https://www.google.com/",nil)res,err:=client.Do(req)iferr!=nil{http.Error(w,err.Error(),http.StatusInternalServerError)return}fmt.Fprintf(w,"HTTPGETreturne

linux - 如何安装查找/内部位置

我正在尝试安装查找服务器,内部定位(https://github.com/schollz/find)(https://www.internalpositioning.com/)软件,它在RaspberryPi(3)上有一个服务器。安装通过使用golang进行,我不太清楚如何让go(lang)安装find包。在其他有用的安装页面(https://www.internalpositioning.com/server/)上给出的指示是安装go(我已经通过$sudoapt-getinstallgolang完成)并且确实告诉我我有go版本go1.7.4linux/arm(命令$goversion

linux - 使用 Go 在 Linux 中以编程方式安全地挂载网络位置

在Linux中,我可以像这样使用Go以编程方式挂载网络位置:funcmain(){varuser,passstringfmt.Println("username:")fmt.Scanln(&user)//ignoreerrorsforbrevityfmt.Println("password:")fmt.Scanln(&pass)cmd:=exec.Command("mount","-t","cifs","-o","username="+user+",password="+pass,"//server/dir","media/dir")cmd.Run()}问题:如果不使用sudo提升权限

linux - 避免解析 Xrandr 输出

我需要从xrandr获取信息到我的软件中。假设这就是我从xrandr-q输出的内容:Screen0:minimum8x8,current1920x1968,maximum32767x32767LVDS1connectedprimary1366x768+309+1200(normalleftinvertedrightxaxisyaxis)277mmx156mm1366x76860.02*+1360x76859.8059.961280x72060.001024x76860.001024x57660.00960x54060.00800x60060.3256.25864x48660.00640

linux - 尝试在 Windows 10 上为 Linux 构建 Go 代码时出错

我尝试使用CGO_ENABLED=1在Windows上构建Go代码。我有一个.bat文件setGOOS=linuxsetGOARCH=amd64setCGO_CFLAGS=-g-O2-wsetCGO_ENABLED=1gobuildmain.goconstants.gofunctions.go但是我得到错误:gcc_linux_amd64.c:Infunction'_cgo_sys_thread_start':gcc_linux_amd64.c:62:2:error:unknowntypename'sigset_t'sigset_tign,oset;^我该怎么办?我在任何地方都找不到这

go - 为什么 App Engine Flexible Enviroment 不允许 WebSockets 和 HTTP/2 流量?

我对WebSocket更感兴趣,但在阅读文档之后here,当我读到这篇文章时,我感到很惊讶:ThefollowingfeaturesarenotsupportedbyAppEngineflexibleenvironment:HTTP/2traffictothebackendservice,Websockets,HTTPrequeststhatdirectlyaccessinstances我打算用gorilla-websocket构建一个应用程序,但现在我已经阅读了这篇文章,但我不知道如何才能完成它。我了解WebSocket在AppEngine标准环境中不受支持,但为什么在灵活环境中不支

docker - golang 程序在 docker 之外运行良好,但在 dockerized 时以 0 退出

我有以下docker-compose.yml文件:version:"3.3"services:api:build:./apiexpose:-'8080'container_name:'api'ports:-"8080:8080"depends_on:-dbstdin_open:truetty:truenetworks:-api-netdb:build:./dbexpose:-'27017'container_name:'mongo'ports:-"27017:27017"networks:-api-netnetworks:api-net:driver:bridgeapi容器的Docke

google-app-engine - 如何配置 Google App Engine 不构建一些 Go 文件?

我正在尝试将一组GoogleTalk幻灯片部署到GoogleAppEngine。我的一些示例文件有意构建错误,但我无法将它们部署到GoogleAppEngine,因为它提示它们无法构建。我应该可以在我的app.yaml中设置nobuild_files:[some_regex],但它不起作用。由于vendor文件夹的另一个问题,我确实不得不切换到goapp工具进行部署,所以这可能是相关的,IDK。我尝试在我的Go文件顶部添加一个//+build!appengine来解决这个问题,但它似乎没有做任何事情。 最佳答案 将您的非编译代码放在