jjzjj

thrift-protocol

全部标签

Google 在 Golang 中的 Protocol Buffer

Go是否支持Google的ProtocolBuffer(ProtocolBuffer是一种语言中立、平台中立的可扩展机制,用于序列化结构化数据。) 最佳答案 用谷歌简单搜索(讽刺?)显示protobuf 关于Google在Golang中的ProtocolBuffer,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/38218655/

go - Thrift Compiler(0.9.3) 生成 Thrift 包中未定义的函数 thrift.PrependError

我使用thrift编译器(0.9.3)生成gen-go文件夹,同时编译器生成一个函数thrift.PrependError,在thrift包(git.apache.org/thrift.git/lib/go/thrift)。我应该使用thrift编译器(0.9.2)吗? 最佳答案 Thrift0.9.3中添加了Prependerror,并存在于当前代码库中:https://github.com/apache/thrift/blob/53dd39833a08ce33582e5ff31fa18bb4735d6731/lib/go/thr

Go - Web 服务器在同一端口上监听多个协议(protocol)(HTTP 和 RTMP)

我正在尝试在Go中实现RTMP协议(protocol)以配合我的Web应用程序,但是我似乎无法找到在同一端口上同时处理HTTP和RTMP的解决方案。这个想法是这样的。packagemainimport("fmt""io""net/http")funcmain(){http.HandleFunc("/",func(whttp.ResponseWriter,r*http.Request){io.WriteString(w,"Hello!")})http.HandleFunc("/rtmp",func(whttp.ResponseWriter,r*http.Request){//RTMPha

转到错误拨号 tcp : Protocol not available

当我尝试为restapiclint运行GO代码时出现错误:获取http://quotes.rest/qod.json:http:连接到代理时出错http://192.168.0.1:3128/:调用tcp192.168.0.1:3128:i/o超时此外,我在Goplayground中尝试了相同的代码。也出现了错误。可能是什么原因?我该如何解决这个问题?请帮我解决这个问题。我使用的代码是:-packagemainimport("net/http""fmt""io/ioutil")funcmain(){resp,er:=http.Get("http://quotes.rest/qod.js

json - Protocol Buffer 格式的匿名结构

给定这样一个Go结构:typeHousestruct{AddressstringRooms[]struct{NamestringWindowsintDoorsint}}或等效的JSON表示:{"address":"""rooms":[{"name":"""windows":0"doors":0}]}等效的ProtocolBuffer表示是什么?这或多或少是我想做的(尽管不是有效的Proto语法):messageHouse{stringaddress=1;repeatedmessage{stringname=3;int32windows=4;int32doors=5;}rooms=2;}

go - 获取 golang 的 Protocol Buffer 选项信息

ProtocolBuffer定义如下,TestMessage有两个选项msg_option_a和msg_option_b:syntax="proto3";packagegrpctest;optiongo_package="pb";import"google/protobuf/descriptor.proto";extendgoogle.protobuf.MessageOptions{int32msg_option_a=50011;int32msg_option_b=50012;}messageTestMessage{option(msg_option_a)=22;option(msg_

go - 如何使 thrift 0.8 build go 库?

我下载了thrift0.8tarball,我的GOROOT是“/home/alex/go”,应该修改什么以确保在编译thrift时构建了go库?目前运行./configure时得到.......BuildingPHPLibrary.........:noBuildingErlangLibrary......:yesBuildingGoLibrary..........:no(isthissayinggolibrarywon'tbebuilt?) 最佳答案 thrift还不支持Go1。配置脚本尝试找到旧的go命令来构建go库。conf

go - Apache Thrift 0.9.1 生成 golang 代码,参数 -r 不起作用

我用`thrift-0.9.1-r-gengoaaa.thrift`生成golang代码(注意:aaa.thrfit包括bbb.thrift,它定义了“Body”结构)参数-r似乎不起作用,在ttypes.go中找不到“Body”结构,但是当我尝试使用`thrift-0.9.1-r-genjavaaaa.thrift`有“Body.java”,如何生成包含文件的golang代码?(注:来自https://github.com/apache/thrift)我知道原因,namespacegoservice.demo导致问题 最佳答案 $

http - Golang 与 AWS S3 和 goamz 不支持的协议(protocol)方案 ""

我正在尝试使用goamz/s3将文件字节上传到S3AWSGo(语言)中的包。运行以下代码时:var(awsAuthaws.Authregionaws.Regionconnections3.S3bucket*s3.Bucket)funcinit(){//SetuptheAWSS3Connectionconfig.awsAuth=aws.Auth{AccessKey:os.Getenv("ACCESS_KEY"),//changethistoyoursSecretKey:os.Getenv("SECRET_KEY"),}fmt.Println("AWS:",awsAuth)region:=

go - 如何在 golang thrift 服务器中获取客户端的 IP

我正在用golang编写一个thrift服务,我想了解如何在处理函数上下文中获取客户端的IP地址。谢谢,亲爱的。 最佳答案 我想你正在使用这个GodocThriftlibrary.在您的问题中包含代码片段会很好;例如thriftserver的类型,handler定义等根据ThriftGolibrarydoc-func(p*TSocket)Addr()net.AddrReturnstheremoteaddressofthesocket.因此,如果您有权访问TSocket,那么您可以获得远程地址。