Documentation ¶
Index ¶
- Constants
- Variables
- func Marshal(v interface{}) ([]byte, error)
- func RegisterClientFactory(scheme string, newClient func(string) Client)
- func Serialize(v interface{}, simple bool) ([]byte, error)
- func Unmarshal(b []byte, p interface{}) error
- func Unserialize(b []byte, p interface{}, simple bool) error
- type ArgsFixer
- type BaseClient
- func (client *BaseClient) AddFilter(filter Filter)
- func (client *BaseClient) GetFilter() Filter
- func (client *BaseClient) Invoke(name string, args []interface{}, options *InvokeOptions, result interface{}) <-chan error
- func (client *BaseClient) RemoveFilter(filter Filter)
- func (client *BaseClient) SetFilter(filter Filter)
- func (client *BaseClient) SetUri(uri string)
- func (client *BaseClient) Uri() string
- func (client *BaseClient) UseService(args ...interface{})
- type BaseService
- type BufReader
- type BufWriter
- type BytesReader
- type Client
- type Filter
- type HttpClient
- func (client *HttpClient) Close()
- func (client *HttpClient) Compression() bool
- func (client *HttpClient) Http() *http.Client
- func (client *HttpClient) KeepAlive() bool
- func (client *HttpClient) MaxIdleConnsPerHost() int
- func (client *HttpClient) SetCompression(enable bool)
- func (client *HttpClient) SetKeepAlive(enable bool)
- func (client *HttpClient) SetMaxIdleConnsPerHost(value int)
- func (client *HttpClient) SetTLSClientConfig(config *tls.Config)
- func (client *HttpClient) SetUri(uri string)
- func (client *HttpClient) TLSClientConfig() *tls.Config
- type HttpContext
- type HttpService
- func (service *HttpService) AddAccessControlAllowOrigin(origin string)
- func (service *HttpService) ClientAccessPolicyXmlContent() []byte
- func (service *HttpService) ClientAccessPolicyXmlFile() string
- func (service *HttpService) CrossDomainXmlContent() []byte
- func (service *HttpService) CrossDomainXmlFile() string
- func (service *HttpService) RemoveAccessControlAllowOrigin(origin string)
- func (service *HttpService) ServeHTTP(response http.ResponseWriter, request *http.Request)
- func (service *HttpService) SetClientAccessPolicyXmlContent(content []byte)
- func (service *HttpService) SetClientAccessPolicyXmlFile(filename string)
- func (service *HttpService) SetCrossDomainXmlContent(content []byte)
- func (service *HttpService) SetCrossDomainXmlFile(filename string)
- type HttpServiceEvent
- type HttpTransporter
- type InvokeOptions
- type Method
- type Methods
- func (methods *Methods) AddAllMethods(obj interface{}, options ...interface{})
- func (methods *Methods) AddFunction(name string, function interface{}, options ...interface{})
- func (methods *Methods) AddFunctions(names []string, functions []interface{}, options ...interface{})
- func (methods *Methods) AddMethods(obj interface{}, options ...interface{})
- func (methods *Methods) AddMissingMethod(method MissingMethod, options ...interface{})
- type MissingMethod
- type RawReader
- type Reader
- func (r *Reader) CheckTag(expectTag byte) error
- func (r *Reader) CheckTags(expectTags []byte) (tag byte, err error)
- func (r *Reader) ReadArray(a []reflect.Value) error
- func (r *Reader) ReadBigInt() (*big.Int, error)
- func (r *Reader) ReadBigIntWithoutTag() (*big.Int, error)
- func (r *Reader) ReadBool() (bool, error)
- func (r *Reader) ReadBytes() (*[]byte, error)
- func (r *Reader) ReadBytesWithoutTag() (*[]byte, error)
- func (r *Reader) ReadDateTime() (time.Time, error)
- func (r *Reader) ReadDateWithoutTag() (time.Time, error)
- func (r *Reader) ReadFloat32() (float32, error)
- func (r *Reader) ReadFloat32WithoutTag() (float32, error)
- func (r *Reader) ReadFloat64() (float64, error)
- func (r *Reader) ReadFloat64WithoutTag() (float64, error)
- func (r *Reader) ReadInt() (int, error)
- func (r *Reader) ReadInt16() (int16, error)
- func (r *Reader) ReadInt16WithoutTag() (int16, error)
- func (r *Reader) ReadInt32() (int32, error)
- func (r *Reader) ReadInt32WithoutTag() (int32, error)
- func (r *Reader) ReadInt64() (int64, error)
- func (r *Reader) ReadInt64WithoutTag() (int64, error)
- func (r *Reader) ReadInt8() (int8, error)
- func (r *Reader) ReadInt8WithoutTag() (int8, error)
- func (r *Reader) ReadIntWithoutTag() (int, error)
- func (r *Reader) ReadInteger(tag byte) (int, error)
- func (r *Reader) ReadList() (*list.List, error)
- func (r *Reader) ReadListWithoutTag() (*list.List, error)
- func (r *Reader) ReadMap(p interface{}) error
- func (r *Reader) ReadMapWithoutTag(p interface{}) error
- func (r *Reader) ReadObject(p interface{}) error
- func (r *Reader) ReadObjectWithoutTag(p interface{}) error
- func (r *Reader) ReadSlice(p interface{}) error
- func (r *Reader) ReadSliceWithoutTag(p interface{}) error
- func (r *Reader) ReadString() (string, error)
- func (r *Reader) ReadStringWithoutTag() (str string, err error)
- func (r *Reader) ReadTimeWithoutTag() (time.Time, error)
- func (r *Reader) ReadUUID() (*UUID, error)
- func (r *Reader) ReadUUIDWithoutTag() (*UUID, error)
- func (r *Reader) ReadUint() (uint, error)
- func (r *Reader) ReadUint16() (uint16, error)
- func (r *Reader) ReadUint16WithoutTag() (uint16, error)
- func (r *Reader) ReadUint32() (uint32, error)
- func (r *Reader) ReadUint32WithoutTag() (uint32, error)
- func (r *Reader) ReadUint64() (uint64, error)
- func (r *Reader) ReadUint64WithoutTag() (uint64, error)
- func (r *Reader) ReadUint8() (uint8, error)
- func (r *Reader) ReadUint8WithoutTag() (uint8, error)
- func (r *Reader) ReadUintWithoutTag() (uint, error)
- func (r *Reader) ReadUinteger(tag byte) (uint, error)
- func (r *Reader) ReadValue(v reflect.Value) error
- func (r *Reader) Reset()
- func (r *Reader) Stream() BufReader
- func (r *Reader) Unserialize(p interface{}) (err error)
- type ResultMode
- type ServiceEvent
- type TcpClient
- func (client *TcpClient) Close()
- func (client *TcpClient) SetKeepAlive(keepalive bool)
- func (client *TcpClient) SetKeepAlivePeriod(d time.Duration)
- func (client *TcpClient) SetLinger(sec int)
- func (client *TcpClient) SetNoDelay(noDelay bool)
- func (client *TcpClient) SetReadBuffer(bytes int)
- func (client *TcpClient) SetReadTimeout(d time.Duration)
- func (client *TcpClient) SetTLSClientConfig(config *tls.Config)
- func (client *TcpClient) SetTimeout(d time.Duration)
- func (client *TcpClient) SetUri(uri string)
- func (client *TcpClient) SetWriteBuffer(bytes int)
- func (client *TcpClient) SetWriteTimeout(d time.Duration)
- func (client *TcpClient) TLSClientConfig() *tls.Config
- func (client *TcpClient) Timeout() time.Duration
- type TcpConnEntry
- type TcpConnPool
- type TcpServer
- type TcpService
- func (service *TcpService) ServeTCP(conn *net.TCPConn) (err error)
- func (service *TcpService) SetKeepAlive(keepalive bool)
- func (service *TcpService) SetKeepAlivePeriod(d time.Duration)
- func (service *TcpService) SetLinger(sec int)
- func (service *TcpService) SetNoDelay(noDelay bool)
- func (service *TcpService) SetReadBuffer(bytes int)
- func (service *TcpService) SetReadTimeout(d time.Duration)
- func (service *TcpService) SetTLSConfig(config *tls.Config)
- func (service *TcpService) SetTimeout(d time.Duration)
- func (service *TcpService) SetWriteBuffer(bytes int)
- func (service *TcpService) SetWriteTimeout(d time.Duration)
- type TcpTransporter
- type Transporter
- type UUID
- type Writer
- func (w *Writer) Reset()
- func (w *Writer) Serialize(v interface{}) (err error)
- func (w *Writer) Stream() BufWriter
- func (w *Writer) WriteArray(v []reflect.Value) (err error)
- func (w *Writer) WriteBigInt(v *big.Int) (err error)
- func (w *Writer) WriteBool(v bool) error
- func (w *Writer) WriteBytes(bytes []byte) (err error)
- func (w *Writer) WriteBytesWithRef(bytes []byte) (err error)
- func (w *Writer) WriteFloat64(v float64) (err error)
- func (w *Writer) WriteInt64(v int64) (err error)
- func (w *Writer) WriteNull() error
- func (w *Writer) WriteString(str string) (err error)
- func (w *Writer) WriteStringWithRef(str string) (err error)
- func (w *Writer) WriteTime(t time.Time) (err error)
- func (w *Writer) WriteUint64(v uint64) (err error)
- func (w *Writer) WriteValue(v reflect.Value) (err error)
Constants ¶
View Source
const ( Normal = ResultMode(iota) Serialized Raw RawWithEndTag )
View Source
const ( /* Serialize Tags */ TagInteger byte = 'i' TagLong byte = 'l' TagDouble byte = 'd' TagNull byte = 'n' TagEmpty byte = 'e' TagTrue byte = 't' TagFalse byte = 'f' TagNaN byte = 'N' TagInfinity byte = 'I' TagDate byte = 'D' TagTime byte = 'T' TagUTC byte = 'Z' TagBytes byte = 'b' TagUTF8Char byte = 'u' TagString byte = 's' TagGuid byte = 'g' TagList byte = 'a' TagMap byte = 'm' TagClass byte = 'c' TagObject byte = 'o' TagRef byte = 'r' /* Serialize Marks */ TagPos byte = '+' TagNeg byte = '-' TagSemicolon byte = ';' TagOpenbrace byte = '{' TagClosebrace byte = '}' TagQuote byte = '"' TagPoint byte = '.' /* Protocol Tags */ TagFunctions byte = 'F' TagCall byte = 'C' TagResult byte = 'R' TagArgument byte = 'A' TagError byte = 'E' TagEnd byte = 'z' )
Variables ¶
View Source
var ClassManager = initClassManager()
ClassManager used to be register class with alias for hprose serialize/unserialize.
View Source
var NilError = errors.New("nil")
Functions ¶
func RegisterClientFactory ¶
func Unserialize ¶
Types ¶
type BaseClient ¶
type BaseClient struct { Transporter ByRef bool SimpleMode bool DebugEnabled bool // contains filtered or unexported fields }
func NewBaseClient ¶
func NewBaseClient(trans Transporter) *BaseClient
func (*BaseClient) AddFilter ¶
func (client *BaseClient) AddFilter(filter Filter)
func (*BaseClient) GetFilter ¶
func (client *BaseClient) GetFilter() Filter
func (*BaseClient) Invoke ¶
func (client *BaseClient) Invoke(name string, args []interface{}, options *InvokeOptions, result interface{}) <-chan error
func (*BaseClient) RemoveFilter ¶
func (client *BaseClient) RemoveFilter(filter Filter)
func (*BaseClient) SetFilter ¶
func (client *BaseClient) SetFilter(filter Filter)
func (*BaseClient) SetUri ¶
func (client *BaseClient) SetUri(uri string)
func (*BaseClient) Uri ¶
func (client *BaseClient) Uri() string
func (*BaseClient) UseService ¶
func (client *BaseClient) UseService(args ...interface{})
UseService(uri string) UseService(remoteObject interface{}) UseService(uri string, remoteObject interface{})
type BaseService ¶
type BaseService struct { *Methods ServiceEvent DebugEnabled bool // contains filtered or unexported fields }
func NewBaseService ¶
func NewBaseService() *BaseService
func (*BaseService) AddFilter ¶
func (service *BaseService) AddFilter(filter Filter)
func (*BaseService) GetFilter ¶
func (service *BaseService) GetFilter() Filter
func (*BaseService) Handle ¶
func (service *BaseService) Handle(data []byte, context interface{}) (output []byte)
func (*BaseService) RemoveFilter ¶
func (service *BaseService) RemoveFilter(filter Filter)
func (*BaseService) SetFilter ¶
func (service *BaseService) SetFilter(filter Filter)
type BytesReader ¶
type BytesReader struct {
// contains filtered or unexported fields
}
func NewBytesReader ¶
func NewBytesReader(b []byte) *BytesReader
func (*BytesReader) ReadByte ¶
func (r *BytesReader) ReadByte() (b byte, err error)
func (*BytesReader) ReadString ¶
func (r *BytesReader) ReadString(delim byte) (line string, err error)
type Client ¶
type Client interface { UseService(...interface{}) Invoke(string, []interface{}, *InvokeOptions, interface{}) <-chan error Uri() string SetUri(string) GetFilter() Filter SetFilter(filter Filter) AddFilter(filter Filter) RemoveFilter(filter Filter) TLSClientConfig() *tls.Config SetTLSClientConfig(config *tls.Config) SetKeepAlive(enable bool) Close() }
func NewHttpClient ¶
func NewTcpClient ¶
type HttpClient ¶
type HttpClient struct {
*BaseClient
}
func (*HttpClient) Close ¶
func (client *HttpClient) Close()
func (*HttpClient) Compression ¶
func (client *HttpClient) Compression() bool
func (*HttpClient) Http ¶
func (client *HttpClient) Http() *http.Client
func (*HttpClient) KeepAlive ¶
func (client *HttpClient) KeepAlive() bool
func (*HttpClient) MaxIdleConnsPerHost ¶
func (client *HttpClient) MaxIdleConnsPerHost() int
func (*HttpClient) SetCompression ¶
func (client *HttpClient) SetCompression(enable bool)
func (*HttpClient) SetKeepAlive ¶
func (client *HttpClient) SetKeepAlive(enable bool)
func (*HttpClient) SetMaxIdleConnsPerHost ¶
func (client *HttpClient) SetMaxIdleConnsPerHost(value int)
func (*HttpClient) SetTLSClientConfig ¶
func (client *HttpClient) SetTLSClientConfig(config *tls.Config)
func (*HttpClient) SetUri ¶
func (client *HttpClient) SetUri(uri string)
func (*HttpClient) TLSClientConfig ¶
func (client *HttpClient) TLSClientConfig() *tls.Config
type HttpContext ¶
type HttpContext struct { Response http.ResponseWriter Request *http.Request }
type HttpService ¶
type HttpService struct { *BaseService P3PEnabled bool GetEnabled bool CrossDomainEnabled bool // contains filtered or unexported fields }
func NewHttpService ¶
func NewHttpService() *HttpService
func (*HttpService) AddAccessControlAllowOrigin ¶
func (service *HttpService) AddAccessControlAllowOrigin(origin string)
func (*HttpService) ClientAccessPolicyXmlContent ¶
func (service *HttpService) ClientAccessPolicyXmlContent() []byte
func (*HttpService) ClientAccessPolicyXmlFile ¶
func (service *HttpService) ClientAccessPolicyXmlFile() string
func (*HttpService) CrossDomainXmlContent ¶
func (service *HttpService) CrossDomainXmlContent() []byte
func (*HttpService) CrossDomainXmlFile ¶
func (service *HttpService) CrossDomainXmlFile() string
func (*HttpService) RemoveAccessControlAllowOrigin ¶
func (service *HttpService) RemoveAccessControlAllowOrigin(origin string)
func (*HttpService) ServeHTTP ¶
func (service *HttpService) ServeHTTP(response http.ResponseWriter, request *http.Request)
func (*HttpService) SetClientAccessPolicyXmlContent ¶
func (service *HttpService) SetClientAccessPolicyXmlContent(content []byte)
func (*HttpService) SetClientAccessPolicyXmlFile ¶
func (service *HttpService) SetClientAccessPolicyXmlFile(filename string)
func (*HttpService) SetCrossDomainXmlContent ¶
func (service *HttpService) SetCrossDomainXmlContent(content []byte)
func (*HttpService) SetCrossDomainXmlFile ¶
func (service *HttpService) SetCrossDomainXmlFile(filename string)
type HttpServiceEvent ¶
type HttpServiceEvent interface { ServiceEvent OnSendHeader(response http.ResponseWriter, request *http.Request) }
type HttpTransporter ¶
func (*HttpTransporter) SendAndReceive ¶
func (h *HttpTransporter) SendAndReceive(uri string, data []byte) ([]byte, error)
type InvokeOptions ¶
type InvokeOptions struct { ByRef interface{} // true, false, nil SimpleMode interface{} // true, false, nil ResultMode ResultMode }
type Methods ¶
func NewMethods ¶
func NewMethods() *Methods
func (*Methods) AddAllMethods ¶
func (methods *Methods) AddAllMethods(obj interface{}, options ...interface{})
AddAllMethods will publish all methods and non-nil function fields on the obj self and on its anonymous or non-anonymous struct fields (or pointer to pointer ... to pointer struct fields). This is a recursive operation. So it's a pit, if you do not know what you are doing, do not step on.
func (*Methods) AddFunction ¶
func (*Methods) AddFunctions ¶
func (*Methods) AddMethods ¶
func (methods *Methods) AddMethods(obj interface{}, options ...interface{})
func (*Methods) AddMissingMethod ¶
func (methods *Methods) AddMissingMethod(method MissingMethod, options ...interface{})
type MissingMethod ¶
type RawReader ¶
type RawReader struct {
// contains filtered or unexported fields
}
func NewRawReader ¶
type Reader ¶
type Reader struct { *RawReader // contains filtered or unexported fields }
func (*Reader) ReadBytesWithoutTag ¶
func (*Reader) ReadFloat32 ¶
func (*Reader) ReadFloat32WithoutTag ¶
func (*Reader) ReadFloat64 ¶
func (*Reader) ReadFloat64WithoutTag ¶
func (*Reader) ReadInt16WithoutTag ¶
func (*Reader) ReadInt32WithoutTag ¶
func (*Reader) ReadInt64WithoutTag ¶
func (*Reader) ReadInt8WithoutTag ¶
func (*Reader) ReadIntWithoutTag ¶
func (*Reader) ReadMapWithoutTag ¶
func (*Reader) ReadObject ¶
func (*Reader) ReadObjectWithoutTag ¶
func (*Reader) ReadSliceWithoutTag ¶
func (*Reader) ReadString ¶
func (*Reader) ReadStringWithoutTag ¶
func (*Reader) ReadUUIDWithoutTag ¶
func (*Reader) ReadUint16 ¶
func (*Reader) ReadUint16WithoutTag ¶
func (*Reader) ReadUint32 ¶
func (*Reader) ReadUint32WithoutTag ¶
func (*Reader) ReadUint64 ¶
func (*Reader) ReadUint64WithoutTag ¶
func (*Reader) ReadUint8WithoutTag ¶
func (*Reader) ReadUintWithoutTag ¶
func (*Reader) Unserialize ¶
type ResultMode ¶
type ResultMode int
func (ResultMode) String ¶
func (result_mode ResultMode) String() string
type ServiceEvent ¶
type TcpClient ¶
type TcpClient struct { *BaseClient // contains filtered or unexported fields }
func (*TcpClient) SetKeepAlive ¶
func (*TcpClient) SetKeepAlivePeriod ¶
func (*TcpClient) SetNoDelay ¶
func (*TcpClient) SetReadBuffer ¶
func (*TcpClient) SetReadTimeout ¶
func (*TcpClient) SetTLSClientConfig ¶
func (*TcpClient) SetTimeout ¶
func (*TcpClient) SetWriteBuffer ¶
func (*TcpClient) SetWriteTimeout ¶
func (*TcpClient) TLSClientConfig ¶
type TcpConnEntry ¶
type TcpConnEntry struct {
// contains filtered or unexported fields
}
func (*TcpConnEntry) Close ¶
func (connEntry *TcpConnEntry) Close()
func (*TcpConnEntry) Get ¶
func (connEntry *TcpConnEntry) Get() net.Conn
func (*TcpConnEntry) Set ¶
func (connEntry *TcpConnEntry) Set(conn net.Conn)
type TcpConnPool ¶
func (*TcpConnPool) Close ¶
func (connPool *TcpConnPool) Close(uri string)
func (*TcpConnPool) Free ¶
func (connPool *TcpConnPool) Free(entry *TcpConnEntry)
func (*TcpConnPool) Get ¶
func (connPool *TcpConnPool) Get(uri string) *TcpConnEntry
func (*TcpConnPool) SetTimeout ¶
func (connPool *TcpConnPool) SetTimeout(d time.Duration)
func (*TcpConnPool) Timeout ¶
func (connPool *TcpConnPool) Timeout() time.Duration
type TcpServer ¶
type TcpServer struct { *TcpService URL string ThreadCount int // contains filtered or unexported fields }
func NewTcpServer ¶
type TcpService ¶
type TcpService struct { *BaseService // contains filtered or unexported fields }
func NewTcpService ¶
func NewTcpService() *TcpService
func (*TcpService) SetKeepAlive ¶
func (service *TcpService) SetKeepAlive(keepalive bool)
func (*TcpService) SetKeepAlivePeriod ¶
func (service *TcpService) SetKeepAlivePeriod(d time.Duration)
func (*TcpService) SetLinger ¶
func (service *TcpService) SetLinger(sec int)
func (*TcpService) SetNoDelay ¶
func (service *TcpService) SetNoDelay(noDelay bool)
func (*TcpService) SetReadBuffer ¶
func (service *TcpService) SetReadBuffer(bytes int)
func (*TcpService) SetReadTimeout ¶
func (service *TcpService) SetReadTimeout(d time.Duration)
func (*TcpService) SetTLSConfig ¶
func (service *TcpService) SetTLSConfig(config *tls.Config)
func (*TcpService) SetTimeout ¶
func (service *TcpService) SetTimeout(d time.Duration)
func (*TcpService) SetWriteBuffer ¶
func (service *TcpService) SetWriteBuffer(bytes int)
func (*TcpService) SetWriteTimeout ¶
func (service *TcpService) SetWriteTimeout(d time.Duration)
type TcpTransporter ¶
type TcpTransporter struct { *TcpClient // contains filtered or unexported fields }
func (*TcpTransporter) SendAndReceive ¶
func (t *TcpTransporter) SendAndReceive(uri string, odata []byte) (idata []byte, err error)
type Transporter ¶
type UUID ¶
type UUID []byte
This type is only a UUID wrapper for hprose serialize/unserialize, If you want to generate UUIDs, you should use other UUID package.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
func (*Writer) WriteBytes ¶
func (*Writer) WriteBytesWithRef ¶
func (*Writer) WriteFloat64 ¶
func (*Writer) WriteInt64 ¶
func (*Writer) WriteString ¶
func (*Writer) WriteStringWithRef ¶
func (*Writer) WriteUint64 ¶
Click to show internal directories.
Click to hide internal directories.