secconf

package
v0.3.23 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecoderBase64

func DecoderBase64(data []byte) ([]byte, error)

DecoderBase64 base64解码

func DecoderGZip

func DecoderGZip(data []byte) ([]byte, error)

DecoderGZip gzip解码

func EncoderBase64

func EncoderBase64(data []byte) ([]byte, error)

EncoderBase64 base64编码器

func EncoderGZip

func EncoderGZip(data []byte) ([]byte, error)

EncoderGZip gzip编码器

func Reader

func Reader(reader io.Reader, cf Codec) io.Reader

Reader 用给定的Codec将给定的reader封装成新的io.Reader,数据读取流程中会经给定的Codec进行编解码

Types

type Codec

type Codec interface {
	Apply(data []byte) ([]byte, error)
}

Codec 编解码器接口

func CodecFrom

func CodecFrom(codec ...CodecFunc) Codec

CodecFrom 由给定的CodecFunc列表构造Codec

func StandardChainDecode

func StandardChainDecode(decrypt CodecFunc) Codec

StandardChainDecode 默认解码器链:base64 => decrypt => gzip

func StandardChainEncode

func StandardChainEncode(encrypt CodecFunc) Codec

StandardChainEncode 默认编码器链:gzip => encrypt => base64

type CodecFunc

type CodecFunc func(data []byte) ([]byte, error)

CodecFunc 编辑吗函数类型

func NewDecoderMagic

func NewDecoderMagic(magic []byte) CodecFunc

NewDecoderMagic 新建一个magic decoder,指定magic字段,解码的时候会检测该字段

func NewDecoderOpenPGP

func NewDecoderOpenPGP(secertKeyring []byte) CodecFunc

NewDecoderOpenPGP 新建OpenPGP解码器,指定key

func NewDecoderXXTEA

func NewDecoderXXTEA(key []byte) CodecFunc

NewDecoderXXTEA 新建xxtea解码器,指定key

func NewEncoderMagic

func NewEncoderMagic(magic []byte) CodecFunc

NewEncoderMagic magic编码器,指定magic,编码时会自动将magic添加到字段头

func NewEncoderOpenPGP

func NewEncoderOpenPGP(secertKeyring []byte) CodecFunc

NewEncoderOpenPGP OpenPGP编码器,指定key

func NewEncoderXXTEA

func NewEncoderXXTEA(key []byte) CodecFunc

NewEncoderXXTEA xxtea编码器,指定key

func (CodecFunc) Apply

func (f CodecFunc) Apply(data []byte) ([]byte, error)

Apply CodecFunc 实现Codec接口

type CodecFuncChain

type CodecFuncChain []CodecFunc

CodecFuncChain 编解码器链

func (CodecFuncChain) Apply

func (c CodecFuncChain) Apply(data []byte) (out []byte, err error)

Apply CodecFuncChain实现Codec接口

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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