lib

package
v0.0.0-...-7cd6839 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSignInData

func NewSignInData(m interface{}) signInData

func NewTestRW

func NewTestRW() (ResponseWrite, Request, chan []byte, chan bool)

Types

type Configure

type Configure struct {
	HttpHandleUrl       string `json:"HttpHandleUrl"`
	WebsocketHandlerUrl string `json:"WebsocketHandlerUrl"`
	DataVerify          DataVerifyType
	NadoDefaultHandle   Header

	MessageTimeout time.Duration `json:"MessageTimeout,timeunit:s"`
	AppKey         string        `json:"AppKey"`
	AppSecret      string        `json:"AppSecret"`

	NsqConsumerTopic  string `json:"NsqConsumerTopic"`
	NsqProducterTopic string `json:"NsqProducterTopic"`
	NsqChannel        string `json:"NsqChannel"`
	NsqDefaultHandle  Header
	NsqMaxConsumer    int      `json:"NsqMaxConsumer"`
	NsqdLookupds      []string `json:"NsqdLookupds"`
	NsqdAddress       string   `json:"NsqdAddress"`
	NsqConfig         *nsq.Config

	OnServeStop   func()
	OnServeStart  func()
	OnConnectStop func(w ResponseWrite, r Request) //当链接中断时的回调函数
}

type DataVerifyType

type DataVerifyType func([]byte) error

用来验证数据有效性的借口

type Header func(w ResponseWrite, r Request)

type Headers

type Headers map[uint16]Header

type Message

type Message interface {
	ByteBody() []byte
}

type Request

type Request interface {
	Reset()
	Type() uint16
	Unmarshal(interface{}) error
	Marshal(interface{}) error
	Byte() []byte
	BaseByte() []byte
	GetId() uint64
	SetType(uint16)
}

type RequestByNsq

type RequestByNsq interface {
	Reset()
	Type() uint16
	Unmarshal(interface{}) error
	Marshal(interface{}) error
	Byte() []byte
	BaseByte() []byte
	GetId() uint64
	GetRoute() string
	SetRoute(string)
	SetId(uint64)
	Copy() RequestByNsq
}

type RequestResponse

type RequestResponse struct {
	Res ResponseWrite
	Req Request
}

type ResponseWrite

type ResponseWrite interface {
	Write([]byte) error
	Close() error
}

type ResponseWriteByNsq

type ResponseWriteByNsq interface {
	Write([]byte) error
	Close() error
	Copy() ResponseWriteByNsq
}

type ServeHandle

type ServeHandle interface {
	Run(conf *Configure) error
	Stop()
}

type TestRequest

type TestRequest struct {
	TypeId uint16
	Id     uint64
	// contains filtered or unexported fields
}

func (*TestRequest) BaseByte

func (self *TestRequest) BaseByte() []byte

func (*TestRequest) Byte

func (self *TestRequest) Byte() []byte

func (*TestRequest) GetId

func (self *TestRequest) GetId() uint64

func (*TestRequest) GetRoute

func (self *TestRequest) GetRoute() string

func (*TestRequest) Marshal

func (self *TestRequest) Marshal(info interface{}) (err error)

func (*TestRequest) Reset

func (self *TestRequest) Reset()

func (*TestRequest) SetId

func (self *TestRequest) SetId(id uint64)

func (*TestRequest) SetRoute

func (self *TestRequest) SetRoute(s string)

func (*TestRequest) SetType

func (self *TestRequest) SetType(id uint16)

func (*TestRequest) Type

func (self *TestRequest) Type() uint16

func (*TestRequest) Unmarshal

func (self *TestRequest) Unmarshal(but interface{}) error

type TestResponseWrite

type TestResponseWrite struct {
	// contains filtered or unexported fields
}

func (*TestResponseWrite) Close

func (self *TestResponseWrite) Close() error

func (*TestResponseWrite) Write

func (self *TestResponseWrite) Write(b []byte) error

Jump to

Keyboard shortcuts

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