httpagent

package
v0.0.0-...-8ffdd24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2016 License: Apache-2.0 Imports: 20 Imported by: 0

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

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 Close

func Close() error

Close this server

func HandleConn

func HandleConn(conn net.Conn)

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.

func Start

func Start(host string, port int) (err error)

Start HTTP agent and listen to accept connections from vex. It will parse requests and handle them. Requests will be redirect to appropriate HTTP Servers.

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) MarshalTo

func (m *HeaderEntry) MarshalTo(data []byte) (int, 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 LockConn

type LockConn struct {
	net.Conn
	sync.Mutex
}

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) Descriptor() ([]byte, []int)

func (*Request) Equal

func (this *Request) Equal(that interface{}) bool

func (*Request) GetAccept

func (m *Request) GetAccept() string

func (*Request) GetBody

func (m *Request) GetBody() []byte

func (*Request) GetHeaders

func (m *Request) GetHeaders() []*HeaderEntry

func (*Request) GetId

func (m *Request) GetId() int32

func (*Request) GetMethod

func (m *Request) GetMethod() string

func (*Request) GetResultPerPage

func (m *Request) GetResultPerPage() int32

func (*Request) GetUrl

func (m *Request) GetUrl() string

func (*Request) GoString

func (this *Request) GoString() string

func (*Request) Marshal

func (m *Request) Marshal() (data []byte, err error)

func (*Request) MarshalTo

func (m *Request) MarshalTo(data []byte) (int, error)

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) Size

func (m *Request) Size() (n int)

func (*Request) String

func (this *Request) String() string

func (*Request) Unmarshal

func (m *Request) Unmarshal(data []byte) error

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) Descriptor() ([]byte, []int)

func (*Response) Equal

func (this *Response) Equal(that interface{}) bool

func (*Response) GetBody

func (m *Response) GetBody() []byte

func (*Response) GetHeaders

func (m *Response) GetHeaders() []*HeaderEntry

func (*Response) GetId

func (m *Response) GetId() int32

func (*Response) GetIsRedirect

func (m *Response) GetIsRedirect() bool

func (*Response) GetIsReply

func (m *Response) GetIsReply() bool

func (*Response) GetLocation

func (m *Response) GetLocation() string

func (*Response) GetStatusCode

func (m *Response) GetStatusCode() int32

func (*Response) GoString

func (this *Response) GoString() string

func (*Response) Marshal

func (m *Response) Marshal() (data []byte, err error)

func (*Response) MarshalTo

func (m *Response) MarshalTo(data []byte) (int, error)

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) Size

func (m *Response) Size() (n int)

func (*Response) String

func (this *Response) String() string

func (*Response) Unmarshal

func (m *Response) Unmarshal(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL