Documentation ¶
Overview ¶
Package xfer is transfer filter set.
Copyright 2017 HenryLee. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func Reg(xferFilter XferFilter)
- type XferFilter
- type XferPipe
- func (x *XferPipe) Append(filterID ...byte) error
- func (x *XferPipe) AppendFrom(src *XferPipe)
- func (x *XferPipe) IDs() []byte
- func (x *XferPipe) Len() int
- func (x *XferPipe) Names() []string
- func (x *XferPipe) OnPack(data []byte) ([]byte, error)
- func (x *XferPipe) OnUnpack(data []byte) ([]byte, error)
- func (x *XferPipe) Range(callback func(idx int, filter XferFilter) bool)
- func (x *XferPipe) Reset()
Constants ¶
This section is empty.
Variables ¶
var ErrXferPipeTooLong = errors.New("The length of transfer pipe cannot be bigger than 255")
ErrXferPipeTooLong error
Functions ¶
Types ¶
type XferFilter ¶
type XferFilter interface { // ID returns transfer filter id. ID() byte // Name returns transfer filter name. Name() string // OnPack performs filtering on packing. OnPack([]byte) ([]byte, error) // OnUnpack performs filtering on unpacking. OnUnpack([]byte) ([]byte, error) }
XferFilter handles byte stream of message when transfer.
func GetByName ¶
func GetByName(name string) (XferFilter, error)
GetByName returns transfer filter by name.
type XferPipe ¶
type XferPipe struct {
// contains filtered or unexported fields
}
XferPipe transfer filter pipe, handlers from outer-most to inner-most. NOTE: the length can not be bigger than 255!
func (*XferPipe) AppendFrom ¶
AppendFrom appends transfer filters from a *XferPipe.