Documentation ¶
Overview ¶
Package httpagent is a generated protocol buffer package.
It is generated from these files:
msg.proto
It has these top-level messages:
HeaderEntry Request Response
Index ¶
- Variables
- func Close() error
- func HandleConn(conn net.Conn)
- func Start(host string, port int) (err error)
- type HeaderEntry
- func (*HeaderEntry) Descriptor() ([]byte, []int)
- func (this *HeaderEntry) Equal(that interface{}) bool
- func (m *HeaderEntry) GetKey() string
- func (m *HeaderEntry) GetValue() string
- func (this *HeaderEntry) GoString() string
- func (m *HeaderEntry) Marshal() (data []byte, err error)
- func (m *HeaderEntry) MarshalTo(data []byte) (int, error)
- func (*HeaderEntry) ProtoMessage()
- func (m *HeaderEntry) Reset()
- func (m *HeaderEntry) Size() (n int)
- func (this *HeaderEntry) String() string
- func (m *HeaderEntry) Unmarshal(data []byte) error
- type LockConn
- type Request
- func (*Request) Descriptor() ([]byte, []int)
- func (this *Request) Equal(that interface{}) bool
- func (m *Request) GetAccept() string
- func (m *Request) GetBody() []byte
- func (m *Request) GetHeaders() []*HeaderEntry
- func (m *Request) GetId() int32
- func (m *Request) GetMethod() string
- func (m *Request) GetResultPerPage() int32
- func (m *Request) GetUrl() string
- func (this *Request) GoString() string
- func (m *Request) Marshal() (data []byte, err error)
- func (m *Request) MarshalTo(data []byte) (int, error)
- func (*Request) ProtoMessage()
- func (m *Request) Reset()
- func (m *Request) Size() (n int)
- func (this *Request) String() string
- func (m *Request) Unmarshal(data []byte) error
- type Response
- func (*Response) Descriptor() ([]byte, []int)
- func (this *Response) Equal(that interface{}) bool
- func (m *Response) GetBody() []byte
- func (m *Response) GetHeaders() []*HeaderEntry
- func (m *Response) GetId() int32
- func (m *Response) GetIsRedirect() bool
- func (m *Response) GetIsReply() bool
- func (m *Response) GetLocation() string
- func (m *Response) GetStatusCode() int32
- func (this *Response) GoString() string
- func (m *Response) Marshal() (data []byte, err error)
- func (m *Response) MarshalTo(data []byte) (int, error)
- func (*Response) ProtoMessage()
- func (m *Response) Reset()
- func (m *Response) Size() (n int)
- func (this *Response) String() string
- func (m *Response) Unmarshal(data []byte) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidLengthMsg = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowMsg = fmt.Errorf("proto: integer overflow") )
Functions ¶
func HandleConn ¶
HandleConn reads requests and handle request in goroutines. It reads first 4 bytes as length of this frame and then read last bytes as protobuf stream. If you use netty, you can use LengthFieldPrepender(4) as the encoder.
Types ¶
type HeaderEntry ¶
type HeaderEntry struct { Key string `protobuf:"bytes,1,req,name=key" json:"key"` Value string `protobuf:"bytes,2,opt,name=value" json:"value"` }
proto2 doesn't support map type so use this trick
func (*HeaderEntry) Descriptor ¶
func (*HeaderEntry) Descriptor() ([]byte, []int)
func (*HeaderEntry) Equal ¶
func (this *HeaderEntry) Equal(that interface{}) bool
func (*HeaderEntry) GetKey ¶
func (m *HeaderEntry) GetKey() string
func (*HeaderEntry) GetValue ¶
func (m *HeaderEntry) GetValue() string
func (*HeaderEntry) GoString ¶
func (this *HeaderEntry) GoString() string
func (*HeaderEntry) Marshal ¶
func (m *HeaderEntry) Marshal() (data []byte, err error)
func (*HeaderEntry) ProtoMessage ¶
func (*HeaderEntry) ProtoMessage()
func (*HeaderEntry) Reset ¶
func (m *HeaderEntry) Reset()
func (*HeaderEntry) Size ¶
func (m *HeaderEntry) Size() (n int)
func (*HeaderEntry) String ¶
func (this *HeaderEntry) String() string
func (*HeaderEntry) Unmarshal ¶
func (m *HeaderEntry) Unmarshal(data []byte) error
type Request ¶
type Request struct { Id int32 `protobuf:"varint,1,req,name=id" json:"id"` Method string `protobuf:"bytes,2,req,name=method" json:"method"` Url string `protobuf:"bytes,3,req,name=url" json:"url"` Headers []*HeaderEntry `protobuf:"bytes,4,rep,name=headers" json:"headers,omitempty"` Accept string `protobuf:"bytes,5,opt,name=accept" json:"accept"` Body []byte `protobuf:"bytes,6,opt,name=body" json:"body"` ResultPerPage int32 `protobuf:"varint,7,opt,name=result_per_page" json:"result_per_page"` }
func (*Request) Descriptor ¶
func (*Request) GetHeaders ¶
func (m *Request) GetHeaders() []*HeaderEntry
func (*Request) GetResultPerPage ¶
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
type Response ¶
type Response struct { Id int32 `protobuf:"varint,1,req,name=id" json:"id"` StatusCode int32 `protobuf:"varint,2,req,name=statusCode" json:"statusCode"` IsReply bool `protobuf:"varint,3,req,name=isReply" json:"isReply"` Headers []*HeaderEntry `protobuf:"bytes,4,rep,name=headers" json:"headers,omitempty"` IsRedirect bool `protobuf:"varint,5,opt,name=isRedirect" json:"isRedirect"` Location string `protobuf:"bytes,6,opt,name=location" json:"location"` Body []byte `protobuf:"bytes,7,opt,name=body" json:"body"` }
func (*Response) Descriptor ¶
func (*Response) GetHeaders ¶
func (m *Response) GetHeaders() []*HeaderEntry
func (*Response) GetIsRedirect ¶
func (*Response) GetIsReply ¶
func (*Response) GetLocation ¶
func (*Response) GetStatusCode ¶
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
Click to show internal directories.
Click to hide internal directories.