Documentation ¶
Index ¶
- func CheckHash(ident, pass, reqSalt, reqHash []byte) bool
- func ConnExec(ctx context.Context, conn net.Conn, method string, param any, result any, ...) error
- func ConnGet(ctx context.Context, conn net.Conn, method string, writer io.Writer, ...) error
- func ConnPut(ctx context.Context, conn net.Conn, method string, reader io.Reader, ...) error
- func CopyBytes(ctx context.Context, reader io.Reader, writer io.Writer, dataSize int64) (int64, error)
- func CreateHash(ident, pass, salt []byte) []byte
- func CreateSalt() []byte
- func DecoderI64(b []byte) int64
- func EncoderI64(i int64) []byte
- func Exec(ctx context.Context, address, method string, param any, result any, auth *Auth) error
- func ExecTLS(ctx context.Context, tlsConfig *tls.Config, address, method string, param any, ...) error
- func Get(ctx context.Context, address string, method string, writer io.Writer, ...) error
- func GetTLS(ctx context.Context, tlsConfig *tls.Config, address string, method string, ...) error
- func LocalExec(method string, param, result any, auth *Auth, handler HandlerFunc) error
- func LocalGet(ctx context.Context, method string, writer io.Writer, param, result any, ...) error
- func LocalPut(ctx context.Context, method string, reader io.Reader, size int64, ...) error
- func LocalService(conn net.Conn, handler HandlerFunc) error
- func LogAccess(content *Content) error
- func LogRequest(content *Content) error
- func LogResponse(content *Content) error
- func NewFConn() (*FConn, *FConn)
- func Put(ctx context.Context, address string, method string, reader io.Reader, ...) error
- func PutTLS(ctx context.Context, tlsConfig *tls.Config, address string, method string, ...) error
- func ReadBytes(reader io.Reader, size int64) ([]byte, error)
- func SetAccessWriter(writer io.Writer)
- func SetMessageWriter(writer io.Writer)
- type Auth
- type Content
- func (context *Content) Auth() *Auth
- func (context *Content) AuthHash() []byte
- func (context *Content) AuthIdent() []byte
- func (context *Content) AuthSalt() []byte
- func (content *Content) BinReader() io.Reader
- func (content *Content) BinSize() int64
- func (content *Content) BinWriter() io.Writer
- func (content *Content) BindMethod() error
- func (content *Content) BindParams(params any) error
- func (context *Content) Method() string
- func (content *Content) ReadBin(ctx context.Context, writer io.Writer) error
- func (content *Content) ReadRequest() error
- func (context *Content) RemoteHost() string
- func (context *Content) ReqBinSize() int64
- func (context *Content) ReqRpcSize() int64
- func (context *Content) ReqSize() int64
- func (context *Content) Request() *Request
- func (context *Content) ResBinSize() int64
- func (context *Content) ResRpcSize() int64
- func (context *Content) ResSize() int64
- func (content *Content) SendError(execErr error) error
- func (content *Content) SendResult(result any, binSize int64) error
- func (context *Content) SetAuthHash(hash []byte)
- func (context *Content) SetAuthIdent(ident []byte)
- func (context *Content) SetAuthSalt(salt []byte)
- func (context *Content) Start() time.Time
- type EmptyParams
- type EmptyResult
- type FAddr
- type FConn
- func (conn FConn) Close() error
- func (conn FConn) LocalAddr() net.Addr
- func (conn FConn) Read(data []byte) (int, error)
- func (conn FConn) RemoteAddr() net.Addr
- func (conn FConn) SetDeadline(t time.Time) error
- func (conn FConn) SetReadDeadline(t time.Time) error
- func (conn FConn) SetWriteDeadline(t time.Time) error
- func (conn FConn) Write(data []byte) (int, error)
- type HandlerFunc
- type Header
- type Packet
- type Request
- type Response
- type Service
- func (svc *Service) Handle(method string, handler HandlerFunc)
- func (svc *Service) Listen(address string) error
- func (svc *Service) ListenTLS(address string, tlsConfig *tls.Config) error
- func (svc *Service) PostMiddleware(mw HandlerFunc)
- func (svc *Service) PreMiddleware(mw HandlerFunc)
- func (svc *Service) Route(content *Content) error
- func (svc *Service) SetKeepAlive(flag bool)
- func (svc *Service) SetKeepAlivePeriod(interval time.Duration)
- func (svc *Service) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateHash ¶
func CreateSalt ¶
func CreateSalt() []byte
func DecoderI64 ¶ added in v1.2.0
func EncoderI64 ¶ added in v1.2.0
func LocalExec ¶
func LocalExec(method string, param, result any, auth *Auth, handler HandlerFunc) error
func LocalService ¶
func LocalService(conn net.Conn, handler HandlerFunc) error
func LogRequest ¶
func LogResponse ¶
func SetAccessWriter ¶
func SetMessageWriter ¶
Types ¶
type Auth ¶
type Auth struct { Ident []byte `msgpack:"ident" json:"ident"` Salt []byte `msgpack:"salt" json:"salt"` Hash []byte `msgpack:"hash" json:"hash"` }
func CreateAuth ¶
type Content ¶ added in v1.1.2
type Content struct {
// contains filtered or unexported fields
}
func CreateContent ¶ added in v1.1.2
func (*Content) BindMethod ¶ added in v1.1.2
func (*Content) BindParams ¶ added in v1.1.2
func (*Content) ReadRequest ¶ added in v1.1.2
func (*Content) RemoteHost ¶ added in v1.1.2
func (*Content) ReqBinSize ¶ added in v1.1.2
func (*Content) ReqRpcSize ¶ added in v1.1.2
func (*Content) ResBinSize ¶ added in v1.1.2
func (*Content) ResRpcSize ¶ added in v1.1.2
func (*Content) SendResult ¶ added in v1.1.2
func (*Content) SetAuthHash ¶ added in v1.1.2
func (*Content) SetAuthIdent ¶ added in v1.1.2
func (*Content) SetAuthSalt ¶ added in v1.1.2
type EmptyParams ¶ added in v1.1.1
type EmptyParams struct{}
func NewEmptyParams ¶ added in v1.1.1
func NewEmptyParams() *EmptyParams
type EmptyResult ¶ added in v1.1.1
type EmptyResult struct{}
func NewEmptyResult ¶ added in v1.1.1
func NewEmptyResult() *EmptyResult
type FConn ¶
type FConn struct {
// contains filtered or unexported fields
}
func (FConn) RemoteAddr ¶
type HandlerFunc ¶
type Header ¶
type Header struct {
// contains filtered or unexported fields
}
func NewEmptyHeader ¶ added in v1.1.1
func NewEmptyHeader() *Header
func UnpackHeader ¶
type Packet ¶
type Packet struct {
// contains filtered or unexported fields
}
func NewEmptyPacket ¶ added in v1.1.1
func NewEmptyPacket() *Packet
type Request ¶
type Request struct { Method string `json:"method" msgpack:"method"` Params any `json:"params,omitempty" msgpack:"params"` Auth *Auth `json:"auth,omitempty" msgpack:"auth"` }
func NewEmptyRequest ¶ added in v1.1.1
func NewEmptyRequest() *Request
type Response ¶
type Response struct { Error string `json:"error" msgpack:"error"` Result any `json:"result" msgpack:"result"` }
func NewEmptyResponse ¶ added in v1.1.1
func NewEmptyResponse() *Response
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService() *Service
func (*Service) Handle ¶ added in v1.2.2
func (svc *Service) Handle(method string, handler HandlerFunc)
func (*Service) PostMiddleware ¶
func (svc *Service) PostMiddleware(mw HandlerFunc)
func (*Service) PreMiddleware ¶
func (svc *Service) PreMiddleware(mw HandlerFunc)
func (*Service) SetKeepAlive ¶ added in v1.1.0
func (*Service) SetKeepAlivePeriod ¶ added in v1.1.0
Click to show internal directories.
Click to hide internal directories.